[output] | import numpy as np x = np.zeros((3,2,2)) [instruction] | Create a three-dimensional array with all elements set to 0 of length 3×2×2. [input] |
[output] | SELECT * FROM employees WHERE age >= 25; [instruction] | Create a SQL query to retrieve all employees whose age is equal to or greater than 25 and write the query in the output field. [input] |
[output] | #include<iostream> using namespace std; // Function to sort given array void sort(int arr[], int n) { int i, j; for (i = 0; i < n-1; i++) // Last i elements are already in place for (j = 0; j < n-i-1; j++) if (arr[j] > arr[j+1]) sw [instruction] | Write code in C++ for sorting a given array of integers [input] | arr = [4,3,7,2,9,6]
[output] | #include <bits/stdc++.h> using namespace std; void printNextPrime(int n) { int prime; int flag; int count = 0; prime = n + 1; while (count < 10) { flag = 0; for (int i = 2; i <= sqrt(prime); i++) { [instruction] | Generate a valid C++ code to print the next 10 prime numbers [input] |
[output] | ^I like.* [instruction] | Create a regular expression to search for all sentences that start with "I like". [input] |
[output] | # Python program to multiply two matrices # 3x3 matrix X = [[12,7,3], [4 ,5,6], [7 ,8,9]] # 3x4 matrix Y = [[5,8,1,2], [6,7,3,0], [4,5,9,1]] # result is 3x4 result = [[0,0,0,0], [0,0,0,0], [0,0,0,0]] # iterate through rows of X for i in range(len(X)): # iterate [instruction] | Generate a Python program to perform matrix multiplication. [input] |
[output] | for (let i=1; i<=4; i++){ let output = ''; for (let j=4; j>=i; j--){ output += '*'; } console.log(output); } [instruction] | Create a JavaScript program to print out a pattern of some kind. [input] |
[output] | SELECT * FROM table_name WHERE column_1 != column_2; [instruction] | Create an SQL query to retrieve all records from a table where the values of two columns do not match. [input] |
[output] | def parse_json_to_dict(json_string): return json.loads(json_string) [instruction] | Write a function that parses a json string into a Python dict. [input] |
[output] | <!DOCTYPE html> <html> <head> <title>Welcome</title> </head> <body> <h1>Welcome!</h1> </body> </html> [instruction] | Write a short HTML page to display a welcome message. [input] |
[output] | int main() { std::cout << "Hello World"; return 0; } [instruction] | Edit this C++ code to remove all comments. [input] | // This is a comment // This is another comment int main() { /* This is a multiline comment */ std::cout << "Hello World"; return 0; }
[output] | An interpreter is a type of computer program that translates and executes code written in a programming language. The interpreter reads in the source code, analyses it and then executes the instructions. The interpreter executes the instructions line by line, stopping each time it encounters an erro [instruction] | Explain what an interpreter is and how it works in programming. [input] |
[output] | FUNCTION printList(list) FOR i = 0 TO list.length PRINT list[i] END FOR END FUNCTION [instruction] | Write a pseudocode for a function to print a list of integers. [input] |
[output] | list1 = ['a', 'b', 'c'] list2 = [1, 2, 3] def to_dict(list1, list2): return dict(zip(list1, list2)) [instruction] | Complete the following Python program for converting the given list into a dictionary. [input] | list1 = ['a', 'b', 'c'] list2 = [1, 2, 3] def to_dict(list1, list2): ???
[output] | import time for i in range(10, 0, -1): print(i) time.sleep(1) [instruction] | Write a code to print a count-down timer. [input] |
[output] | rows = 5 for i in range(0, rows): for j in range(0, rows-i-1): print(end=" ") for j in range(0, i + 1): print("*", end=' ') print("\r") [instruction] | Modify the given code to be able to print an asterisk pyramid as specified in the output. [input] | rows = 5 for i in range(0, rows): for j in range(0, i + 1): print("*", end=' ') print("\r")
[output] | dig <domain name> +short [instruction] | Suggest a command to find out the IP address of a domain [input] |
[output] | ls [instruction] | Suggest a command to print the contents of a directory [input] |
[output] | """ Write a code that prints Hello World """ def print_hello_world(): print('Hello, World!') if __name__ == '__main__': print_hello_world() [instruction] | Write a code that prints “Hello, World” in a new line. [input] |
[output] | """ Remove all duplicate numbers from a list """ def remove_duplicates(mylist): mylist = list(dict.fromkeys(mylist)) return mylist if __name__ == '__main__': mylist = [1, 2, 3, 1, 2, 4, 5] mylist = remove_duplicates(mylist) print(mylist) [instruction] | Code a program that takes a list and removes all the duplicate numbers. [input] | mylist = [1, 2, 3, 1, 2, 4, 5]
[output] | """ Generate a 2D list of size 5x5 with random numbers between 0 and 9 """ import random def generate_2d_list(rows, columns): matrix = [[random.randint(0, 9) for i in range(columns)] for j in range(rows)] return matrix if __name__ == '__main__': rows = 5 columns = 5 matrix = g [instruction] | Generate a 2D list of size 5x5 with random numbers between 0 and 9. [input] |
[output] | """ Write a code to create a FizzBuzz game """ def fizz_buzz(): for i in range(1, 51): if i % 3 == 0 and i % 5 == 0: print("FizzBuzz") elif i % 3 == 0: print("Fizz") elif i % 5 == 0: print("Buzz") else: print(i) if [instruction] | Write a code to create a FizzBuzz game, that prints the numbers from 1 to 50, replacing all the numbers divisible by 3 with the word "Fizz" and the numbers divisible by 5 with the word "Buzz". [input] |
[output] | if(status_code == 503): print("The 503 status code means that the web server is currently unable to handle the request due to a temporary overloading or maintenance of the server.") [instruction] | Write a code to print a human-readable description of a given HTTP status code. [input] | HTTP Status Code: 503
[output] | # Simple Interest principle = 1000; rate = 5; time = 5; # Calculate simple interest Simple_Interest = (principle*time*rate)/100; print("Simple Interest = %.2f" %Simple_Interest); [instruction] | Write a Python program to find the simple interest. [input] | principle = 1000, rate of interest = 5%, time duration = 5 years
[output] | def unique_elements(arr1, arr2): res = [] i = j = 0 while i < len(arr1) and j < len(arr2): if arr1[i] == arr2[j]: i += 1 j += 1 elif arr1[i] < arr2[j]: res.append(arr1[i]) i += 1 else: res.append(ar [instruction] | Output an array that contains all the unique elements from two input arrays [input] | arr1 = [1, 2, 3], arr2 = [2, 3, 4]
[output] | import numpy as np import keras from keras.models import Sequential from keras.layers import Dense, Activation model = Sequential() model.add(Dense(2, input_dim=2)) model.add(Activation('relu')) model.add(Dense(1)) model.add(Activation('sigmoid')) model.compile(optimizer='adam', lo [instruction] | Design a neural network to classify the outcome of a coin toss. [input] |
[output] | <span style="background-color: yellow">Hello</span> <span>world</span>! [instruction] | Generate HTML to highlight the third word in a given string. [input] | String: Hello world!
[output] | def search(arr, target): for i in range(len(arr)): if arr[i] == target: return i return -1 print("Index of 6 is", search(arr, target)) [instruction] | Design an algorithm that searches for a target element in an array [input] | arr = [1,3,5,6,7] target = 6
[output] | .container { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; } h1 { font-size: 2em; color: #0000FF; font-weight: bold; text-align: center; } [instruction] | Write a CSS code to style the following HTML [input] | <div class='container'> <h1>Welcome</h1> </div>
[output] | MOV AX, 3 ; Move 3 to AX MOV BX, 5 ; Move 5 to BX MUL BX ; Multiply AX and BX ; The result is now stored in AX [instruction] | Write an Assembly language code to calculate the result of 3*5 [input] |