messages listlengths 2 2 | conversation_id int64 0 20k |
|---|---|
[
{
"content": "Create an HTML form to allow a user to enter their contact information.\nFields requested: Name, Email, Phone number",
"role": "user"
},
{
"content": "<form action=\"contactinfo.php\" method=\"POST\">\n <label>Name</label>\n <input type=\"text\" name=\"name\" />\n \n <label>Email</l... | 20,000 |
[
{
"content": "Create a C++ object to represent a 2D point.",
"role": "user"
},
{
"content": "class Point2D {\n private:\n double x;\n double y;\n public:\n Point2D(double x_coordinate, double y_coordinate);\n double get_x();\n double get_y();\n};\n\nPoint2D::Point2D(double x_... | 20,001 |
[
{
"content": "Write a MySQL query to insert new records in an 'Employees' table.\nTable Name: Employees\nRecords to add: \nName: John, Age: 28, Job Title: Programmer\nName: Alice, Age: 24, Job Title: Designer",
"role": "user"
},
{
"content": "INSERT INTO Employees (Name, Age, Job_Title)\n VALUES ('J... | 20,002 |
[
{
"content": "Create a web page that shows a short biography of the given person.\nPerson: Marie Curie",
"role": "user"
},
{
"content": "<html>\n <head>\n <title>Biography of Marie Curie</title>\n </head>\n <body>\n <h1>Marie Curie</h1>\n <p>Marie Curie (1867-1934) was a Polish physicist... | 20,003 |
[
{
"content": "Sum up the values in the given list using a for loop.\nList: [2, 3, 6, 4, 8]",
"role": "user"
},
{
"content": "total = 0\nfor number in [2, 3, 6, 4, 8]:\n total += number\nprint(\"Total: \", total) # Output: Total: 23",
"role": "assistant"
}
] | 20,004 |
[
{
"content": "Perform an insertion sort on the given list.\nList: [9, 5, 4, 8, 6]",
"role": "user"
},
{
"content": "def insertionSort(arr):\n # Traverse through 1 to len(arr) \n for i in range(1, len(arr)): \n \n key = arr[i] \n \n # Move elements of arr[0..i-1], that are \n # grea... | 20,005 |
[
{
"content": "Given a list of integers, find the smallest and the largest of the set.\n[1, 9, 45, -5, 23, 18]",
"role": "user"
},
{
"content": "let list = [1, 9, 45, -5, 23, 18];\nlet smallest = Math.min(...list);\nlet largest = Math.max(...list);\n\nconsole.log(\"Smallest: \" + smallest + \", Large... | 20,006 |
[
{
"content": "Parse a JSON string and print each key-value pair to the console.\n'{\"name\": \"John\", \"age\": 30, \"likes\": [\"sports\", \"chess\"]}'",
"role": "user"
},
{
"content": "const jsonStr = '{\"name\": \"John\", \"age\": 30, \"likes\": [\"sports\", \"chess\"]}';\nlet jsonObj = JSON.pars... | 20,007 |
[
{
"content": "Implement a shell script to retrieve the IP address of a website.",
"role": "user"
},
{
"content": "#!/bin/bash\n\nif [ $# -eq 0 ]; then\n echo \"Error: No arguments supplied.\"\n exit 1\nfi\n\nip=$( dig +short $1 )\necho $ip",
"role": "assistant"
}
] | 20,008 |
[
{
"content": "Create a regular expression that matches strings starting with \"Hello\".",
"role": "user"
},
{
"content": "let regex = /^Hello/;",
"role": "assistant"
}
] | 20,009 |
[
{
"content": "Create an Android app with a button to switch between light and night mode.",
"role": "user"
},
{
"content": "public class MainActivity extends AppCompatActivity {\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setCo... | 20,010 |
[
{
"content": "Write a JavaScript function to format a given number to HH:MM:SS.\n// Given a number of seconds input\nlet secs = 85",
"role": "user"
},
{
"content": "const formatTime = (secs) => {\n let d = new Date(0);\n d.setSeconds(secs);\n\n let hh = d.getHours().toString().padStart(2, '... | 20,011 |
[
{
"content": "Edit the following HTML to give a baseline styling to the body.\n<body>\n <h2>Hello World</h2>\n</body>",
"role": "user"
},
{
"content": "<body style=\"margin: 0; padding: 0; font-family: sans-serif; box-sizing: border-box; font-size: 16px; line-height: 1.5; background-color: #f5f5f... | 20,012 |
[
{
"content": "Implement a Python class that prints a given given text when a certain condition is satisfied.\nPrint a text \"Endless fun\" when the numbers given in a list equals to 10",
"role": "user"
},
{
"content": "class MyClass:\n def __init__(self, given_list):\n self.given_list = gi... | 20,013 |
[
{
"content": "Create a SQL database containing three tables.",
"role": "user"
},
{
"content": "CREATE TABLE Employee (\n Id INT NOT NULL UNIQUE PRIMARY KEY,\n Name VARCHAR(50) NOT NULL,\n Age INT NOT NULL\n);\n\nCREATE TABLE Department (\n Id INT NOT NULL UNIQUE PRIMARY KEY,\n Name VARCHAR(50) ... | 20,014 |
[
{
"content": "Generate a Bash script to grep a given line from the command output.\ngrep the line \"The result is\" from the following command\n\"echo \"The result is 120\"\"",
"role": "user"
},
{
"content": "#!/bin/bash\n\nCMD=\"echo \"The result is 120\"\"\n\neval $CMD | grep -o \"The result is.*\... | 20,015 |
[
{
"content": "Generate a JavaScript code to get the key names of an object.\nkey names of the following object\nlet obj = {name: \"John\", age: 30, job: \"teacher\"};",
"role": "user"
},
{
"content": "let objKeyNames = Object.keys(obj); \nconsole.log(objKeyNames); // outputs [\"name\", \"age\", \"jo... | 20,016 |
[
{
"content": "Identify and display all the data types within the column 'price' in a table named 'products'.",
"role": "user"
},
{
"content": "SELECT DISTINCT data_type \nFROM products \nWHERE column_name = 'price';",
"role": "assistant"
}
] | 20,017 |
[
{
"content": "Create a basic Python script to accept two numbers from the user and \nprint out the sum.",
"role": "user"
},
{
"content": "num1 = int(input(\"Enter the first number: \"))\nnum2 = int(input(\"Enter the second number: \"))\n\n# add two numbers\nsum = num1 + num2\n\n# display the sum\npr... | 20,018 |
[
{
"content": "Create a basic C# program to print out the current date and time.",
"role": "user"
},
{
"content": "using System;\n\npublic class Program \n{\n public static void Main()\n {\n Console.WriteLine(DateTime.Now.ToString());\n }\n}",
"role": "assistant"
}
] | 20,019 |
[
{
"content": "Find and display all the employees who earn more than the average salary across all departments.",
"role": "user"
},
{
"content": "SELECT e.name \nFROM employees e \nWHERE e.salary > (SELECT AVG(salary) FROM employees);",
"role": "assistant"
}
] | 20,020 |
[
{
"content": "Create a Python program to accept a string from the user and print out the number of vowels in the string.\nHello World",
"role": "user"
},
{
"content": "def countVowels(str): \n\tvowel = 0\n\tfor i in str: \n\t\tif i.lower() in ['a', 'e', 'i', 'o', 'u']: \n\t\t\tvowel += 1\n\treturn v... | 20,021 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.