[output] | "Hello World" [instruction] | Take two strings and concatenate them. [input] | "Hello " and "World"
[output] | number = 0 while number <= 10: print(number) number += 1 [instruction] | Create a while loop that runs while a number is less than or equal to 10. [input] |
[output] | 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97. [instruction] | Find and list all the prime numbers between 0-100 [input] |
[output] | O(n^2). [instruction] | Assuming all operations in the code are O(1), find the Big O complexity of the code. [input] | for (int i = 0; i < n; i++) for (int j = 0; j < i ; j++) sum += a[i] + b[j];
[output] | # A simple python script print("Hello, World!") [instruction] | Create and run a Python script that prints "Hello, World!" [input] |
[output] | 590 and 204. [instruction] | Using Regular Expressions, search for all 3-digit occurrences in the given text. [input] | text = "The ship had a 590 foot cargo hold, filled with 204 tons of goods."
[output] | <div style="font-weight: bold;">Hello World</div> [instruction] | Apply the given CSS style to the HTML element. [input] | <div>Hello World</div> css: font-weight: bold;
[output] | SELECT customer.name, orders.order_name FROM customer INNER JOIN orders ON customer.id = orders.customer_id; [instruction] | Write a SQL query to display the names of all customers and their orders. [input] |
[output] | import random random.seed(32) unique_id = random.randint(100000000, 999999999) print("unique 8-digit number:", unique_id) [instruction] | Generate a unique 8-digit number using the Python Random module [input] |
[output] | The symbol "$" occurs 1 time in the given text. [instruction] | Find all instances of the given symbol in the text. [input] | text = "The company has a $1 billion budget" symbol = "$"
[output] | from matplotlib.pyplot import imshow from matplotlib import pyplot as plt from numpy import array # Convert data to numpy array data_array = array(data) # Plot heatmap fig, ax = plt.subplots() im = ax.imshow(data_array) fig.colorbar(im) plt.show() [instruction] | Using the provided data, generate a heatmap that contains the temperature readings for each hour. [input] | data = [[7,15,22], [2,7,23], [9,12,25]]
[output] | The sum of all odd numbers between 1-100 is 2500. [instruction] | Find the sum of all odd numbers between 1-100. [input] |
[output] | my_array = [1, 1, 2, 1, 3, 1] [instruction] | Update the given array to replace all the zeroes with ones. [input] | my_array = [1, 0, 2, 0, 3, 0]
[output] | The output of the code when input is 3 is [0, 1, 1]. [instruction] | Find the output of the following code when input is 3. [input] | def get_result(n): fib = [0, 1] for i in range(2, n): fib.append(fib[i-2] + fib[i-1]) return fib
[output] | ^\S(.*\S)?$ [instruction] | Write a regular expression that accepts a string with one or more spaces. [input] |
[output] | function findSecondA(arr){ let count=0; let index; for(let i=0; i<arr.length; i++){ if(arr[i] == 'a'){ count++; } if(count == 2){ index = i; break; } } return index; } [instruction] | Using the given array, create a function to find the index of the second "a" in the array. [input] | let arr = [1, 'a', 2, 'b', 3, 'a'];
[output] | for item in my_set: print(item) [instruction] | Write a Python code snippet for printing the items in a given set. [input] | my_set = {1, 3, 5, 7, 9}
[output] | my_list = [number for number in range(1, 11)] [instruction] | Create a list of numbers from 1 to 10 using list comprehension. [input] |
[output] | The shell command 'ls -l' will list all the files in the current working directory in long form. This means the output will include the file permissions, owner, group, size, modified date, and the name of the file. [instruction] | Analyze the output of the following shell command. [input] |
[output] | In Linux, you can open a new terminal window using the command line by using the "xterm" command or using the shortcut "Ctrl + Alt + T". [instruction] | How to open a new terminal window in Linux? [input] |
[output] | In Windows, in the command line enter arp -a to get a list of all the devices and their respective IPs connected to the network. [instruction] | Request a list of all the devices connected to a network using the command line in Windows. [input] |
[output] | Signed integers in C language can store both negative and positive values (from -2^31 to 2 ^31 - 1). Unsigned integers in C language can only store positive values (from 0 to 2^32 - 1). This means that a signed int is half the size of an unsigned int. It also means that a signed int ranges from -2^3 [instruction] | What is the difference between an unsigned int and a signed int in C language? [input] |
[output] | In order to run a python script from the command line, the "@python" command and the path to the file should be used. For example, to execute the "input.py" file, the command would be "@python C:\Path\input.py". [instruction] | How do you run a Python script from the command line? [input] |
[output] | numbers.pop(0) [instruction] | Write code to remove the first item from a list of integers in Python. [input] | numbers = [2, 3, 4, 5]
[output] | def parse_query_string(url): # extracting the query string query_str = url.split("?")[1] query_param = query_str.split("&") # create dictionary from query string result_dict = {} for q in query_param: key, value = q.split('=') result_dict[key] = value re [instruction] | Write a method to parse a URL query string. [input] | url: https://www.example.com/?sort=alphabetical&order=asc&search=something
[output] | <html> <head> <title>My HTML Document</title> </head> <body> <h1>My website</h1> <div> <p>This is my website content.</p> </div> </body> </html> [instruction] | Generate a valid HTML document. [input] |
[output] | def hamming_distance(str1, str2): # length of the strings must be equal if len(str1) != len(str2): return -1 distance = 0 for i in range(len(str1)): if str1[i] != str2[i]: distance += 1 return distance [instruction] | How do you calculate the hamming distance between two strings? [input] | str1 = "abc" str2 = "abd"
[output] | mylist = [x.lower() for x in mylist] print(mylist) [instruction] | Change all the values in a list to lowercase. [input] | mylist = ['Dog', 'Cat', 'Rabbit']
[output] | set3 = set1.union(set2) print(set3) [instruction] | How would you find the union of two sets? [input] | set1 = {1,2,3,4} set2 = {3,4,5,6}
[output] | import random def get_random_port(): return random.randint(1, 65535) random_port = get_random_port() print(random_port) [instruction] | Develop a code to generate a random port number in the range of 1 to 65535. [input] |