[output] | _a [instruction] | Create an identifier in Python that starts with an underscore followed by the letter 'a'. [input] |
[output] | SELECT Name FROM Students; [instruction] | Query an SQL table called "Students" to get the names of all the enrolled students. [input] |
[output] | The factorial of 8 is 403 [instruction] | Calculate the factorial of 8. [input] |
[output] | even_numbers = [2, 4] odd_numbers = [1, 3, 5] [instruction] | Segregate a given array of numbers into even and odd. [input] | [1, 2, 3, 4, 5]
[output] | Hello = Hola Thank You = Gracias Goodbye = Adiós [instruction] | Translate the following words into Spanish: "Hello", "Thank You", and "Goodbye". [input] |
[output] | void swapFirstLast(int arr[], int n) { int temp = arr[0]; arr[0] = arr[n - 1]; arr[n - 1] = temp; } [instruction] | Write a function in C that swaps the first and last value of a given array. [input] | [1, 2, 3, 4]
[output] | In Python, you can retrieve the 3rd element of a set by using the index operator []. The 3rd element of a set can be accessed by using the syntax set[2]. Note that the indexing in Python starts from 0, so the 3rd element will have index 2. [instruction] | How do you retrieve the 3rd element of a set in Python? [input] |
[output] | The command line to create a tar archive in Linux is "tar -cvf <archive name>.tar <target directory>". This will create a tar archive with the given name from the provided target directory. [instruction] | What is the command line to create a tar archive in Linux? [input] |
[output] | def max_value(num1, num2, num3): max_num = max(num1, num2, num3) return max_num [instruction] | Create a function in Python that takes three numerical inputs and returns the maximum value. [input] |
[output] | puts "Happy Tuesday!" [instruction] | Construct a Ruby program that prints "Happy Tuesday!" [input] |
[output] | let date = new Date(); document.write(date); [instruction] | Construct a JavaScript program that displays the current date and time. [input] |
[output] | SELECT AVG(rating) FROM items; [instruction] | Write a MySQL query to calculate the average rating of the items in the “items” table. [input] |
[output] | print("Hello World!") [instruction] | Construct a Swift program to display 'Hello World!'. [input] |
[output] | SELECT customer_name FROM customers JOIN orders ON customers.customer_id = orders.customer_id WHERE orders.price > 1000; [instruction] | Create a SQL query to select the customers that have placed orders of price greater than 1000. [input] |
[output] | int x = 5; int y = 6; int sum; sum = x + y; NSLog(@"Sum of x and y is: %d", sum); [instruction] | Design a Objective C program to find the sum of two numbers. [input] | int x=5; int y=6;
[output] | <h1>This is a heading.</h1> [instruction] | Design a HTML program to display a heading. [input] |
[output] | CREATE TABLE online_store ( id INT(11) AUTO_INCREMENT PRIMARY KEY, item_type VARCHAR(150) NOT NULL, item_location VARCHAR(150) NOT NULL, price INT NOT NULL, item_name VARCHAR(150) NOT NULL ); [instruction] | Construct a MySQL table for an online store. [input] | Table name: online_store Fields: item_type (string), item_location (string), price (integer), item_name (string).
[output] | rgb(241, 148, 138) [instruction] | Convert the given hexadecimal color code to RGB format. [input] | #F1948A
[output] | for i in range(0, 6): for j in range(0, i + 1): print("* ", end="") print("\r") [instruction] | Write a Python program to print the right angled triangle using asterisk. [input] |
[output] | CREATE TABLE my_table ( id INT(11) AUTO_INCREMENT PRIMARY KEY, column_1 VARCHAR(150) NOT NULL, column_2 INT NOT NULL, column_3 VARCHAR(150) NOT NULL, column_4 INT NOT NULL ); [instruction] | Create a table in the given MySQL database with 4 columns. [input] | Database Name: my_db Table Name: my_table Fields: column_1 (string), column_2 ( integer), column_3 (string), column_4 (integer).
[output] | * { color: #0000ff; } [instruction] | Write a CSS rule to set a blue color for all text elements. [input] |
[output] | def get_string(input, type): if type == 'int': return str(int(input)) elif type == 'float': return str(float(input)) elif type == 'str': return str(input) [instruction] | In the following code, modify the function to take the type of an argument as an input and perform the necessary conversion before returning the result. [input] | def get_string(input): return str(input)
[output] | def dataset_to_matrix(dataset): matrix = [[x, y, z] for x, y, z in dataset] return matrix [instruction] | Write a function to transform a dataset into a matrix, where rows represent data points followed by their labels. [input] | dataset=[(2, 3, 1), (5, 4, -1), (1, 8, 1)]
[output] | import random def generate_random_sequence(length): sequence = [] for i in range(length): sequence.append(random.choice([0, 1])) return sequence [instruction] | Write a function to create a random sequence of 0s and 1s. [input] |
[output] | def generate_fibonacci_sequence(n): sequence = [0, 1] for i in range(2, n): sequence.append(sequence[i-1] + sequence[i-2]) return sequence [instruction] | Generate an array containing the next n numbers in the Fibonacci sequence. [input] |
[output] | def list_to_dict(list_of_tuples): return dict(list_of_tuples) [instruction] | Create a dictionary from a list of tuples, where the key is the first element of the tuple and the value is the second element of the tuple. [input] | list_of_tuples = [('key1', 'val1'), ('key2', 'val2'), ('key3', 'val3')]
[output] | def list_to_dict(elements): return {el: i for i, el in enumerate(elements)} [instruction] | From the given list, create a dictionary where keys will be the elements and the values will be their corresponding indices. [input] | elements = ["one", "two", "three", "four"]
[output] | multiples_of_5 = [x*5 for x in range(0,11)] [instruction] | Using list comprehension, create a list which contains multiples of 5 from 0 to 50 (inclusive). [input] |
[output] | def print_greater_value(num1, num2): if num1 > num2: print(num1) else: print(num2) [instruction] | Create a function that takes in two integer values and prints out the larger one. [input] |
[output] | total = 0 (1..10).each do |num| total += num end puts total [instruction] | Generate a Ruby loop to find the sum of numbers 1 to 10. [input] |