messages listlengths 3 3 |
|---|
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Compute the edits between two strings.\nstr1 = \"I am eating\"\nstr2 = \"I am eating a sandwich\""
},
{
"role": "assistant",
"content": "def edit_distance(str1, str2):\n \"\"\"\n C... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create an HTML page that has an input field and a button. When the button is clicked, the text from the input field should be printed to the console."
},
{
"role": "assistant",
"content"... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a Python script to print the following output."
},
{
"role": "assistant",
"content": "for x in range(10):\n for y in range(10):\n print(\"*\" if (x + y) % 2 == 0 else \"... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Modify the existing code to enable user input so the user can enter their own number and have the average of those two numbers returned.\ndef find_average(a, b):\n return (a + b) / 2"
},
{
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Using an existing loop, create code to calculate the sum of all odd numbers up to a given number."
},
{
"role": "assistant",
"content": "def sum_odd_numbers(num):\n result = 0\n fo... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a function in JavaScript to reorder the given list in ascending order.\n[3, 1, 2]"
},
{
"role": "assistant",
"content": "function sortAscending(list) {\n list.sort(function (a, ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a function that returns the sum of all elements in a given array of numbers."
},
{
"role": "assistant",
"content": "def array_sum(arr):\n sum = 0\n for num in arr:\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create an PHP script to display the current date and day."
},
{
"role": "assistant",
"content": "<?php\n echo date(\"l, F jS\")\n ?>"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Modify the following code to print all words with more than 5 characters in a given string.\ntext = \"This is an example string\""
},
{
"role": "assistant",
"content": "text = \"This is ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Compile the given C++ code.\n#include <iostream> \nusing namespace std; \nint main()\n{ \n cout << \"Hello World!\"; \n return 0; \n}"
},
{
"role": "assistant",
"content": "g++ file.cp... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a function that takes two integers, A and B, and returns the largest common divisor between A and B."
},
{
"role": "assistant",
"content": "def get_largest_common_divisor(a, b):\n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Draft an HTML page with a table that contains three columns and two rows."
},
{
"role": "assistant",
"content": "<html>\n <head>\n <title>Table Example</title>\n </head>\n <body>\n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Suggest a suitable algorithm for solving this problem.\nAn array of integers is given. Find the highest sum that can be obtained by including different members from the array, such that no two membe... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a dictionary where the keys are the integers up to 10, and the values are the cubes of those same integers."
},
{
"role": "assistant",
"content": "def create_dict():\n cube_dic... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a function to iterate a list of strings and print them."
},
{
"role": "assistant",
"content": "def iterate_strings(string_list):\n for string in string_list:\n print(str... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create an object in JavaScript named 'user' with the following attributes: name, age, and gender."
},
{
"role": "assistant",
"content": "let user = {\n name: \"\",\n age: 0,\n g... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given a list of numbers, find the minimum and maximum elements.\n[3, 4, 8, 1, 5, 0, 9]"
},
{
"role": "assistant",
"content": "min_el = 0\nmax_el = 9"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Evaluate the given algebraic expression by substituting 4 for x.\nexpression = 2x + 6"
},
{
"role": "assistant",
"content": "expression = 2 * 4 + 6 = 14"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Suggest a code segment to generate a random integer in the range of 0 to 100 using Python."
},
{
"role": "assistant",
"content": "import random\n\nrandom_int = random.randint(0, 100)"
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a Python code for printing the following pattern."
},
{
"role": "assistant",
"content": "# Pattern \nfor i in range(1,6):\n for j in range(1,i+1):\n print(i,end=\"\")\n print(\"\... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Suggest an efficient way to find the longest word in a string."
},
{
"role": "assistant",
"content": "The most efficient way to find the longest word in a string is to use the split() me... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a function called check_restaurant_availability that returns True if a restaurant is open and False if it's closed.\nrestaurant_status = {\n \"monday\": \"closed\",\n \"tuesday\": \"ope... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a Migration Script in Node.js for creating a table for customers.\ncustomer_id, first_name, last_name, email"
},
{
"role": "assistant",
"content": "const { Client } = require('pg'... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Can you retrieve the item at index 3 from the following array?\nint[] arr = {11, 30, 45, 19, 20, 60};"
},
{
"role": "assistant",
"content": "int itemAtIndex3 = arr[3];\n// itemAtIndex3 i... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a valid regular expression to catch URLs in strings."
},
{
"role": "assistant",
"content": "r\"(https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|w... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a Python program to calculate the median of three given numbers."
},
{
"role": "assistant",
"content": "def median_num(n1, n2, n3):\n if n1 > n2 and n2 > n3:\n return n2\... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an HTML code to display a table of 3 columns and 5 rows."
},
{
"role": "assistant",
"content": "<table>\n <tr>\n <th>Column1</th>\n <th>Column2</th>\n <th>Column3</th>\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given the following code in C, modify it to increment `num` by 1.\nint num = 0;"
},
{
"role": "assistant",
"content": "int num = 0;\nnum++;"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a linked list from the given array of numbers.\n[2, 4, 5, 6, 7]"
},
{
"role": "assistant",
"content": "Head -> 2 -> 4 -> 5 -> 6 -> 7 -> None"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a HTML code to show a green square with a width of 100px and a height of 100px."
},
{
"role": "assistant",
"content": "<div style=\"width:100px; height:100px; background-color:gre... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given a string, write the appropriate regex pattern that checks if the string contains any digit."
},
{
"role": "assistant",
"content": "import re\n\ndef check_digits(string):\n \"\"\"\... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Construct a SQL query to list the unique countries from table countries."
},
{
"role": "assistant",
"content": "SELECT DISTINCT country\nFROM countries;"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Suggest an alternative for the following code snippet which is faster and less memory intensive.\narr = [2, 3, 5, 7]\nresult = []\nfor i in range(len(arr)):\n for j in range(i + 1, len(arr)):\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a code to wrap a text in a box, with the given length and padding parameters.\ntext = \"Hello World!\", length = 20, padding = 5"
},
{
"role": "assistant",
"content": "def wrap_in_... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given a string, what is the best way to reverse the characters in it?\n<noinput>>"
},
{
"role": "assistant",
"content": "\"\"\"\nThe best way to reverse the characters in a string is by ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a function that takes three parameters and adds them together.\nNo input."
},
{
"role": "assistant",
"content": "def my_func(a, b, c):\n return a + b + c"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a class in Python with the attributes name and age."
},
{
"role": "assistant",
"content": "class Person:\n def __init__(self, name, age):\n self.name = name\n sel... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a HTML code to make a hyperlink of \"https://www.example.com\" that shows the text \"Click Here\"."
},
{
"role": "assistant",
"content": "<a href=\"https://www.example.com\">Click... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a Python script to validate the following input\nValidate a Date type field with the following format: YYYY/MM/DD"
},
{
"role": "assistant",
"content": "# Import the required datet... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given an array containing words and a string, find the shortest word in the array that is a substring of the string\nwords = [\"apple\", \"banana\", \"cat\", \"dog\"], string = \"aquickbrownfoxjumps... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Construct a HTML table with four columns."
},
{
"role": "assistant",
"content": "<table>\n <tr>\n <th>Column 1</th>\n <th>Column 2</th>\n <th>Column 3</th>\n <th>Column 4</t... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Convert this program from procedural to object-oriented.\ndef calculate_mortgage(principle, years, rate):\n # calculation\n return monthly_payment\n\ndef calculate_interest_rate(value):\n #... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "What's the output of this program in Python given the following input?\ninput_string = \"Hello, World!\" \nlist_of_chars = list(input_string)\n\nfor current_char in list_of_chars:\n print(current_... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Produce a SELECT query in PostgreSQL to search for all existing entries with a specified ID.\nProperty ID: 15"
},
{
"role": "assistant",
"content": "SELECT * FROM TableName WHERE Propert... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Combine the two strings into one and save it as a variable called full_name.\nfirst_name = 'John'\nlast_name = 'Smith'"
},
{
"role": "assistant",
"content": "first_name = 'John'\nlast_na... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an angular directive to highlight the selected word in a text."
},
{
"role": "assistant",
"content": "myApp.directive('highlight', function() {\n return {\n restrict: 'A',\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Refactor this function to be less complex and more readable.\ndef calculate_price(products):\n total_price=0\n for p in products:\n total_price+=p[0]*p[1]\n return total_price"
},
{
"r... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a loop to print the numbers from 10 to 1 in reverse order."
},
{
"role": "assistant",
"content": "for i in range(10, 0, -1):\n print(i)"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Split the following sentence into tokens.\nSentence: I cannot wait to go to the movies."
},
{
"role": "assistant",
"content": "['I', 'can', 'not', 'wait', 'to', 'go', 'to', 'the', 'movie... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a code to find the day of the week corresponding to a given date using the calendar module?\nDay: 25\nMonth: December\nYear: 2020"
},
{
"role": "assistant",
"content": "\"\"\"\nFin... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given a two dimensional array, write a Python program to print the second diagonal of the array.\nmy_array = [[1, 2, 3],\n [4, 5, 6],\n [7, 8, 9]]"
},
{
"role": "assi... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a regular expression to match strings containing two consecutive symbols \"#\" followed by four alphabetic characters."
},
{
"role": "assistant",
"content": "/\\#[a-zA-Z]{4}/"
}... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a Python code to generate Fibonacci sequence up to 'n' numbers, where 'n' is a given integer."
},
{
"role": "assistant",
"content": "def generateFib(n): \n fib = [0, 1] \n wh... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given a string, write a code that counts the number of alphabets in it.\ninput_string = \"Hello World!\""
},
{
"role": "assistant",
"content": "input_string = \"Hello World!\"\n\n# Count... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a SQL query to calculate the total cost of a given product.\nproduct_id: 123\nprice: 100.50\nquantity: 10"
},
{
"role": "assistant",
"content": "SELECT SUM(price * quantity) AS tot... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Print all the permutations of a given list\n[1, 2, 3]"
},
{
"role": "assistant",
"content": "def permute(lis):\n if len(lis) == 0:\n return [] \n if len(lis) == 1:\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Build a TensorFlow model for classification of a 2-D dataset.\nX = [[1, 2], [3, 4], [5, 6]]\nY = [0, 1, 1]"
},
{
"role": "assistant",
"content": "\"\"\"\nBuild a TensorFlow model for cla... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a HTML select element with the given list of countries as options.\nCountryList = ['India','United States','Canada','Australia','New Zealand','Singapore','Japan']"
},
{
"role": "assis... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a while loop that prints the numbers 1-10"
},
{
"role": "assistant",
"content": "i = 1\nwhile i <= 10:\n print(i)\n i += 1"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "What is the SQL query to select all the values that are greater than 10 in the \"Age\" column in the table \"Students\"?"
},
{
"role": "assistant",
"content": "SELECT * FROM Students WHE... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Select the appropriate language to implement a linked list data structure."
},
{
"role": "assistant",
"content": "C++ is the best language to implement a linked list data structure as it... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Using HTML and CSS, create a page layout with two columns and a header row."
},
{
"role": "assistant",
"content": "<html>\n <head>\n <style>\n .table { \n display: table... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Calculate the result of XORing two binary numbers.\n1010, 0101"
},
{
"role": "assistant",
"content": "The result of XORing 1010 and 0101 is 1111."
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Develop a C++ code to print the numbers 1 to 10 in descending order."
},
{
"role": "assistant",
"content": "for(int i=10; i>0; i--) \n cout << i << \" \";"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given two arrays of integers, find the common elements.\narr1 = [1, 2, 3, 4, 5]; arr2 = [4, 5, 6, 7, 8]"
},
{
"role": "assistant",
"content": "def common_elements(arr1, arr2):\n commo... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "You need to code a program that prints the absolute difference between two numbers.\n15 and 10"
},
{
"role": "assistant",
"content": "def difference(num1, num2):\n return abs(num1 - n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an R function that determines the average value of an integer array."
},
{
"role": "assistant",
"content": "average <- function(numbers) {\n sum <- 0\n for (i in numbers) {\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a code to reverse a sentence word by word.\nThis is a sentence"
},
{
"role": "assistant",
"content": "def reverse_words(sentence):\n words = sentence.split(' ')\n reversed_wo... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Using the data provided, create a SQL command to get the total number of orders from customers in the USA.\nTable name: \"Orders\"\nColumns: \"Cust_ID\", \"Cust_Country\", \"Order_ID\""
},
{
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a function to filter a given list such that all any string starting with an 'S' is removed from the list.\n['Swallow', 'Duck', 'Finch', 'Parrot']"
},
{
"role": "assistant",
"conten... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an HTML page to calculate the area of a circle given its radius."
},
{
"role": "assistant",
"content": "<!DOCTYPE html>\n<html>\n <head>\n <title>Area of Circle</title>\n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a MySQL table with three columns containing values from a given list.\nList: \nTom, 14, 80\nMary, 27, 96\nJohn, 8, 75"
},
{
"role": "assistant",
"content": "CREATE TABLE my_table ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given two numbers, find their LCM.\na = 15\nb = 10"
},
{
"role": "assistant",
"content": "30"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a loop to find the largest sub-array in a given array with contiguous elements and its sum.\nArray: [-2, 6, -3, 5, -2, 3, 4, -2]"
},
{
"role": "assistant",
"content": "\"\"\"\nG... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a class called 'Animal' that stores the attributes age and type."
},
{
"role": "assistant",
"content": "class Animal:\n def __init__(self, age, type):\n self.age = age\n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an AppleScript to open a given link in Safari.\nhttps://www.google.com"
},
{
"role": "assistant",
"content": "tell application \"Safari\" \n open location \"https://www.google.com... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Design a Bubble Sort algorithm for a list of numbers."
},
{
"role": "assistant",
"content": "def bubbleSort(arr):\n n = len(arr)\n for i in range(n):\n for j in range(0, n-i... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Find all instances of the given symbol in the text.\ntext = \"The company has a $1 billion budget\"\nsymbol = \"$\""
},
{
"role": "assistant",
"content": "The symbol \"$\" occurs 1 time ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given a string and an integer, write a program to compare the string with the integer and return the longer string.\nmy_string = \"Hello\"\nmy_int = 1"
},
{
"role": "assistant",
"content... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Convert the given code by replacing for loop with a while loop.\nfor i in range(5):\n print(i)"
},
{
"role": "assistant",
"content": "i = 0\nwhile i < 5:\n print(i)\n i += 1"
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Find the position of the substring \"is\" in the string.\nstring = \"This is an example\""
},
{
"role": "assistant",
"content": "string = \"This is an example\"\nprint(string.find(\"is\"... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a JavaScript code to print the characters of a string one by one in an alert message.\nstr = \"Hello World!\""
},
{
"role": "assistant",
"content": "for (let i = 0; i < str.length;... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Describe how to add an element in a linked list in Python."
},
{
"role": "assistant",
"content": "// To add an element in a linked list in Python:\n// 1. Create a new node containing the... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Find the maximum value from a Python dictionary.\nsample_dict = {'a': 10, 'b': 20, 'c': 40, 'd': 30}"
},
{
"role": "assistant",
"content": "def find_max(sample_dict):\n max_val = 0\n f... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Find the area of a triangle using the Heron's formula\nlengths = [3, 4, 5]"
},
{
"role": "assistant",
"content": "def herons_formula(lengths):\n a, b, c = lengths[0], lengths[1], leng... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Calculate the mean, median and mode for the given set of numbers.\n130, 160, 140, 160, 160"
},
{
"role": "assistant",
"content": "The mean is: 149.4\nThe median is: 160\nThe mode is: 160... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Suggest a method in Java to compare two strings."
},
{
"role": "assistant",
"content": "The easiest way to compare two strings in Java is to use the built-in String class's equals() meth... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Construct a switch statement to log different grades messages based on the grade variable.\nvar grade = \"A+\";"
},
{
"role": "assistant",
"content": "switch(grade){\n case \"A+\":\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a method called `combineName` that takes in two strings and combines them together into a full name.\nfirstName = 'John'\nlastName = 'Smith'"
},
{
"role": "assistant",
"content": ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a function in the Python language to convert a string to a list.\nmy_string = \"Welcome to the world of GPT models\""
},
{
"role": "assistant",
"content": "def string_to_list(my_st... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a function that takes an array of integers and rearranges the elements in a cyclical fashion, such that the element at index 0 comes last, the element at index 1 goes to the front, the elem... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a list of the top 3 highest valued elements in the following array.\narr = [7, 5, 8, 4, 9, 6, 1, 3, 2]"
},
{
"role": "assistant",
"content": "arr = [7, 5, 8, 4, 9, 6, 1, 3, 2]\n\n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a SQL query that lists all entries from a table that have a given parameter in the distinct column.\nTable: employee\nParameter: name"
},
{
"role": "assistant",
"content": "SELECT... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Compare two strings and return \"bigger\", \"smaller\" or \"equal\" depending on the lexicographical order.\nstring1 = \"zebra\"\nstring2 = \"zeal\""
},
{
"role": "assistant",
"content":... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Explain why it is important to have exception handling"
},
{
"role": "assistant",
"content": "Exception handling is important for a program as it allows the program to gracefully handle ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Use classes and objects to create an employee class with attributes such as name, age, salary, and role."
},
{
"role": "assistant",
"content": "class Employee:\n def __init__(self, na... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a SQL query to retrieve the names and birthdates of all employees in a table called \"employees\"."
},
{
"role": "assistant",
"content": "SELECT name, birthdate FROM employees;"
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "In Java, what is a good way to make a deep copy of an object?"
},
{
"role": "assistant",
"content": "A deep copy of an object can be obtained by using the Object.clone() method or by ser... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a list containing the squares of numbers from 0 to 10."
},
{
"role": "assistant",
"content": "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100]"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a function in Python to convert a given decimal number into its binary form."
},
{
"role": "assistant",
"content": "def decimal_to_binary(num):\n binary = []\n\n while num > ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.