messages listlengths 3 3 |
|---|
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Why is algorithmic complexity important?"
},
{
"role": "assistant",
"content": "Algorithmic complexity is an important measure of how efficient a program is since it tells how much time ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a regex to check if a given string contains any vowels"
},
{
"role": "assistant",
"content": "let regex = /[aeiou]/i;"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a mySQL script to create a table called \"User\" with columns user_id, name, and mobile_number?"
},
{
"role": "assistant",
"content": "CREATE TABLE User (\n user_id int NOT NULL ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Identify the most efficient algorithm to find the maximum element in an array."
},
{
"role": "assistant",
"content": "The most efficient algorithm to find the maximum element in an array... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a random password with 8 characters long including lowercase letters, uppercase letters, and numbers."
},
{
"role": "assistant",
"content": "function generatePassword() {\n let... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Default a neural network architecture to classify the handwritten digit from 0 to 9."
},
{
"role": "assistant",
"content": "# Define the architecture\ndef model(input_shape):\n model ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a function in Python to convert a 2D array into a single column array.\narr = [[0, 1, 2],\n [3, 4, 5],\n [6, 7, 8]]"
},
{
"role": "assistant",
"content": "def convert_to_... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a class called Person with two variables, name and age, and two methods, getName() and setAge()."
},
{
"role": "assistant",
"content": "class Person:\n def __init__(self, name,... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Construct a CSS code that adds a background color of red to the ’div' element."
},
{
"role": "assistant",
"content": "div {\n background-color: red;\n}"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a random string of length 5 with only lowercase alphabetic characters."
},
{
"role": "assistant",
"content": "import string\nimport random\n\ndef generate_random_string(length):... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Propose a fast sorting algorithm for a list of integers"
},
{
"role": "assistant",
"content": "The QuickSort algorithm is a fast sorting algorithm for a list of integers. QuickSort is a ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a SQL statement that joins three tables and returns the fields of interest.\nTable 1 (tbl_person): person_name, person_id\nTable 2 (tbl_course): course_id, course_name\nTable 3 (tbl_enroll): p... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an algorithm in JavaScript to print all the elements inside a given array.\nvar names = [\"Harry\", \"Ron\", \"Hermione\"]"
},
{
"role": "assistant",
"content": "for (var i = 0; i ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Design a data structure for efficiently finding the closest input to a given input in a set of inputs."
},
{
"role": "assistant",
"content": "An efficient data structure for finding the ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Insert a node at the beginning of a linked list.\n[10 -> 15 -> 20 -> 25]"
},
{
"role": "assistant",
"content": "// Java program to insert a node \n// at the beginning of a Singly Linked ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Reformat the following HTML code to make it better readable.\n<div><ul><li>Item 1</li><li>Item 2</li></ul></div>"
},
{
"role": "assistant",
"content": "<div>\n <ul>\n <li>Item 1</li>... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write CSS code to style a web page with a white background and black text."
},
{
"role": "assistant",
"content": "body {\n background-color: white; \n color: black;\n}"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Transform an input string to its uppercase equivalent with JavaScript.\ninputString=\"This sentence should be in uppercase\""
},
{
"role": "assistant",
"content": "let inputString = \"Th... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate an HTML snippet for a basic two-column layout."
},
{
"role": "assistant",
"content": "<div class=\"container\">\n <div class=\"column\">\n <!-- Your left column content --> ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a function that collects elements from two given arrays and creates a new array.\narray1 = [1, 2, 3] \narray2 = [4, 5, 6]"
},
{
"role": "assistant",
"content": "def collect(array1,... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "If a given string contains four consecutive identical characters, write a code to print the string and the count of the consecutive characters.\nString: aaaagood"
},
{
"role": "assistant",
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Using the given information, write a function to calculate a 5-digit ISBN number.\nAuthor name: Bob Smith\nTitle of Book: Learn Programming\nPublisher: Aztec Publishing\nYear Published: 2020"
},
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Output the current date in YYYYMMDD format."
},
{
"role": "assistant",
"content": "let today= new Date();\nlet dd = String(today.getDate()).padStart(2, '0');\nlet mm = String(today.getMo... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create an SQL query that sums all the numbers from the 'number' column in the table 'test_data'?\nTable Name: test_data\nColumns: number"
},
{
"role": "assistant",
"content": "SELECT SUM... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "How many continuous substrings are there in the string \"Geeks\"?"
},
{
"role": "assistant",
"content": "15"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Name an advantage of using linked list over an array."
},
{
"role": "assistant",
"content": "One advantage of a linked list over an array is that it does not require the memory for stori... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Develop a for loop in Javascript to output integers from 0 to 10"
},
{
"role": "assistant",
"content": "for (let i = 0; i < 11; i++) {\n console.log(i);\n}"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given an array of numbers, write a prototype JavaScript function to find the average value of all numbers in the array\n[6, 5, 8, 10]"
},
{
"role": "assistant",
"content": "function find... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Explain the function of a variable in programming."
},
{
"role": "assistant",
"content": "In programming, a variable is a named storage location that can hold a value. Variables are used... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Output the result of 3+5*2-9"
},
{
"role": "assistant",
"content": "3 + 5 * 2 - 9 = 2"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create an object in JavaScript that performs a task given a condition."
},
{
"role": "assistant",
"content": "const myObject = {\n doTask: (condition) => {\n if(condition) {\n /... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a SQL query to print the name and total orders of each customer"
},
{
"role": "assistant",
"content": "SELECT customer_name, COUNT(*)\nFROM orders\nGROUP BY customer_name;"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given a string, develop a function to find out how many words are present in it.\nstring = 'Hello world!'"
},
{
"role": "assistant",
"content": "def countWords(string):\n return len(s... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Complete the following Python program for converting the given list into a dictionary.\nlist1 = ['a', 'b', 'c']\nlist2 = [1, 2, 3]\n\ndef to_dict(list1, list2):\n ???"
},
{
"role": "assis... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a code snippet to display the Fibonacci sequence up to 50 numbers."
},
{
"role": "assistant",
"content": "def Fibonacci(n): \n\ta = 0\n\tb = 1\n\tif n < 0: \n\t\tprint(\"Incorrect ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Compute the modulus of 3 and 4."
},
{
"role": "assistant",
"content": "3"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a code to identify the longest palindrome in a given string\nString: kayakracecar"
},
{
"role": "assistant",
"content": "def get_longest_palindrome(s):\n longest_palindrome = ''... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a JavaScript program to make an AJAX request."
},
{
"role": "assistant",
"content": "const request = new XMLHttpRequest(); \nrequest.open('GET', 'https://example.com/data.json'); \... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a CSS code to center align the given text."
},
{
"role": "assistant",
"content": "p {\n text-align: center;\n}"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a valid Python expression that multiplies the given numbers.\n3 and 4"
},
{
"role": "assistant",
"content": "3 * 4"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create an array of objects in JavaScript that contains five objects, each representing a different programming language."
},
{
"role": "assistant",
"content": "var languages = [\n {la... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Input a two-dimensional array and calculate the sum of each row.\narr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]"
},
{
"role": "assistant",
"content": "def row_sum(arr): \n row_sum = [] \n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a MySQL query to find all records whose name starts with 'A'."
},
{
"role": "assistant",
"content": "SELECT *\nFROM tableName\nWHERE name LIKE 'A%';"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "What is the purpose of declaring an enum in Java?"
},
{
"role": "assistant",
"content": "The purpose of declaring an enum in Java is to clearly identify a set of related constants that c... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a JavaScript function that can convert miles to kilometers."
},
{
"role": "assistant",
"content": "function convertMilesToKilometers(miles) {\n return miles * 1.60934;\n}"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a simple Python program that prints the characters of a string in reverse order.\nString to be printed: \"Hello\""
},
{
"role": "assistant",
"content": "string = \"Hello\" \n\nrev... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a Python script to sort a given list of numbers in ascending order.\n[3, 7, 1, 5, 4]"
},
{
"role": "assistant",
"content": "def sort_numbers_ascending(numbers): \n # Sort the li... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a code to sort a list of floats.\n[4.5, 7.5, 1.5, -2.5]"
},
{
"role": "assistant",
"content": "def sort_floats(arr): \n arr.sort(key=float) \n return arr"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Suggest a machine learning model for predicting stock prices."
},
{
"role": "assistant",
"content": "A possible machine learning model for predicting stock prices is the Long Short-Term ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given a sorted array of size n, create a program to return the kth smallest element."
},
{
"role": "assistant",
"content": "def findKthSmallestElement(arr, n, k): \n \n # To return k... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Change the following code to an ES6 arrow function.\nfunction addTwo(num) \n{ \n var result; \n result = num + 2; \n return result; \n}"
},
{
"role": "assistant",
"content": "co... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "How can we remove duplicate elements from a given array?"
},
{
"role": "assistant",
"content": "We can use a set data structure to remove duplicate elements from a given array. Sets are ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a Java Program to print the Fibonacci numbers for a given range."
},
{
"role": "assistant",
"content": "public class Fibonacci {\n\n public static void main(String[] args) {\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "In the given CSS stylesheet, change all the h1 heading text to purple.\nh1 {\n font-size: 3rem;\n font-weight: bold;\n color: #b0b0b0;\n}"
},
{
"role": "assistant",
"content": "h1 {\n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an SQL query to calculate the sum of all prices of items purchased by customers."
},
{
"role": "assistant",
"content": "SELECT SUM(price) FROM Purchases;"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create an HTML page to display a table of students\nData of students: First name, LastName and Age"
},
{
"role": "assistant",
"content": "<html>\n <head> <title>My Student Table </title... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Purge all rows from the following dataframe that have a negative value in the Age column.\nimport pandas as pd \n\ndata = {'Name': ['Jerry', 'Peter', 'Paul', 'John'], \n'Age': [20, 22, -18, 24]} \n\... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a code for a Javascript program to return the nth Fibonacci number.\n8"
},
{
"role": "assistant",
"content": "// returns the nth Fibonacci number\nfunction nthFibonacciNumber(n) {\... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a function to calculate the sum of the elements of an array with float values."
},
{
"role": "assistant",
"content": "def sum_float_array(float_array):\n total = 0\n for i in... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "What would you change in the following function to sort a list of numbers in increasing order?\nlet arr = [ 4, 2, 5, 1, 3 ]\n\nfunction bubbleSort(arr) {\n for (let i = 0; i < arr.length; i++) {\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a dynamic HTML table displaying 10 random numbers from 1 to 100."
},
{
"role": "assistant",
"content": "<html>\n <head>\n </head>\n <body>\n <div>\n <tabl... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Find a way to get the size of a linked list without traversing it.\nhead: 1 -> 2 -> 3 -> 4 -> 5 -> null"
},
{
"role": "assistant",
"content": "def get_list_size(head):\n count = 0\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "For the following list, print out the second element.\nlist = [\"apple\", \"banana\", \"cherry\"]"
},
{
"role": "assistant",
"content": "second_element = list[1]\nprint(second_element) #... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Develop a Chatbot that can respond to the user's queries about programming languages."
},
{
"role": "assistant",
"content": "def chatbot():\n while True: \n # User's query \n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a function in Python for sorting a given list of numbers.\n[29, 11, 46, 7, 248, 1724]"
},
{
"role": "assistant",
"content": "def sort_list(numbers):\n return sorted(numbers)"
}
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a list that has the all even numbers between 1 and 50, inclusive."
},
{
"role": "assistant",
"content": "even_nums_list = [x for x in range(1,51) if x % 2 == 0]"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a Python program to replace all instances of a specific character in a string.\nstring = \"Hello World!\"\ncharacter = \"o\"\nreplacement_character = \"_\""
},
{
"role": "assistant",
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Suggest a way to create a linked list in python."
},
{
"role": "assistant",
"content": "class Node:\n def __init__(self, data):\n self.data = data\n self.next = None\n\n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a function to count how many vowels are in a given string."
},
{
"role": "assistant",
"content": "def count_vowels(string):\n vowels = \"aeiou\"\n count = 0\n \n for char in s... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "You need to reverse the following array using JavaScript.\n[1,3,5,7]"
},
{
"role": "assistant",
"content": "function reverseArray(arr) {\n let revArray = [];\n for (let i = arr.len... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a Node.js function to validate an email with a given regex."
},
{
"role": "assistant",
"content": "function validateEmail(email) {\n var re = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a function to print out the Fibonacci numbers starting from 0 to the nth number.\nn = 7"
},
{
"role": "assistant",
"content": "def print_fibonacci(n):\n a = 0\n b = 1\n f... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Using an object-oriented programming language, create a class that has two methods - one to calculate the area of a circle and another to calculate the circumference."
},
{
"role": "assistan... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a PHP script to print the current week number"
},
{
"role": "assistant",
"content": "<?php \n echo 'Current week number: ' . date('W');\n?>"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a SQL query to get the names and ages of all the users with an age greater than 25."
},
{
"role": "assistant",
"content": "SELECT name, age\nFROM users\nWHERE age > 25;"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create an SQL table with three columns called id (int type), name (text type), and age (int type)."
},
{
"role": "assistant",
"content": "CREATE TABLE people (\n id INT PRIMARY KEY, \... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Design a MySQL Table to store company employees."
},
{
"role": "assistant",
"content": "CREATE TABLE `employee` (\n `employee_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n `name` ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "We want to display a random number between 1 and 10 using Python. Write a program for that."
},
{
"role": "assistant",
"content": "import random\nrandomNumber = random.randint(1, 10)\npr... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Design an algorithm that determines the greatest common multiple of two numbers."
},
{
"role": "assistant",
"content": "def gcm(x, y): \n if(x > y): \n gcm = x \n else: \n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a program to print out all prime numbers below 100."
},
{
"role": "assistant",
"content": "# Function to print prime numbers \ndef prime_numbers_below_100(): \n for num in rang... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Implement a queue data structure."
},
{
"role": "assistant",
"content": "class Queue:\n def __init__(self):\n self.data = []\n\n def is_empty(self):\n return not self... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Retrieve the 5th element from a list named 'numbers'.\nnumbers = [1, 2, 3, 4, 5, 6, 7, 8]"
},
{
"role": "assistant",
"content": "5"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a function which takes a number and returns the Fibonacci sequence up to that number.\nn = 10"
},
{
"role": "assistant",
"content": "def fibonacci(n):\n fib_list = [1]\n if n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Construct an array in JavaScript containing five elements."
},
{
"role": "assistant",
"content": "my_array = [1,2,3,4,5]"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an SQL query to get the number of customers per country\nTable Name: Customers\nColumns: Name, Country"
},
{
"role": "assistant",
"content": "SELECT Country, COUNT(*) AS NumberOfCu... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an SQL query to return the most frequently used keyword from the table.\nTable Name: \"Keywords\"\nColumn Name: \"keyword\""
},
{
"role": "assistant",
"content": "SELECT keyword, C... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Can you code a solution to Bubble Sort an array of integers?\n[5, 4, 3, 2, 1]"
},
{
"role": "assistant",
"content": "def bubbleSort(arr): \n n = len(arr)\n \n # Traverse through a... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Develop a SQL query to find all the records that have modified within a given time range."
},
{
"role": "assistant",
"content": "SELECT * \nFROM Table \nWHERE ModifiedTime BETWEEN '<star... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write JavaScript code to add the following data to the web page.\n[\n { name: \"John\", age: 25 },\n { name: \"Rob\", age: 27 },\n { name: \"Mia\", age: 22 }\n]"
},
{
"r... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given a sorted list of integers, write a Python function to search for a specific target element."
},
{
"role": "assistant",
"content": "def binary_search(list, target):\n low = 0\n high... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Fix the bug in the following code that causes the output to be incorrect.\ndef calculate_sum(numbers):\n total = 0\n for num in numbers:\n total += num\n return total\n\nnumbers = [2... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write code that removes spaces from a given string.\nstring = \" A B C D \""
},
{
"role": "assistant",
"content": "def remove_spaces(string): \n return \"\".join(string.split())"
}
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an R script that performs linear regression to predict a response variable."
},
{
"role": "assistant",
"content": "# load the data\ndata <- read.csv(\"data.csv\")\n\n# fit the mode... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a `PHP` script to sort an associative array based on its values.\n$data = array(\"John\"=>45, \"Bob\"=>67, \"Ann\"=>55);"
},
{
"role": "assistant",
"content": "function sortByValue... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an SQL script to list all items with a price greater than 10$.\nTable Name = Item"
},
{
"role": "assistant",
"content": "SELECT * FROM Item WHERE price > 10;"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a function to filter a list of strings based on a search term"
},
{
"role": "assistant",
"content": "def filter_by_search_term(strings, search_term):\n return [string for string... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Estimate the value of pi to four decimal places."
},
{
"role": "assistant",
"content": "The estimated value of pi is 3.1416."
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Construct a boolean check to detect if a given string contains the word \"hello\"."
},
{
"role": "assistant",
"content": "def contains_hello(input_string):\n return \"hello\" in input... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an SQL query to return the top three highest-scoring players from a table 'scores'."
},
{
"role": "assistant",
"content": "SELECT player_name\nFROM scores\nORDER BY score DESC\nLIM... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Compare and contrast HTTP and HTTPS."
},
{
"role": "assistant",
"content": "HTTP (Hypertext Transfer Protocol) and HTTPS (Hypertext Transfer Protocol Secure) are both protocols used to t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.