messages listlengths 3 3 |
|---|
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create an array with 3 elements of your choice."
},
{
"role": "assistant",
"content": "my_array = [\"John\", 25, True]"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a function to find the average of given numbers using a list.\nnums = [2, 4, 6, 8]"
},
{
"role": "assistant",
"content": "\"\"\"\nWrite a function to find the average of given numb... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "design a functions which removes the duplicate elements from a list"
},
{
"role": "assistant",
"content": "def remove_duplicates(x):\n res = []\n for i in x:\n if i not in r... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Rewrite the following if-statement into a switch statement.\nif (grade == \"A\") {\n gradeValue = 4.0;\n}\nelse if (grade == \"B\") {\n gradeValue = 3.0;\n}\nelse if (grade == \"C\") {\n gr... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate the ternary operator for the following expression: x > 0 ? 10 : 5."
},
{
"role": "assistant",
"content": "x > 0 ? 10 : 5"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Count the number of integers in the given 2D array.\n[\n [1, 2, 3],\n [4, 5, 6],\n [7, 8]\n]"
},
{
"role": "assistant",
"content": "8"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate an HTML table with 3 columns for Name, Email and Phone Number."
},
{
"role": "assistant",
"content": "<table>\n <tr>\n <th>Name</th>\n <th>Email</th>\n <... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Find the minimum among a list of integers.\n[1, 15, 22, -5, 87]"
},
{
"role": "assistant",
"content": "def find_min(numbers):\n min_value = numbers[0]\n for n in numbers:\n if n < m... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Determine the average of 3 numbers.\n30, 20, 60"
},
{
"role": "assistant",
"content": "The average of the 3 numbers is 36."
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create an HTML page containing a text field and a button."
},
{
"role": "assistant",
"content": "<!DOCTYPE html>\n<html>\n<head>\n <title>Input Form</title>\n</head>\n<body>\n <form>\n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a Node.js server that responds with \"Hello World!\" when the URL \"/\" is accessed."
},
{
"role": "assistant",
"content": "const http = require('http');\n\nconst server = http.cr... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a function to print a multiline message in Python\nmessage = \"This is a multiline \nmessage.\""
},
{
"role": "assistant",
"content": "def print_multiline_message(message):\n p... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a Python script to find the common elements in two given lists.\nlist1 = [1, 2, 3, 5, 7]\nlist2 = [2, 3, 4, 5, 6]"
},
{
"role": "assistant",
"content": "def common_elements(list1, ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a SQL query to get the titles and release dates of all the movies from the Movies table released in the year 2019."
},
{
"role": "assistant",
"content": "SELECT title, release_date... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a method to find all valid IP addresses that can be formed using a given string.\nstring = \"25525511135\""
},
{
"role": "assistant",
"content": "def find_all_valid_ip_addresses(s... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate an SQL query to retrieve the data\nRetrieve the name and salary of employees whose salary is more than $50000"
},
{
"role": "assistant",
"content": "SELECT name, salary\nFROM em... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Develop a SQL query to count the number of people who are born before 1992."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM people WHERE year_of_birth < 1992;"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "What is the correct way to find the length of an array in Java?"
},
{
"role": "assistant",
"content": "The correct way to find the length of an array in Java is to use the length field o... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Develop an algorithm in Python to find the average of four numbers.\n[2, 4, 8, 5]"
},
{
"role": "assistant",
"content": "def avg(numbers):\n sum = 0\n for num in numbers:\n sum += num\n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a variable to store your name."
},
{
"role": "assistant",
"content": "name = \"John\""
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Parse the following JSON objects, convert all the values to strings and create a dictionary named \"parsed_data\".\n{\n \"name\": \"John Doe\",\n \"age\": 33,\n \"locations\": [\"NYC\", \"LA\"]\n}"
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Design a Python class structure for playing cards with two classes: Deck and Card."
},
{
"role": "assistant",
"content": "class Deck: \n def __init__(self):\n self.cards = []\n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Edit the Python code snippet to remove the syntax error.\ndef calculate_area(length, width):\n area = length * width\n return “The area is” + area"
},
{
"role": "assistant",
"conte... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write code to parse a given IP address into its octets.\nIP address: 10.23.6.17"
},
{
"role": "assistant",
"content": "def parse_ip_address(ip):\n octets = ip.split(\".\")\n return... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given a list of names, capitalize the first letter of each name.\nnames = [\"john\", \"sarah\", \"joe\", \"dave\"]"
},
{
"role": "assistant",
"content": "def capitalize_names(names):\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "What is the best way to store user input in JavaScript?"
},
{
"role": "assistant",
"content": "The best way to store user input in JavaScript is to use the localStorage object. The local... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Implement a recursive binary search on a given sorted list.\n[-4, -2, 0, 6, 7, 8]"
},
{
"role": "assistant",
"content": "def binary_search(arr, num, start, end): \n if start >= end: \... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Structure an HTML form taking inputs of name, age, and email address."
},
{
"role": "assistant",
"content": "<form>\n <label>Name:</label>\n <input type=\"text\" name=\"name\" />\n \n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Design a class that stores the data of an individual employee"
},
{
"role": "assistant",
"content": "class Employee:\n def __init__(self, name, age, salary):\n self.name = name... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a random 6-digit integer."
},
{
"role": "assistant",
"content": "import random\n\nrandom_int = str(random.randint(100000, 999999))"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a Python function to sort a list of strings based on a given alphabetical order.\nalphabet = 'bdhajfz', strings = ['bad', 'hfja', 'abd', 'zaj']"
},
{
"role": "assistant",
"content... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a JavaScript function for the linear search algorithm."
},
{
"role": "assistant",
"content": "// Linear search algorithm \nfunction linearSearch(array, item) {\n for (let i = 0; ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Find all character positions in the given string\nString: abracadabra"
},
{
"role": "assistant",
"content": "Character Positions: \na: 0, 3, 5, 7, 10\nb: 1, 8\nc: 2\nd: 4\nr: 6, 9"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a web page with a form for user input of a modified text."
},
{
"role": "assistant",
"content": "<html>\n<body>\n <form action = \"processText.php\" method = \"post\">\n <text... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Compute the hamming distance between two strings and print the result.\nString1: 'hello'\nString2: 'world'"
},
{
"role": "assistant",
"content": "\"\"\"\nCompute the hamming distance bet... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Use the OpenGL API to create a vertex buffer object (VBO)."
},
{
"role": "assistant",
"content": "GLuint vbo;\nglGenBuffers(1, &vbo);\nglBindBuffer(GL_ARRAY_BUFFER, vbo);"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a SQL query to count the total number of customers who haven't placed an order yet.\nTable Name: customers"
},
{
"role": "assistant",
"content": "SELECT COUNT(*)\nFROM customers\nW... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "In Python, write a program to remove all duplicates from a given list of integers."
},
{
"role": "assistant",
"content": "def remove_duplicates(arr):\n result = [] \n seen = set() ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a SQL query to select all entries in a given table with a value larger than 100."
},
{
"role": "assistant",
"content": "SELECT * \nFROM table \nWHERE col > 100;"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Implement a function to rotate a list by k elements.\nlist = [1,2,3,4,5], k = 2"
},
{
"role": "assistant",
"content": "def rotate(list, k): \n first_part = list[0:k] \n second_part... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Install and set up a database management system called MongoDB."
},
{
"role": "assistant",
"content": "1. Download and install the MongoDB server\n2. Create data directories, a log file ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a function in Python to implement a linear search algorithm. The algorithm should return the index of the number in the array if found, otherwise -1.\ndata = [7, 13, 11, 9, 12]\nsearch_num = 9... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Parse the following JSON string and create a JavaScript object.\n{\"name\":\"John\", \"age\":30, \"city\":\"New York\"}"
},
{
"role": "assistant",
"content": "const jsonString = '{\"name... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Given a binary tree, write a code to search a given value in the tree."
},
{
"role": "assistant",
"content": "def search_tree(tree, value):\n # If the tree is empty\n if not tree:\... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a user-defined type in Python to store information about a person."
},
{
"role": "assistant",
"content": "class Person:\n def __init__(self, firstname, lastname, age):\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a function to multiply two integers."
},
{
"role": "assistant",
"content": "def multiply_ints(x, y): \n return x * y"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Output the median of the given list of numbers.\n[1, 4, 7, 9, 12]"
},
{
"role": "assistant",
"content": "7.5"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a MySQL query to get the maximum salary from the employees table section.\nTable structure:\n\n employees \n \nid | name | department | salary |"
},
{
"role": "assistant",
"conten... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Using regular expressions, extract all telephone numbers from a given string in JavaScript."
},
{
"role": "assistant",
"content": "let string = \"My telephone numbers are 123-456-7890 an... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Declare a C++ structure that stores data about employees including their name and employee id."
},
{
"role": "assistant",
"content": "struct employee {\n string name;\n int id;\n};"
}
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a function in JavaScript that takes in two arrays and returns an object. The object should contain elements where the two arrays have coinciding elements.\n[1,3,5], [2,4,1]"
},
{
"rol... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a dictionary comprehension to mapp the following list\n[('a',0),('b',1),('c',2)]"
},
{
"role": "assistant",
"content": "{key: value for (key,value) in [('a',0),('b',1),('c',2)]}"
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a CSS rule for a class called \"main-text\" which sets the font weight of the text to bold and the font color to blue."
},
{
"role": "assistant",
"content": ".main-text {\n font-... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a random sample of size 10 using numpy"
},
{
"role": "assistant",
"content": "import numpy as np\n\nrand_sample = np.random.randint(low=0, high=100, size=10)"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "You are given a string. Count the total number of lowercase letters in the string."
},
{
"role": "assistant",
"content": "def count_lowercase(string):\n count = 0\n for char in str... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a SQL query to find all students who have a GPA greater than 3.0"
},
{
"role": "assistant",
"content": "SELECT * \nFROM students \nWHERE GPA > 3.0"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a Python program to generate the first n Fibonacci numbers."
},
{
"role": "assistant",
"content": "def generate_fibonacci_numbers(n):\n if n==1:\n return [0]\n elif n==2:... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a code to extract the odd numbers from a given array in JavaScript.\n[1, 2, 3, 4, 5, 6, 7, 8, 9]"
},
{
"role": "assistant",
"content": "function oddNumbers(arr) {\n let oddNumber... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate 10 random numbers between 5 to 10."
},
{
"role": "assistant",
"content": "import random\n\n# Generate 10 random numbers between 5 and 10\nrandom_numbers = [random.randint(5, 10)... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Sort the list using Quick Sort\n[2, 3, 5, 6, 1, 4]"
},
{
"role": "assistant",
"content": "def quick_sort(arr): \n\tif len(arr) <= 1:\n\t\treturn arr\n\tpivot = arr[len(arr) // 2]\n\tleft... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Design an algorithm to find the maximum subarray of an array of numbers."
},
{
"role": "assistant",
"content": "def max_subarray(arr): \n max_so_far = 0\n max_ending_here = 0\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Using JavaScript, print the name of sites visited today on the web console."
},
{
"role": "assistant",
"content": "var visitedSites = [\"www.facebook.com\", \"www.google.com\", \"www.yah... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "What is the command for executing a code written in Java?"
},
{
"role": "assistant",
"content": "The command for executing a code written in Java is \"java [filename]\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Change the HTML element to have a font size of 10px\n<p>Hello World!</p>"
},
{
"role": "assistant",
"content": "<p style=\"font-size:10px;\">Hello World!</p>"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Analyze the given HTML code.\n<div>\n <h3>Title</h3>\n <p>paragraph</p>\n <button>Button</button>\n</div>"
},
{
"role": "assistant",
"content": "This code creates a div element ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Make a class called 'Car' that stores information about a car and contains a function called 'start' which when called, prints out \"Car has started\"."
},
{
"role": "assistant",
"conten... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Modify the following HTML to create a link that opens in a new window.\n<a href=\"www.example.com\">Example Link</a>"
},
{
"role": "assistant",
"content": "<a href=\"www.example.com\" ta... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a Python function to check if a given number is a prime number or not. A prime number is an integer greater than 1 which is not divisible by any other numbers.\n11"
},
{
"role": "assis... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create an algorithm for finding the least common multiple of two numbers."
},
{
"role": "assistant",
"content": "One algorithm to find the least common multiple of two numbers is as foll... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a JavaScript statement to extract the last four characters from the string\nThis is a sample string."
},
{
"role": "assistant",
"content": "var lastFour = myString.slice(-4);"
}
... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Construct a simple web page with two fields, a login input and a password input."
},
{
"role": "assistant",
"content": "<html>\n<body>\n\n<form>\n <div>\n <label>Login:</label>... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a for-loop in JavaScript that iterates through numbers from 1 to 10 and prints out the current number."
},
{
"role": "assistant",
"content": "for (let i = 1; i <= 10; i++) {\n co... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a SQL command to count the number of rows from a table ‘Orders’."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM Orders;"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Edit the following HTML code to enable a toggle to show and hide a DIV element when a button is clicked.\n<div>\n <button>Toggle</button>\n <p>This is a text paragraph.</p>\n</div>"
},
{
"... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Compress the following string using LZW compression.\nInput: ‘ABBBCDCDEFFG’"
},
{
"role": "assistant",
"content": "The compressed string would be ‘A1B3C1D1E1F2G1’."
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "What kind of data structure is used for a queue in Java?"
},
{
"role": "assistant",
"content": "A queue in Java is typically implemented using a linked list or an array."
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Edit the following XML code to add a navigation bar to the top of a web page\n<html>\n<head>\n <title>My Webpage</title>\n</head>"
},
{
"role": "assistant",
"content": "<html>\n<head>\n... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an Objective-C statement to create an empty array to hold names."
},
{
"role": "assistant",
"content": "NSMutableArray *names = [NSMutableArray array];"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "How would you convert a binary number to decimal in JavaScript?"
},
{
"role": "assistant",
"content": "const binaryToDecimal = binaryString => parseInt(binaryString, 2);"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a Visual Basic function to print the contents of an array."
},
{
"role": "assistant",
"content": "Public Sub PrintArray(arr() As Integer)\n For i = 0 To arr.Length - 1\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "What is the fifth prime number?"
},
{
"role": "assistant",
"content": "The fifth prime number is 11."
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a JavaScript function that swaps the values of two variables."
},
{
"role": "assistant",
"content": "function swap(a, b) {\n let temp = a;\n a = b;\n b = temp;\n}"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Process the following array of numbers to get the max, min, and average scores.\nscores = [90, 75, 70, 85, 80]"
},
{
"role": "assistant",
"content": "const scores = [90, 75, 70, 85, 80];... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Use recursion to construct a list of the first 10 powers of two (1, 2, 4, 8, ...)."
},
{
"role": "assistant",
"content": "[1, 2, 4, 8, 16, 32, 64, 128, 256, 512]"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Suggest a SQL query to get the average order total from last year's orders."
},
{
"role": "assistant",
"content": "SELECT AVG(total) FROM orders WHERE YEAR(order_date) = YEAR(CURDATE()) ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Replace all the negative numbers in an array to zero using Ruby.\narr = [3, 4, -2, -1]"
},
{
"role": "assistant",
"content": "# Replace all negative numbers in an array to zero \narr.eac... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a regular expression to match words that contain only lowercase letters."
},
{
"role": "assistant",
"content": "^[a-z]+$"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Suggest a cleaner and more concise way to implement the following code snippet.\ndef find_matching_number(nums, target):\n for num in nums:\n if num == target:\n return True\n return False... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Make a script that checks if a given integer value is divisible by 3 and 5 both.\nvalue = 10"
},
{
"role": "assistant",
"content": "def check_divisible(value):\n \"\"\"Check if value ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a MySQL query to delete all the entries with the name \"John\" in the table \"users\"."
},
{
"role": "assistant",
"content": "DELETE FROM users WHERE name=\"John\";"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create a new Python class called Area to calculate the area of different shapes."
},
{
"role": "assistant",
"content": "class Area:\n def __init__(self):\n pass\n\n def calc... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Create an HTML form with one input field which requests the user's name."
},
{
"role": "assistant",
"content": "<form action=\"\" method=\"get\">\n <label for=\"name\">Name:</label>\n ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Describe how reinforcement learning works."
},
{
"role": "assistant",
"content": "Reinforcement learning is a type of machine learning algorithm that allows an agent to learn from its en... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Design a function with two inputs that returns the maximum of the two."
},
{
"role": "assistant",
"content": "def maximum(a, b):\n if a > b:\n return a\n else:\n retu... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write an SQL query to find the maximum salary of an employee in the same department as the given employee.\nEmployee name: ‘John Doe’\nDepartment: ‘Finance’"
},
{
"role": "assistant",
"c... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Can you explain the bubble sort algorithm?"
},
{
"role": "assistant",
"content": "Bubble sort is a simple sorting algorithm which iterates through a list and compares adjacent elements, ... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Where does a Python interpreter look for modules?"
},
{
"role": "assistant",
"content": "The Python interpreter looks for modules in the following locations: the home directory, the buil... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Generate a regular expression to match a valid email address."
},
{
"role": "assistant",
"content": "/^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$/"
}
] |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Construct a JavaScript object with three properties: name, age, and profession."
},
{
"role": "assistant",
"content": "const person = {\n name: 'John Doe',\n age: 36,\n profession: 'd... |
[
{
"role": "system",
"content": "You are a helpful AI assistant."
},
{
"role": "user",
"content": "Write a JavaScript function to convert a number from octal to decimal.\noctal_number = 014"
},
{
"role": "assistant",
"content": "function octToDec(octal_number){\n let dec_number = 0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.