messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a HTML page with 4 divs, one of them should have text aligned in the center." }, { "role": "assistant", "content": "<!DOCTYPE html>\n<html>\n<head>\n <title>4 Divs</title>\n</hea...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Find the index of the element \"z\" in the array \"alphabet\" below, and print the index.\nlet alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', '...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a SQL query to count the total number of movies for every genre in the database." }, { "role": "assistant", "content": "SELECT genre, COUNT(*) as total_movies \n FROM Movies \n G...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a Python loop that iterates for 10 times." }, { "role": "assistant", "content": "for i in range(10):\n ..." } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a Bash script for creating a directory in the current working directory." }, { "role": "assistant", "content": "#!/bin/bash \n# Create a directory\nmkdir myDir" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a CSS rule to center a container with class \"main\"." }, { "role": "assistant", "content": ".main {\n margin: 0 auto;\n width: 100%;\n display: block;\n text-align: ce...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a SQL query to produce a list of customer names from the following table.\nTable: customers \n\n| customer_id | name |\n| --------- | ----- | \n| 1 | Bill |\n| 2 | Jane |\n|...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a regular expression that matches the email address with the domain gmail.com" }, { "role": "assistant", "content": "\\S+@gmail\\.com$" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Edit the code below to sort the list of integers given in the input.\nlist_in = [40, 32, 12, 19]" }, { "role": "assistant", "content": "list_in = [40, 32, 12, 19]\nlist_in.sort()\nprint(...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a loop to print the numbers in reverse order from 5 to 2." }, { "role": "assistant", "content": "for i in range(5, 1, -1):\n print(i)" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Who is the author of the book \"Alice in Wonderland\"?" }, { "role": "assistant", "content": "The author of the book \"Alice in Wonderland\" is Lewis Carroll." } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Split a sentence into an array of words using C++.\nSentence: Today is a sunny day." }, { "role": "assistant", "content": "#include<string>\n#include<vector>\n#include<sstream>\n\nstd::s...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Which basic data type is represented by the following JSON?\n\n{\"name\": \"John\", \"age\": 30}" }, { "role": "assistant", "content": "The JSON given represents a basic object data type...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create an array of the squared values of all elements of the given array.\narr = [2, 3, 6, 8]" }, { "role": "assistant", "content": "def square_arr(arr):\n return [x**2 for x in arr]"...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a regex expression to validate a username containing only letters, numbers, underscores, and hyphens." }, { "role": "assistant", "content": "/^[a-zA-Z0-9_\\-]+$/" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a class with two methods, one to return the name and the other to return the age." }, { "role": "assistant", "content": "class Person:\n def __init__(self, name, age):\n ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a JavaScript program to convert an array of objects into a comma-separated values (CSV) string with column headers.\n[\n {name: 'John', age: 28, city: 'New York'}, \n {name: 'Mary', age: 34, c...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Given a list of lists, generate a single flattened list.\nlst = [[1, 2], [3, 4], [5, 6]]" }, { "role": "assistant", "content": "lst = [[1, 2], [3, 4], [5, 6]]\nflattened = [item for subl...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Find a Python solution for this leetcode problem.\nGiven an array of integers, return indices of the two numbers such that they add up to a specific target.\n\nYou may assume that each input would h...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a query to extract data from a table called \"inventory\" which contains the columns: id, item, quantity" }, { "role": "assistant", "content": "SELECT id, item, quantity\nFROM inve...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a SQL query to fetch the data from the following tables.\nTable A\nid name\n1 John\n2 Mary\n\nTable B\nid age\n1 20\n2 25" }, { "role": "assistant", "content": "SELECT a.name, b.a...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Update the following HTML page so that it refreshes the page every 5 seconds.\n<html>\n <head>\n <title>My Webpage</title>\n </head>\n <body>\n Hello World!\n </body>\n</html>" }, { "role"...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a function to return all possible sums of two numbers." }, { "role": "assistant", "content": "def two_num_sums(nums):\n \"\"\"Returns a list of all possible sums of two numbers...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Which data structure is most suitable for storing a large list of numbers?" }, { "role": "assistant", "content": "Heap or binary tree. A heap or binary tree data structure are most suita...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Develop a JavaScript object for storing the name and occupation of an employee.\nname = 'John Doe', occupation = 'Programmer'" }, { "role": "assistant", "content": "const employee = {\n ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a jQuery function that animates an element's background color from red to green over 3 seconds." }, { "role": "assistant", "content": "$(\"#element\").animate({\n backgroundCol...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "What is a web server?" }, { "role": "assistant", "content": "A web server is a computer system that hosts web applications and responds to requests from users over the internet. The web ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a program to create a dictionary with words and their frequencies from a given sentence.\nsentence = \"Python is an easy, powerful language with a simple syntax and high readability\"" }, ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "What is the maximum size of a virtual memory address used by 32-bit Intel 8086 processor?" }, { "role": "assistant", "content": "The maximum size of a virtual memory address used by a 32...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Find the maximum value of an array without using any built-in functions\n[7, 9, -2, 15, 3]" }, { "role": "assistant", "content": "def find_max(arr):\n max = arr[0]\n for i in range...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a function in Python that adds a new item to the beginning of a list.\nmy_list = [\"Cats\", \"Dogs\", \"Fish\"]" }, { "role": "assistant", "content": "def insert_beginning(my_list...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create two classes, \"Animal\" and \"Dog\", in which the \"Dog\" class inherits from the \"Animal\" class." }, { "role": "assistant", "content": "class Animal: \n pass\n\nclass Dog(An...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Reverse the words of the sentence \"The quick brown fox jumps over the lazy dog\"." }, { "role": "assistant", "content": "dog lazy the over jumps fox brown quick The" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Organize the following array of objects in ascending order by the 'name' field.\n[ \n { name: 'Jill', lastname: 'Smith' }, \n { name: 'Bob', lastname: 'Jones' },\n { name: 'Jack', lastname: 'Baue...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a recursive function to calculate the Fibonacci sequence." }, { "role": "assistant", "content": "def fibo(n): \n \n if n <= 1: \n return n \n else: \n return(f...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Convert the following recursive function to an iterative one.\ndef factorial(n): \n if n == 0: \n return 1\n else: \n return n * factorial(n - 1)" }, { "role": "assistant...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Generate a regular expression that matches strings containing any number of digits, but does not contain any non-digit character." }, { "role": "assistant", "content": "^[0-9]+$" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Analyze the following modified code and explain what the modified code does\nint x = 10;\nif (x == 10)\n x = x + 10;\nelse\n x = x - 10;" }, { "role": "assistant", "content": "The modi...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Make an API call that fetches the user details and stores it in a DB.\n// URL: '/users/fetch'\n// Parameters: username, password" }, { "role": "assistant", "content": "const request = re...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write an R command to sort the data in a data frame based on the values of one column.\ndf <- data.frame(A = c(4, 5, 11, 8), B = c(13, 12, 6, 11), C = c(4, 5, 7, 3))" }, { "role": "assistant...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "You need to run a loop 'n' times and print a value each time.\nlet n = 10;" }, { "role": "assistant", "content": "for (let i = 0; i < n; i++) {\n console.log(i);\n}" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "What is the Python equivalent of the C++ code snippet?\n#include <iostream>\n\nint main() {\n std::cout << \"Hello, World!\" << std::endl;\n return 0;\n}" }, { "role": "assistant", "cont...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Construct a HTML page that displays a form with a text field and a submit button." }, { "role": "assistant", "content": "<!DOCTYPE html>\n<html>\n<head>\n <title>Sample Form</title>\n</h...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a function in HTML to display a blinking text on the webpage." }, { "role": "assistant", "content": "<script> \nfunction blink() { \n var text = document.getElementById('blink'...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "How can you access the value of a key from a JavaScript object?" }, { "role": "assistant", "content": "You can access a value from a JavaScript object using either dot notation or square...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a query in MySQL to delete all rows with a given ID." }, { "role": "assistant", "content": "DELETE FROM table_name \nWHERE ID = 'given_id';" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Modify this string in such a way that it should start with \"Hello \" and must end with \" World\".\nstr = \"World, say hello\"" }, { "role": "assistant", "content": "str = \"Hello World...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Edit the given HTML code to create a paragraph element.\n<div>Hello World!</div>" }, { "role": "assistant", "content": "<div><p>Hello World!</p></div>" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Given a list of numbers, extend the list such that it contains the square of the elements present in the list.\nnumbers = [1,2,3]" }, { "role": "assistant", "content": "numbers = [1,2,3,...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create an array in Python that contains five different values." }, { "role": "assistant", "content": "arr = [1, 2, 3, 4, 5]" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Modify the following CSS code to change the background color of the element to \"#FFC0CB\"\n.main-page {\n background-color: #FFF;\n}" }, { "role": "assistant", "content": ".main-page...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Given two strings, create a function to find the total number of occurrences of the second string in the first string.\nstr1 = \"Hello World!\"\nstr2 = \"lo\"" }, { "role": "assistant", ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write an HTML code snippet to create a checkbox with the label “Terms of Service”" }, { "role": "assistant", "content": "<input type=\"checkbox\" id=\"terms\" name=\"terms\" value=\"agre...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "We have a list of numbers and a given sum. Write a program to determine if any two numbers from the list sum up to the given sum.\n[1,2,3,4], 6" }, { "role": "assistant", "content": "def...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Rewrite the following code snippet so that it is compatible with Python 3\nsum = 0\nfor num in range(10):\n sum = sum + num\nprint sum" }, { "role": "assistant", "content": "sum = 0\nf...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a dictionary comprehension for the given data.\n{\"A\":1, \"B\":2, \"C\":3, \"D\":4}" }, { "role": "assistant", "content": "Dict = {key: value for key, value in {\"A\":1, \"B\":2,...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a basic query using two variables.\nsky, blue" }, { "role": "assistant", "content": "SELECT *\nFROM table\nWHERE sky = 'blue';" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a function to convert a character to its ASCII code.\ncharacter = 'a'" }, { "role": "assistant", "content": "def char_to_ascii(character):\n \"\"\"Convert a character to its AS...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a function to remove a given element from an array of integers.\narr = [2, 3, 4, 5, 6]\nremove_element = 4" }, { "role": "assistant", "content": "def remove_element(arr, remove_ele...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Convert the following if-else block of code into a ternary expression.\nif (condition){\n do_something();\n}\nelse {\n do_something_else();\n}" }, { "role": "assistant", "content": "co...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "What is a text editor?" }, { "role": "assistant", "content": "A text editor is a computer program used for entering, editing, formatting and displaying text. Some text editors support sy...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Generate C code to swap two integers without using a third variable." }, { "role": "assistant", "content": "void swap_int(int * x, int * y) {\n *x = *x ^ *y;\n *y = *x ^ *y;\n *...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Construct a query in PostgreSQL to find the names and emails of all users who have \"google.com\" in their emails." }, { "role": "assistant", "content": "SELECT name, email\nFROM users\n...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Classify the following sentence as offensive or non-offensive.\nSentence: Your work is terrible!" }, { "role": "assistant", "content": "Offensive." } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a program in Java that sort a given array using bubble sort algorithm.\nArray: [4, 3, 5, 2, 1]" }, { "role": "assistant", "content": "public static void bubbleSort(int[] arr) {\n ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a JavaScript object with two properties and their respective values." }, { "role": "assistant", "content": "var myData = {\n name: 'John',\n age: 28\n};" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Insert a line of code to change the value of the string \"text\" to \"Hello World\".\nString text = \"\";" }, { "role": "assistant", "content": "String text = \"\";\ntext = \"Hello World...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create an algorithm that sorts a given list of numbers.\n[1, 5, -3, 0, 8]" }, { "role": "assistant", "content": "def bubble_sort(list):\n for i in range(len(list)):\n for j in range(l...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Find all occurrences of a substring in a given string.\nstring = \"the cat in the hat\"\nsubstring = \"cat\"" }, { "role": "assistant", "content": "def find_substring_occurrences(string,...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Translate the following sentiment analysis model written in Python to JavaScript\nmodel = tf.keras.models.Sequential([\n tf.keras.layers.Dense(128, activation='relu', input_shape=(tem_train_data.sha...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write an algorithm in MIPS assembly language to determine if a given character is an uppercase letter or not.\nCharacter: ‘A’" }, { "role": "assistant", "content": "li $t0, 65\nli $t1, 9...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a line of JavaScript code to create a variable `x` and assign the number `7` to it." }, { "role": "assistant", "content": "let x = 7;" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "What HTML element is used to create a table?" }, { "role": "assistant", "content": "The HTML element used to create a table is the <table> element." } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a query for filtering an array of objects in a MongoDB collection by their 'age' field.\nThe collection is named 'users' and the filter should return objects with age greater than 21" }, {...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a SQL query to find the books in the library whose title included the word \"Science\"." }, { "role": "assistant", "content": "SELECT * FROM books WHERE title LIKE '%Science%';" ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "How would you design a system to store and access the stored data when a user makes a request?" }, { "role": "assistant", "content": "To design a system to store and access the stored da...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Correct the following code and generate an output:\nlist_of_ints = [2, 3, 4, 8]\n\nfor x in list_of_ints\n print(x)" }, { "role": "assistant", "content": "list_of_ints = [2, 3, 4, 8]\...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write an SQL query to pick distinct elements from a table named 'students'." }, { "role": "assistant", "content": "SELECT DISTINCT * FROM students;" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Output the even numbers between 0 and 10." }, { "role": "assistant", "content": "2, 4, 6, 8, 10" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "What are the main components of an object oriented programming language?" }, { "role": "assistant", "content": "The main components of an object oriented programming language are classes...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Subtract the second number from the first.\n8, 6" }, { "role": "assistant", "content": "2" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a function which will print out a given pattern.\n*\n**\n***\n****" }, { "role": "assistant", "content": "def print_pattern(n):\n for i in range(1, n+1):\n print(\"*\" * ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a function that exchanges the first and last elements of a list." }, { "role": "assistant", "content": "def exchange_first_last(lst):\n first_item = lst[0]\n last_item = lst[...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Rewrite the following code using the try-catch statement\nif (num!=0)\n result = 1/num;\nelse\n result = 0;" }, { "role": "assistant", "content": "try {\n result = 1 / num;\n} catch (...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Edit the code so it displays the numbers 1 to 5.\nfor i in range(2, 10):\n print(i)" }, { "role": "assistant", "content": "for i in range(1, 6):\n print(i)" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Generate the Fibonacci sequence up to the 10th number." }, { "role": "assistant", "content": "0, 1, 1, 2, 3, 5, 8, 13, 21, 34" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Suggest an efficient algorithm for sorting the following list.\n[7, 1, 4, 8, 9, 2]" }, { "role": "assistant", "content": "def sort(array): \n length = len(array) \n \n for i in ra...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a boolean expression in JavaScript, which returns false if a variable named \"result\" is an empty string.\nvar result = '';" }, { "role": "assistant", "content": "if (result === ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Apply the given CSS style to the HTML element.\n<div>Hello World</div>\ncss: font-weight: bold;" }, { "role": "assistant", "content": "<div style=\"font-weight: bold;\">Hello World</div>...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Design an algorithm to find the two numbers in an array that have the largest sum.\n[1,3,4,6,7]" }, { "role": "assistant", "content": "# Finds two numbers in an array that have the large...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a Python function that accepts a list and returns the sum of the numbers present in the list.\nlist = [1, 2, 3, 4, 5]" }, { "role": "assistant", "content": "def list_sum(lst):\n ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a MySQL table with two columns id and name, where id should have primary key." }, { "role": "assistant", "content": "CREATE TABLE student (\n id INT NOT NULL AUTO_INCREMENT,\n ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Design a program to find the occurrence of a given character in a given string.\nGiven string: \"Hello World!\"\nCharacter to find: o" }, { "role": "assistant", "content": "def occurance...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Write a JavaScript program to check if two numbers are equal.\n3 and 5" }, { "role": "assistant", "content": "function areEqual(x, y){\n if (x === y){\n return true;\n }\n ...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Modify a jQuery code to make an element translucent" }, { "role": "assistant", "content": "$(document).ready(function(){\n $(\"#targetElement\").css(\"opacity\", \"0.5\");\n});" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Reverse a string using a stack.\nstring: hello" }, { "role": "assistant", "content": "def reverse_string_using_stack(string): \n stack = []\n for char in string:\n stack.app...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Wrap the given text in a tag.\nHello World" }, { "role": "assistant", "content": "<p>Hello World</p>" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Update the given function to return a list of tuples where each tuple contains the name and age of each person.\ndef get_person_info(name, age):\n \"\"\"Returns a tuple containing name and age.\"...
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Create a loop that prints all numbers 1 to 100 with the exception of multiples of 5." }, { "role": "assistant", "content": "for i in range(1,101):\n if i % 5 != 0:\n print(i)" } ]
[ { "role": "system", "content": "You are a helpful AI assistant." }, { "role": "user", "content": "Construct an SQL query to select all the unique values of one column from a table that appear more than twice.\ncolumn_name: 'gender'" }, { "role": "assistant", "content": "SELECT gender...