[output] | def func_name(val1): # Multiply the value by 5 val2 = val1 * 5 [instruction] | Add the following comment to the following piece of code. [input] | def func_name(val1): val2 = val1 * 5
[output] | import json import os import boto3 import numpy as np import io from PIL import Image import tensorflow as tf from tensorflow.keras.models import load_model model_path = os.environ['MODEL_PATH'] model_class_name = os.environ['MODEL_CLASS_NAME'] model = load_model(model_path) def model_predict(eve [instruction] | Deploy a model server on AWS Lambda to serve a machine learning model. [input] |
[output] | def f(n): if n <= 1: return n else: a, b = 1, 1 for _ in range(n-1): a, b = b, a+b return b [instruction] | Rewrite the following recursive function such that it runs in iterative manner. [input] | def f(n): if n <= 1: return n else: return f(n-1) + f(n-2)
[output] | def binarySearch(arr, target): start = 0 end = len(arr) - 1 while start <= end: mid = (start + end)//2 if arr[mid] == target: return mid elif arr[mid] > target: end = mid - 1 else: start = mid + 1 return -1 index = [instruction] | Construct a program to find the index of a given element in a sorted array with binary search. [input] | list = [-1, 0, 2, 3, 9, 10] target = 3
[output] | SELECT * FROM exampleTable LIMIT 10; [instruction] | Create a SQL query that returns 10 rows of the table 'exampleTable'. [input] |
[output] | UPDATE exampleTable SET number = number + 10; [instruction] | Write an SQL query that updates the values in the 'exampleTable' so that all the numbers in the 'number' column are increased by 10. [input] |
[output] | string1 = 'Hello World!' string2 = 'This is a test!' [instruction] | Create two variables that store two different strings. [input] |
[output] | dict1 = dict(list1) print(dict1) [instruction] | Change the output format of the following code to convert it to a dictionary. [input] | list1 = [('a', 1), ('b', 2), ('c', 3), ('d', 4)]
[output] | <p class="highlighted">This is a test paragraph</p> [instruction] | Edit the following HTML code to add the class "highlighted" to the paragraph. [input] | <p>This is a test paragraph</p>
[output] | class Employee { // Field String name; int id; String department; // Constructor Employee(String name, int id, String department) { this.name = name; this.id = id; this.department = department; } } [instruction] | Create a class in Java called Employee with the following fields (name, ID, department). [input] |
[output] | import React from 'react'; const TwoTextInputsForm = () => { return ( <> <TextInput label="Email Address" /> <TextInput label="Password" /> </> ); }; export default TwoTextInputsForm; [instruction] | Create a React component with two TextInputs. [input] |
[output] | #!/bin/bash username=$1 password=$2 echo "Username: ${username}" echo "Password: ${password}" [instruction] | Write a Bash script to accept two command line arguments (username and password) and echo them out. [input] |
[output] | GPT-3 is an advanced AI language model that can generate sentences and paragraphs of text that are relevant and coherent to a given context. [instruction] | Generate a sentence using GPT-3. [input] | GPT-3 is an AI language model developed by OpenAI.
[output] | mylist = ['Hello', 'World', 'This', 'Is'] [instruction] | Create a list of strings in Python with 4 elements. [input] |
[output] | function s = addMatrices(A,B) s = A + B; end [instruction] | Write a MATLAB function for calculating the sum of two matrices. [input] |
[output] | In machine learning, classification is the process of predicting a class label for an input sample. A class label is a discrete value that describes a group or category that an input belongs to. The input may have multiple features, also known as attributes or predictors, that can be used in the pre [instruction] | Describe a classification problem in machine learning. [input] |
[output] | import matplotlib.pyplot as plt x_1 = [1, 2, 2, 3] x_2 = [2, 4, 3, 6] target = [1, 0, 1, 0] for i in range(len(x_1)): c = 'r' if target[i] == 1 else 'b' plt.scatter(x_1[i], x_2[i], marker='o', c=c) plt.title("Data Visualization") plt.xlabel("x_1") plt.ylabel("x_2") plt.show() [instruction] | Create a data visualization of the following data set with the target variable as red and the predictor variables as blue. [input] | data = [[1, 2, 1, 0], [2, 4, 0, 1], [2, 3, 0, 1], [3, 6, 1, 0]]
[output] | The application will allow users to store their sensor data such as location, temperature and pressure with a timestamp. The application will have a user interface to allow users to input their sensor data as well as view their stored data. The application will also have a settings page where they c [instruction] | Design an Android application to store a user's sensor data [input] |
[output] | for i in range(10,21): print(i**2) [instruction] | Create a for loop to print out the square of the numbers between 10 and 20 [input] |
[output] | import re string = "I have 2 apples and 3 bananas" words = re.findall(r'\w+', string) print(words) # Output ['I', 'have', '2', 'apples', 'and', '3', 'bananas'] [instruction] | Use RegEx to identify words in a string [input] | String: I have 2 apples and 3 bananas
[output] | length = len("Hello World") print(length) # Output 11 [instruction] | Compute the length of a string [input] | String: Hello World
[output] | class HelloWorld: def hello_world(self): print("Hello World") [instruction] | Write a class with a 'hello world' method [input] |
[output] | <html> <head> <title>Table</title> </head> <body> <table> <tr> <th>Name</th> <th>Age</th> </tr> <tr> <td>John</td> <td>20</td> </tr> <tr> [instruction] | Generate a HTML page with a table [input] |
[output] | SELECT first_name, last_name, department FROM Employee; [instruction] | Create a query in SQL that will display the first name, last name and department of all employees in the table. [input] | Employee Table: |first_name | last_name | department | -------------------------------------- | John | Doe | Marketing |
[output] | sorted_numbers = sorted(numbers) # returns a sorted list of numbers in ascending order. [instruction] | How can we sort an array of numbers in ascending order in Python? [input] |
[output] | #!/bin/bash echo "Hello, World!" [instruction] | Generate a Bash script that runs a command and print the output. [input] | Command: echo "Hello, World!"
[output] | ','.join([str(i) for i in [1, 2, 3, 4]]) # returns "1,2,3,4" [instruction] | Transform the following array into a string of comma-separated values in Python. [input] | [1, 2, 3, 4]
[output] | round_two_places <- function(x) { return (round(x, 2)) } [instruction] | write a function in R that rounds a number to two decimal places [input] |
[output] | <div> <div>New div element</div> Hello, world! </div> [instruction] | Modify the following HTML code to add a new div element inside the existing div. [input] | <div> Hello, world! </div>
[output] | SELECT name, age FROM People WHERE age > 18; [instruction] | Create a query in MySQL that returns the names and ages of all people in the table over 18. [input] | Table: People | name | age | -------------- | John | 21 |