Dataset Viewer
Auto-converted to Parquet Duplicate
system
stringclasses
1 value
tools
sequencelengths
0
0
messages
listlengths
1
32
conversation_id
int64
0
1.2k
[]
[ { "content": "Write a function in JavaScript that listens for changes to the value of a form input field and updates a live preview div with the new content, but only if it passes a validation check (e.g., no profanity).", "role": "user" }, { "content": "Certainly! Below is a simple JavaScript funct...
0
[]
[ { "content": "Design a SQL query to find all customers who have made more than three purchases in the last month, assuming there exist tables for `customers` (with customer ID) and `purchases` (with purchase date, amount, and customer ID).", "role": "user" }, { "content": "To design a SQL query that...
1
[]
[ { "content": "Create a Python function `merge_dicts` that takes two dictionaries as input and merges them. The function should prioritize the key-value pairs from the second dictionary when there are duplicate keys.", "role": "user" }, { "content": "Certainly! Below is a Python function named `merge...
2
[]
[ { "content": "Develop a SQL query that selects the top 3 highest-earning employees in each department from a table named `employees`, assuming the table has columns for `employee_id`, `name`, `salary`, and `department`.", "role": "user" }, { "content": "To select the top 3 highest-earning employees ...
3
[]
[ { "content": "Create a Python script that connects to a publicly available API (e.g., http://jsonplaceholder.typicode.com/posts) and fetches the data. Ensure that the script parses the JSON data and outputs the title of the first post in the response.", "role": "user" }, { "content": "To connect to ...
4
[]
[ { "content": "Implement an algorithm in Python that takes a list of numbers as input and returns a new list with each number squared. For example, given `[1, 2, 3, 4]`, the output should be `[1, 4, 9, 16]`.", "role": "user" }, { "content": "Certainly! Below is a Python function that takes a list of ...
5
[]
[ { "content": "Write a function in Python that takes a string as input and checks whether the string is a palindrome (reads the same backward as forward, ignoring spaces, punctuation, and case). For instance, \"A man, a plan, a canal: Panama\" is a palindrome.", "role": "user" }, { "content": "Certai...
6
[]
[ { "content": "Design a Python function that accepts a list of integers and returns a new list with each integer squared. Ensure your function handles negative numbers and zeros correctly.\n\n```python\ndef square_list(numbers):\n squared_numbers = [number ** 2 for number in numbers]\n return squared_numbe...
7
[]
[ { "content": "Implement a Python function that takes a string as input and returns a dictionary where each key is a character in the string, and its value is the number of times the character appears in the string.\n\n```python\ndef char_frequency(s):\n frequency = {}\n for char in s:\n if char in ...
8
[]
[ { "content": "Create a Python function that generates and returns the first *n* Fibonacci numbers in a list, where *n* is a positive integer provided as input to the function.\n\n```python\ndef generate_fibonacci(n):\n fib_series = [0, 1]\n for i in range(2, n):\n next_fib = fib_series[i-1] + fib_s...
9
[]
[ { "content": "Create a Python script that establishes a connection to a PostgreSQL database using psycopg2, runs a query to fetch the last 10 records from a table named 'sales', and prints the result.", "role": "user" }, { "content": "To establish a connection to a PostgreSQL database and fetch the ...
10
[]
[ { "content": "Write a JavaScript function that takes an array of URLs, fetches data asynchronously from each URL using the Fetch API, and logs the length of each response body.", "role": "user" }, { "content": "Certainly! Below is a JavaScript function that takes an array of URLs, fetches data async...
11
[]
[ { "content": "Write a function `isomorphic_strings` in Python that checks if two given strings, `s` and `t`, are isomorphic. Two strings are isomorphic if the characters in `s` can be replaced to get `t`, ensuring that no two characters map to the same character unless they are replaced by themselves. Provide e...
12
[]
[ { "content": "Develop a Python function to check if a given string is a palindrome. The function should be case insensitive and ignore spaces.", "role": "user" }, { "content": "Certainly! Below is a Python function that checks if a given string is a palindrome, considering the requirements to be cas...
13
[]
[ { "content": "Create a Python program to sort a list of names alphabetically. Ensure your program can handle names with mixed case (e.g., \"alice\", \"Zoe\", \"bob\") by treating upper and lower case letters as equivalent.", "role": "user" }, { "content": "Certainly! Below is a Python program that s...
14
[]
[ { "content": "Write a JavaScript function that takes an array of numbers and returns the sum of the squares of those numbers. The function should work for both integer and floating point numbers.", "role": "user" }, { "content": "Certainly! Below is a JavaScript function that takes an array of numbe...
15
[]
[ { "content": "Design a SQL query to find all employees who earn more than their managers. The database contains two tables: `Employees(id, name, managerId, salary)` and `Managers(managerId, name)`. Assume each employee has only one manager.", "role": "user" }, { "content": "To find all employees who...
16
[]
[ { "content": "Design a Python script that connects to an API of your choice (for example, OpenWeatherMap API), fetches the current weather data for a specified location, and prints the temperature, humidity, and weather description.", "role": "user" }, { "content": "To create a Python script that fe...
17
[]
[ { "content": "Create a class in Python to represent a simple bank account. The class should support methods for depositing money, withdrawing money, and checking the account balance. Ensure that the account balance cannot go below zero.", "role": "user" }, { "content": "Certainly! Below is a simple ...
18
[]
[ { "content": "Implement a function in Python that generates a Fibonacci sequence using recursion and returns the n-th Fibonacci number. The Fibonacci sequence starts with 0 (0th Fibonacci) and 1 (1st Fibonacci), and each subsequent number is the sum of the previous two.", "role": "user" }, { "conten...
19
[]
[ { "content": "Write a Python function that simulates tossing a fair coin 100 times. Your function should return the total number of heads and tails.", "role": "user" }, { "content": "Certainly! To simulate tossing a fair coin 100 times in Python, you can use the `random` module, which includes a fun...
20
[]
[ { "content": "Write a Python function to merge two sorted lists into a new sorted list. The input lists will be of integers and can be of different lengths.\n\n```\ndef merge_sorted_lists(list1, list2):\n # Your code here\n```", "role": "user" }, { "content": "Certainly! Below is a Python functio...
21
[]
[ { "content": "Implement a Python function to check whether a given string is a palindrome, ignoring spaces, punctuation, and case sensitivity.", "role": "user" }, { "content": "To create a Python function that checks if a given string is a palindrome while ignoring spaces, punctuation, and case sens...
22
[]
[ { "content": "You are tasked with implementing a simple text-based calculator that can evaluate expressions containing add (‘+’), subtract (‘-’), multiply (‘*’), and divide (‘/’) operations on integers. The input will be a string representing the expression, e.g., \"3 + 5 * 2\". The program should return the re...
23
[]
[ { "content": "Create a function that takes an unsorted array of integers and returns a new array with the same integers in ascending order. Do not use the built-in sort functions; instead, implement one of the basic sorting algorithms (e.g., bubble sort, selection sort, or insertion sort).", "role": "user" ...
24
[]
[ { "content": "Design a function that can serialize a binary search tree into a string and then deserialize that string back into the original binary search tree. The serialization format is up to you but ensure it is as efficient as possible.", "role": "user" }, { "content": "To efficiently serializ...
25
[]
[ { "content": "Create a Python function that takes a list of integers and returns a new list containing just the even numbers from the original list, multiplied by 2.", "role": "user" }, { "content": "Certainly! Below is a Python function that accomplishes the task you described. This function iterat...
26
[]
[ { "content": "Design a RESTful API endpoint in Flask that takes a username and returns a welcome message containing the username.", "role": "user" }, { "content": "To design a RESTful API endpoint in Flask that takes a username and returns a welcome message containing the username, you can follow th...
27
[]
[ { "content": "Write a SQL query that selects the top 3 highest-selling products from a `sales` table that contains columns `product_id`, `product_name`, and `units_sold`.", "role": "user" }, { "content": "To select the top 3 highest-selling products based on the `units_sold` column from the `sales` ...
28
[]
[ { "content": "Write a function to compress a string using the counts of repeated characters. For example, the string `\"aabcccccaaa\"` would become `\"a2b1c5a3\"`. If the compressed string would not become smaller than the original string, your function should return the original string. You can assume the stri...
29
[]
[ { "content": "Write a recursive function to generate all the permutations of a string. The characters are unique and can be assumed to be in lowercase.", "role": "user" }, { "content": "To generate all permutations of a string recursively, we can follow a simple strategy: for each character in the s...
30
[]
[ { "content": "Design a memoization solution to calculate the nth Fibonacci number. The standard recursive approach results in a lot of repeated work. Your solution should efficiently avoid recalculating values that have already been computed.", "role": "user" }, { "content": "To efficiently calculat...
31
[]
[ { "content": "Implement a simple linear search algorithm in Python that searches for a given value within an unsorted list and returns the index of the value if found, or -1 if the value is not present in the list.", "role": "user" }, { "content": "Certainly! Below is a Python function that implemen...
32
[]
[ { "content": "Write a Python function that takes a list of numbers and returns a new list that contains each number from the original list only once. You should not use any built-in functions like `set()`.", "role": "user" }, { "content": "Certainly! To achieve this, you can iterate through the orig...
33
[]
[ { "content": "Implement a function to perform matrix multiplication between two matrices. The function should check if the matrices can be multiplied based on their dimensions and return the resulting matrix or an appropriate error message.", "role": "user" }, { "content": "To perform matrix multipl...
34
[]
[ { "content": "Create a Python script that scrapes weather data (like temperature, humidity, and wind speed) for a given city from a webpage and stores this information in a CSV file.", "role": "user" }, { "content": "Certainly! Below is a simple Python script that scrapes weather data for a given ci...
35
[]
[ { "content": "Design a RESTful API using Flask that allows storing user profiles (including name, email, and age) in memory. Ensure it supports basic CRUD (Create, Read, Update, Delete) operations for user profiles.", "role": "user" }, { "content": "To design a RESTful API using Flask for managing u...
36
[]
[ { "content": "Create a Python program to count the number of vowels in a given string using a dictionary.", "role": "user" }, { "content": "Certainly! Below is a Python program that counts the number of vowels in a given string using a dictionary. This program is designed to be case-insensitive and ...
37
[]
[ { "content": "Develop a Java method that takes an integer array as input and returns a new array without any duplicates. The order of elements must be preserved.", "role": "user" }, { "content": "To achieve the task of removing duplicates from an array while preserving the order of elements, we can ...
38
[]
[ { "content": "Write a Python function `merge_dicts` that merges two dictionaries by summing up values for keys that appear in both. Assume all values are integers.", "role": "user" }, { "content": "Certainly! Below is a Python function named `merge_dicts` that takes two dictionaries as input and ret...
39
[]
[ { "content": "tests the LLM's ability to manipulate basic data structures (dictionaries) and perform arithmetic operations on their values. It assesses understanding of iteration, key existence checks, and value updates.", "role": "user" }, { "content": "To demonstrate the ability to manipulate basi...
40
[]
[ { "content": "Implement a simple TCP server in Python that listens on localhost and echoes back any message it receives.", "role": "user" }, { "content": "To create a simple TCP echo server in Python, you can use the `socket` library. This server will listen on localhost (127.0.0.1) on a specified p...
41
[]
[ { "content": "Implement a simple encryption algorithm in Python that takes a string and a non-negative integer key as inputs, and outputs a new string where each character in the original string is shifted forward in the alphabet by the key number of positions, wrapping around to the beginning of the alphabet i...
42
[]
[ { "content": "Write a Python function to calculate the nth Fibonacci number using recursion. Ensure to include a base case to prevent infinite recursion.", "role": "user" }, { "content": "Certainly! The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones,...
43
[]
[ { "content": "Write a Python function that generates a Fibonacci sequence up to the nth number using recursion.", "role": "user" }, { "content": "To generate a Fibonacci sequence up to the nth number using recursion in Python, you can define a function that calls itself to calculate each number in t...
44
[]
[ { "content": "Create a simple RESTful API in Flask that accepts JSON data and stores it in a local file.", "role": "user" }, { "content": "To create a simple RESTful API in Flask that accepts JSON data and stores it in a local file, follow these steps. This example assumes you have Flask installed. ...
45
[]
[ { "content": "Design a Python program that takes an input string and outputs a version of the string with vowels removed.", "role": "user" }, { "content": "Certainly! Below is a simple Python program that takes an input string from the user, removes all the vowels from it, and then outputs the modif...
46
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
6