messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write an SQL query for finding all books with the title “The Great Gatsby”." }, { "role": "assistant", "content": "SELECT * \nFROM BOOKS\nWHERE Title = 'The Great Gatsby'" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a CSS rule to set the text size of all elements with the class “big-header” to 24px." }, { "role": "assistant", "content": ".big-header {\n font-size: 24px;\n}" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a SQL statement to get all records from a table which has id between 5 and 10." }, { "role": "assistant", "content": "SELECT * FROM table_name WHERE id BETWEEN 5 AND 10;" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Design a class in C# to store employee details." }, { "role": "assistant", "content": "public class Employee\n{\n public string Name;\n public int Age;\n public string Departmen...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a MySQL query for finding customers who paid more than $100.\npayment" }, { "role": "assistant", "content": "SELECT customer.*\nFROM customer JOIN payment\nON customer.ID = paymen...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Use regex to match a substring, 'the' within a sentence.\nThe quick brown fox" }, { "role": "assistant", "content": "regex = /the/\n\nThis regex will match the substring \"the\" in the s...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Given a list of strings, create a function that returns a list of only the unique strings.\n[\"this\", \"is\", \"a\", \"list\", \"of\", \"strings\", \"this\", \"list\", \"has\", \"some\", \"duplica...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Name the grammar that is used to identify data in a Javascript string." }, { "role": "assistant", "content": "The grammar used to identify data in a JavaScript string is JSON (JavaScript...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "What kind of data structure is most suitable for storing a dictionary?" }, { "role": "assistant", "content": "In most cases, a hash table is the most suitable data structure for storing ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a MySQL query to return the employee details from the \"employees\" table with the minimum salary.\nTable Name: Employees\nColumns: Emp_ID, First_Name, Last_Name, Job_Position, Salary" }, ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a regex pattern to extract all words containing the letter 'a' from a given string" }, { "role": "assistant", "content": "import re\n\ndef extract_words(string):\n pattern = r'\...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Calculate the maximum of three numbers in Java.\nint a = 10; \nint b = 15;\nint c = 20;" }, { "role": "assistant", "content": "int max = Math.max(a, Math.max(b, c));\nSystem.out.println(...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a GUI application in C# that displays a welcome message when the program is launched." }, { "role": "assistant", "content": "using System.Windows.Forms;\n \n public static class P...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Generate a random 8 digit string composed of numbers and letters in Python 3." }, { "role": "assistant", "content": "import string\nimport random\n \n#Generate 8 character random string\...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Implement a web scraper in Python to extract all headlines from a web page." }, { "role": "assistant", "content": "import requests\nfrom bs4 import BeautifulSoup\n\nurl = 'https://exampl...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write an HTML page with a form which takes the input of an email address and a password and sends an email to the given address." }, { "role": "assistant", "content": "<html>\n <head>\n...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Construct a regular expression to extract all words from a given string that start with a specific letter.\ninput_str = \"The quick brown fox jumped over the lazy dog\"" }, { "role": "assist...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Implement a basic calculator that can compute simple math expressions.\n9 * 2" }, { "role": "assistant", "content": "def calculate(expr):\n return eval(expr)" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Construct a program to print the Pyramid pattern using asterisks." }, { "role": "assistant", "content": "\"\"\"\nConstruct a program to print the Pyramid pattern using asterisks\n\"\"\"\...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Modify the following code segment to add multiple values in an array\nvar myArray = [];\nmyArray[0] = 'x';" }, { "role": "assistant", "content": "var myArray = [];\nmyArray.push('x', 'y...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a web page using HTML, CSS, and JavaScript that displays the following text: \"Welcome to my website!\"." }, { "role": "assistant", "content": "<!doctype html>\n<html>\n <head>\n ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a method to generate a random integer between 1 and 10 in Python." }, { "role": "assistant", "content": "import random\n\ndef random_int():\n return random.randint(1, 10)" } ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a JavaScript program to replace all the vowels in a given string with '*'." }, { "role": "assistant", "content": "function replaceVowels(str) {\n return str.replace(/[aeiou]/gi, '...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a procedure to subtract two numbers in MySQL." }, { "role": "assistant", "content": "CREATE PROCEDURE subtract_numbers ( IN num_1 INT, IN num_2 INT ) \nBEGIN \nSET num_1 = num_1 - ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Make a class in Python which will represent a binary search tree." }, { "role": "assistant", "content": "class BinarySearchTree:\n \n def __init__(self, value): \n self.left = ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Given two lists, create a function that finds the common elements between the two lists.\nlist1 = [1, 2, 3, 4, 5]\nlist2 = [2, 3, 4, 6, 7]" }, { "role": "assistant", "content": "def find...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create an HTML page that displays two columns consisting of the numbers 1 to 10." }, { "role": "assistant", "content": "<!DOCTYPE html>\n<html>\n <head>\n <title>Two columns of numbe...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a JavaScript program to calculate the sum of each individual index value from two given arrays of equal length.\nlet array1 = [1, 0, 2, 3, 4];\nlet array2 = [3, 5, 2, 1, 4];" }, { "rol...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Using Python, find the number of unique characters in the string \"hello world\"." }, { "role": "assistant", "content": "len(set(\"hello world\")) # 10 unique characters" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a PHP script to store data in a MySQL database." }, { "role": "assistant", "content": "<?php \n \n $db_host = \"localhost\"; \n $db_user = \"username\"; \n $db_pass = \"p...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Calculate the total sum of a given list using an accumulator pattern.\nnumbers = [2, 3, 4]" }, { "role": "assistant", "content": "numbers = [2, 3, 4]\ntotal_sum = 0\n\n# iterate through ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a Python function to compare two lists and return the elements that are in both of them.\nlist1 = [3, 5, 7, 8]\nlist2 = [3, 5, 10, 12]" }, { "role": "assistant", "content": "def co...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "How to reverse a list in C++?" }, { "role": "assistant", "content": "You can reverse a list in C++ using the std::reverse algorithm. To reverse the list, pass the list as the first param...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a function in Python that takes a sentence as an argument and returns the formatted sentence with the first letter of each word capitalized.\nsentence = \"this is a sentence\"" }, { "...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a JavaScript code to pop up a window that says \"Hello, World!\" when you open up the webpage." }, { "role": "assistant", "content": "<script>\nwindow.onload = function(){\n alert(...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a 3x3 rotation matrix with an angle of 45 degrees." }, { "role": "assistant", "content": "[[0.7071, -0.7071, 0.0],\n [0.7071, 0.7071, 0.0],\n [0.0, 0.0, 1.0]]" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a SQL query that returns all the distinct values in a given table.\ntable: Employees" }, { "role": "assistant", "content": "SELECT DISTINCT * \nFROM Employees;" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Generate an array of random integers between 1 and 50 inclusive." }, { "role": "assistant", "content": "let randomIntegersArray = [];\nfor (let i = 0; i < 50; i++) {\n randomIntegersA...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a lambda expression to find the maximum value of two numbers." }, { "role": "assistant", "content": "maximum = lambda num1, num2: num1 if num1 > num2 else num2" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Transform the below SQL query into MongoDB.\nSELECT user_id, COUNT(*) FROM orders\nWHERE status = 'completed'\nGROUP BY user_id\nORDER BY COUNT(*) DESC;" }, { "role": "assistant", "conte...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Edit the given SQL statement to select the top 3 entries with lowest price.\nSELECT * FROM products" }, { "role": "assistant", "content": "SELECT * FROM products ORDER BY price ASC LIMIT...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a function to search for a given element in a list and output its index.\nlist_numbers = [1, 2, 3, 4, 5]" }, { "role": "assistant", "content": "def search_list(list_numbers, eleme...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a function to generate a random string with the given length.\nLength = 8" }, { "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": "Given two strings s1 and s2, find the number of times the characters in s2 are present in s1.\ns1 = \"Hello World\", s2 = \"o\"" }, { "role": "assistant", "content": "s1 = \"Hello World\...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a SQL query to find all teachers with more than 10 years of experience." }, { "role": "assistant", "content": "SELECT * \nFROM teachers \nWHERE years_of_experience > 10;" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a NodeJS server that listens on port 8080 and serves a simple HTML page." }, { "role": "assistant", "content": "const http = require('http');\nconst port = 8080;\n\nconst server =...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a for loop that iterates from 10 to 20 by 4's." }, { "role": "assistant", "content": "for i in range(10, 21, 4):\n print(i)" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Using HTML and CSS, design a landing page for a blog website." }, { "role": "assistant", "content": "<!DOCTYPE html>\n<html>\n<head>\n <title>My Blog</title>\n <style>\n .container{\n...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a SQL query that finds the average of a given table's \"Salary\" column." }, { "role": "assistant", "content": "SELECT AVG(Salary) FROM Employees;" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Select all the records in the given table where the ID is greater than 5.\nTable\nID | Name | Address\n1 | John | UK\n2 | Jack | US\n5 | Mary | UK\n11 | Chris | Canada" }, { "role": "assista...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create an HTML layout for a website. Make sure the layout has a header, a navigation menu, and a footer." }, { "role": "assistant", "content": "<!DOCTYPE html> \n<html> \n <head> \n ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Convert this regular expression to JavaScript regex expression.\n/[A-Z][a-z]+/" }, { "role": "assistant", "content": "/[A-Z][a-z]+/g" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a procedure in PL/SQL to find the sum of numbers from 1 to 10." }, { "role": "assistant", "content": "create or replace procedure addNums(sum OUT NUMBER)\nbegin\n sum := 0;\n for...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a python program to return a new list with each item multiplied by 2 in an existing list.\n[1, 2, 3, 4, 5]" }, { "role": "assistant", "content": "def mult_by_two(nums):\n \"\"\...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write an SQL query to select all rows from a table where a given column value is higher than 10.\nTable: users" }, { "role": "assistant", "content": "SELECT *\nFROM users\nWHERE column_n...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a Java program to take in 3 strings and combine them into one.\nstring1 = \"hello\"\nstring2 = \"world\"\nstring3 = \"!\"" }, { "role": "assistant", "content": "public class Combin...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a function that prints Fibonacci numbers up to N (N>1)." }, { "role": "assistant", "content": "def Fibonacci(n): \n a = 0\n b = 1\n if n < 0: \n print(\"Incorrect i...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Given a positive integer number, generate the Fibonacci series." }, { "role": "assistant", "content": "def Fibonacci(n): \n if n<0: \n print(\"Incorrect input\") \n # First ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Parse the sentence and find the sentence structure.\nSentence: I arrived at the destination late in the evening." }, { "role": "assistant", "content": "Subject: I \nVerb: arrived\nPrepos...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a SQL table which has 3 columns id, name and price." }, { "role": "assistant", "content": "CREATE TABLE products (\n id INTEGER AUTO_INCREMENT PRIMARY KEY,\n name VARCHAR(255) N...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Generate a 5-element tuple of random numbers between 5 and 15 using Python." }, { "role": "assistant", "content": "import random\n\nrandom_tuple = tuple(random.randint(5, 15) for _ in ra...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write Python code to print the most frequent characters in a given string.\nString: I love apples" }, { "role": "assistant", "content": "def most_frequent_char(s):\n count = [0] * 256...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Suggest a way to debug these lines of code.\n// code\nint i = 0;\nwhile (i<10)\n{\n\ti++;\n\tSystem.out.println(\"Something is wrong!\");\n}" }, { "role": "assistant", "content": "One wa...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Implement a priority queue." }, { "role": "assistant", "content": "class PriorityQueue(): \n \n def __init__(self): \n self.elements = [] \n \n def is_empty(self): \n ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Modify the code to convert any temperature from Celsius to Fahrenheit\ndef CtoF(x):\n #TODO" }, { "role": "assistant", "content": "def CtoF(x):\n F = (9/5 * x) + 32\n return F" ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Construct a regex expression that will check if a email is valid." }, { "role": "assistant", "content": "^[A-Za-z0-9\\.\\'\\+\\-\\_]+(\\@)[A-Za-z0-9.-]+([\\.][a-zA-Z]{2,4})+$" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a code to construct a new array with the elements reversed.\narr = [1, 2, 3, 4, 5]" }, { "role": "assistant", "content": "def reverse_array(arr):\n \"\"\"\n Construct a new a...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a code to parse the following JSON into a dictionary\n{\n \"firstName\": \"John\",\n \"lastName\": \"Smith\",\n \"age\": 25\n}" }, { "role": "assistant", "content": "import json...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Generate a random string of 10 characters with two vowels, three consonants and five digits." }, { "role": "assistant", "content": "import random\n\ndef generate_string(vowels,consonants...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Using HTML and CSS, create an input form with fields for name and address" }, { "role": "assistant", "content": "<form>\n <label>Name:</label><br>\n <input type=\"text\" name=\"name\">...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Construct a for loop to print the integer from 0 to 50." }, { "role": "assistant", "content": "for i in range(51):\n print(i)" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Refactor the following condition to use the ternary operator instead of an if-else statement.\nif (x < 0) {\n y = -1;\n} else {\n y = 1;\n}" }, { "role": "assistant", "content": "y =...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Construct a query in PostgreSQL to delete all the rows from a table." }, { "role": "assistant", "content": "DELETE FROM table_name;" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a function that takes in a string and returns a list of all the words that have more than 5 characters" }, { "role": "assistant", "content": "def long_words(string):\n words = s...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Which sorting algorithm should you use for a nearly sorted array?" }, { "role": "assistant", "content": "For a nearly sorted array, insertion sort is the best sorting algorithm because i...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Generate an HTML page to display text\nThe text to be displayed: \"Hello World\"" }, { "role": "assistant", "content": "<html>\n <head>\n <title>Hello World</title>\n </head>\n <bo...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a function that takes a string of brackets and checks if they are correctly matched or not." }, { "role": "assistant", "content": "def check_brackets(bracket_string):\n \"\"\"\...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Design a CSS grid container with 3 columns of equal size." }, { "role": "assistant", "content": ".container {\n display: grid;\n grid-template-columns: 1fr 1fr 1fr;\n}" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a web server in Node.js." }, { "role": "assistant", "content": "const http = require('http');\n\nconst hostname = '127.0.0.1';\nconst port = 3000;\n\nconst server = http.createSer...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a HTML page displaying 3 columns of data\nData: [\"Name\", \"Age\", \"Gender\"], \n[\"Bob\", 35, \"Male\"], \n[\"John\", 28, \"Male\"], \n[\"Sarah\", 39, \"Female\"]" }, { "role": "as...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a SQL statement to delete all records from a table called 'students' where the grade is below 3." }, { "role": "assistant", "content": "DELETE FROM students\nWHERE grade < 3;" } ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Compute the sum of the squares of all the numbers between 1 and 10 (inclusively)." }, { "role": "assistant", "content": "385" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a SQL query to find the average credit score of users who are 18 years or younger." }, { "role": "assistant", "content": "SELECT AVG(credit_score)\nFROM users\nWHERE age <= 18" }...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a sql statement to retrieve the average salary of all employees" }, { "role": "assistant", "content": "SELECT AVG(salary) FROM employees" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a program to generate all possible pairs of a given list of numbers\n[1, 2, 3]" }, { "role": "assistant", "content": "\"\"\"\nCreate a program to generate all possible pairs of a ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "List the different access modifiers in Java" }, { "role": "assistant", "content": "The access modifiers in Java are public, private, protected, and default. Public members are accessible...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a Python script that takes in a string and prints out the frequency distribution of the letters in the string.\napple" }, { "role": "assistant", "content": "def frequency_distribut...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a PHP function to calculate the total amount of tax to be paid given the income and tax rate.\nincome = 50000, tax rate = 0.2" }, { "role": "assistant", "content": "function calcT...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Re-implement this Ruby code in Python\ndef fibonacci(n)\n return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2)\nend" }, { "role": "assistant", "content": "def fibonacci(n): \n if n...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a SQL query to join two tables with the condition that the result should include all rows from the first table, even if there is no match in the second table.\nTable1:\nid | name | a...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Describe the effects when sorting a list using bubble sort" }, { "role": "assistant", "content": "Bubble sort works by comparing adjacent elements of the list and swapping them if they a...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a function to split a string of words by comma.\nstring = 'apple,orange,banana,grapes'" }, { "role": "assistant", "content": "def split_by_comma(string):\n return string.split(\...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Translate the following JSON into an XML format.\n{\n \"person\": {\n \"name\": \"Jane\",\n \"age\": 30\n }\n}" }, { "role": "assistant", "content": "<?xml version=\"...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a Python class to represent a 3 x 3 matrix with variable values." }, { "role": "assistant", "content": "class Matrix:\n def __init__(self, a00=0, a01=0, a02=0, a10=0, a11=0, a1...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a CSS code to style all links (a element) with a red color." }, { "role": "assistant", "content": "a {\n color: red;\n}" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a factorial program without using the inbuilt factorial function in Python." }, { "role": "assistant", "content": "def factorial(n):\n if n == 0:\n return 1\n else:\n ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "You need to design a database for a school where multiple students can have a tutor of a subject. What is the best way to design the database?" }, { "role": "assistant", "content": "The ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Find the sub-array with the maximum sum of its elements where the sub-array starts and ends with the same element from the list of numbers [1, 2, 3, 2, 1, 4, 5, 4] and [2, 3, 2, 1, 1, 2, 3, 2]." }...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Can you guide me through the process of updating my operating system?" }, { "role": "assistant", "content": "Sure, I'd be delighted to help you with that! Here we go:\n\n1. Back up your ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Charlotte's deadly beauty and lethal kicks make the movie cooler than it'd be otherwise.The story is so poor and Charlotte's character dies in such a foolish way, that you wonder if this's the endin...