[output] | [A-F].* [instruction] | Write a regular expression to match all strings which contain at least one character from A-F. [input] |
[output] | var person = { name: "John Doe", age: 30, gender: "Male" }; [instruction] | Create a JavaScript object which will contain data about a person. [input] |
[output] | SELECT * FROM table_name; [instruction] | Write a query in MySQL which will get all the records from a table. [input] |
[output] | CREATE TABLE `MyTable` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) NOT NULL, `age` int(11) NOT NULL, PRIMARY KEY (`id`) ); [instruction] | Create a column-oriented MySQL table with the columns "id", "name", "age". [input] |
[output] | SELECT * FROM MyTable WHERE Age > 21; [instruction] | Write a query in MySQL to find all records with the Age > 21. [input] |
[output] | SELECT * FROM Employees WHERE Salary BETWEEN 2000 AND 3000; [instruction] | Construct a SQL query to find the employee records with salary between 2000 and 3000 dollars. [input] |
[output] | int i = 1; while (i <= 10) { cout << i << endl; i++; } [instruction] | Create a while loop in C++ that iterates over integers from 1 to 10. [input] |
[output] | if (number > 10) { console.log("Your number is bigger than 10"); } [instruction] | Create an if statement in JavaScript that prints "Your number is bigger than 10" if a given number is bigger than 10. [input] |
[output] | for ($i = 0; $i <= 10; $i++) { echo $i; } [instruction] | Construct a for loop in PHP that produces the integers from 0 to 10. [input] |
[output] | my_list = [x**2 for x in range(1, 11)] [instruction] | Initialize a list to store the square of all numbers from 1 to 10. [input] |
[output] | new_list = ["student_" + name for name in students] [instruction] | Given the following list, use list comprehension to create a new list with the string "student_" added to the beginning of each student's name. [input] | students = ['John', 'Randy', 'Marie', 'Clare']
[output] | def insertion_sort(input_list): for index in range(1, len(input_list)): current_value = input_list[index] position = index while position > 0 and input_list[position - 1] > current_value: input_list[position] = input_list[position - 1] position = [instruction] | Implement the insertion sort algorithm. [input] | [4, 6, 3, 8, 1, 8]
[output] | The keyword used to define a function in Python is "def". [instruction] | Which keyword is used to define a function in Python? [input] |
[output] | class StudentMark{ //stores student ID int student_id; //stores course name string course_name; //stores marks int marks; //constructor StudentMark(int student_id, string course_name, int marks) { this->student_id = student_id; this->cour [instruction] | Design a data structure to keep track of a student's marks for a given course. [input] |
[output] | def count_items(dict): item_count = 0 for key in dict: item_count += 1 return item_count [instruction] | Given a dictionary, write a function to count the number of items in the dictionary. [input] | dictionary = {'name': 'John', 'age': 30}
[output] | def abbreviateName(name): split_name = name.split(' '); abbrev_name = str(split_name[0][0] + '.' + split_name[1]); return abbrev_name; [instruction] | Write a Python program to abbreviate a name. [input] | name = "John Smith"
[output] | def fibonacci (n): if n == 0: return 0 elif n == 1: return 1 else: return fibonacci(n-1) + fibonacci(n-2) def sum_of_squares (n): result = 0 for i in range(n+1): result += fibonacci(i)**2 return result [instruction] | Write a function to compute the Fibonacci numbers and the sum of their squares. [input] |
[output] | function removeDuplicates(array) { let uniqueArray = []; for (let i = 0; i < array.length; i++) { if (uniqueArray.indexOf(array[i]) === -1) { uniqueArray.push(array[i]) } } return uniqueArray; } removeDuplicates(array); // [1, 2, 3, 4, 5, 6, 8] [instruction] | Write a JavaScript function that removes duplicates from an array. [input] | array = [1, 2, 3, 1, 4, 5, 6, 2, 8]
[output] | def is_anagram(str1, str2): # Get lengths of both strings n1 = len(str1) n2 = len(str2) # If the length of both strings are not same, # then they cannot be anagram if n1 != n2: return 0 # Sort both strings str1 = sorted(str1) str2 = sorted( [instruction] | Write a function that takes two strings and determines if they are an anagram. [input] | string1 = "converse" string2 = "conserve"
[output] | 4 2 1 8 [instruction] | Create a Java program that reads in a sentence from the user and prints out the lengths of each word in the sentence. [input] | This is a sentence
[output] | CodingSkill [instruction] | Create a Java program that reads in two strings and outputs their longest common substring. [input] | myCodingSkillzz and AnotherCodingSkill
[output] | false [instruction] | Given two linked list, write a Python program to compare them and output true if they are equal, false if not [input] | head1 -> 20 -> 40 -> 60 -> 90 head2 -> 60 -> 20 -> 90 -> 70
[output] | data: List = [] [instruction] | Create a type hint for a given parameter. [input] | Parameter: data
[output] | SELECT title, date_published FROM books WHERE author=‘Smith’ [instruction] | Write a sql query to retrieve the title and the date published of books created by the author “Smith”. [input] |
[output] | for key, value in my_dict.items(): print(f"{key}:{value}") [instruction] | Write a loop to print out all the elements in the given dictionary. [input] | my_dict = {"a": 1, "b": 2, "c": 3}
[output] | if 1 <= number <= 10: print("The number is between 1 and 10") [instruction] | Suggest a condition for the given if statement to make sure the given number is between 1 and 10. [input] | number = 8
[output] | class PatientRecord: def __init__(self, name, age, height, weight, medical_history): self.name = name self.age = age self.height = height self.weight = weight self.medical_history = medical_history [instruction] | Create a class to store data of a patient's medical record. [input] |
[output] | my_set = set(my_list) [instruction] | Suggest an expression that can be used to convert a given list to a set. [input] | my_list = [1, 2, 3, 3, 3, 4]
[output] | my_list = my_string.split(" ") [instruction] | Convert the given string to a list containing the words in the string. [input] | my_string = "This is a string"
[output] | import stl from mpl_toolkits import mplot3d from matplotlib import pyplot # Create the mesh data = stl.mesh.Mesh.from_file("house.stl") # 3D plot pyplot.figure() ax = pyplot.axes(projection ='3d') ax.add_collection3d(mplot3d.art3d.Poly3DCollection(data.vectors)) # Set size scale = data.points.fla [instruction] | 3D print a model of a house. [input] |