[output] | The purpose of a user interface (UI) is to provide an efficient and user-friendly interface for interacting with a device or application. It includes visual components like forms, menus, buttons and other tools that allow users to input information, perform tasks and receive output. [instruction] | What is the purpose of a user interface (UI)? [input] |
[output] | Hyperparameter tuning is the process of selecting the optimal hyperparameters of a machine learning algorithm. Hyperparameters are static values that define the behaviors and characteristics of the algorithm, such as learning rate, activation functions and regularization terms. An example of hyperpa [instruction] | Explain what is hyperparameter tuning and provide a basic example. [input] |
[output] | def concatenate_lists(list1, list2): return list1 + list2 [instruction] | Generate a simple python function to concatenate two lists. [input] |
[output] | def query_mongo(collection, field_name, field_value): query = {field_name: field_value} documents = collection.find(query) return list(documents) [instruction] | Query a MongoDB to get all documents with a certain field value. [input] |
[output] | CREATE TABLE user_preferences ( user_id INTEGER, preference VARCHAR (50) ); [instruction] | Create a database table using SQL to store user preferences. [input] |
[output] | def compare_lists(list1, list2): return sorted(list1) == sorted(list2) [instruction] | Write a python function to detect if two lists contain the same items in different order. [input] |
[output] | SELECT * FROM products WHERE purchase_date > (NOW() - INTERVAL 1 MONTH) [instruction] | Write a SQL query to get the products that have been purchased in the last month [input] |
[output] | <html> <head> <title>Query Results</title> </head> <body> <table> <thead> <tr> <th>Field1</th> <th>Field2</th> <th>Field3</th> </tr> </thead> <t [instruction] | Create an HTML page displaying the results from a given query. [input] |
[output] | package main import ( "fmt" "os" "strconv" ) func main() { if len(os.Args) < 2 { fmt.Println("Usage : go run main.go <num>") os.Exit(1) } num, _ := strconv.Atoi(os.Args[1]) sq := num * num fmt.Println("Square of ", os.Args[1], "is", sq) } [instruction] | Create a Go program to read an integer value from the command line and calculate its square. [input] |
[output] | def print_dict(dictionary): for key, value in dictionary.items(): print(f"{key}: {value}") [instruction] | Code a function that takes a dictionary as a parameter and prints out the key-value pairs. [input] |
[output] | 28 [instruction] | Output the second maximum number in a list. [input] | [9, 4, 57, 28, 24, 10]
[output] | even_array = [4, 28, 24, 10] odd_array = [9, 57] [instruction] | Separate the given array of numbers into two new arrays, where one array contains even numbers and the other array contains odd numbers. [input] | [9, 4, 57, 28, 24, 10]
[output] | !dlroW olleH [instruction] | Create a program to print out a given message in reverse. [input] | Hello World!
[output] | This string challenge [instruction] | Print the words in the given string that are longer than 5 characters. [input] | "This is a test string for a coding challenge"
[output] | 7 [instruction] | Count the number of sub strings of length 3 that are present in the sentence. [input] | This is an example sentence
[output] | 53 [instruction] | Create a program to find the maximum difference between two elements in an array. [input] | [9,4,57,28,24,10]
[output] | [0, 1, 1, 2, 3, 5, 8, 13] [instruction] | Generate the first 8 Fibonacci numbers after a starting number of 0. [input] |
[output] | def is_symmetrical(str1, str2): for i in range(0, len(str1)): if str1[i] != str2[-i-1]: return False return True [instruction] | Create a function to determine if two strings are symmetrical. [input] |
[output] | def fibonacci_sum(number): fib_list = [0,1] while True: next_number = fib_list[-1] + fib_list[-2] if next_number > number: break fib_list.append(next_number) return sum(fib_list[:-1]) [instruction] | Write a code segment that manipulates a Fibonacci sequence until the sum is greater than a given number. [input] | 10
[output] | def avg(num1, num2, num3): return (num1 + num2 + num3) / 3 [instruction] | Write a method to calculate the average of three numbers in Python. [input] |
[output] | #!/bin/bash today=$(date +"%A") echo "Today is $today" [instruction] | Create a shell script that prints out the day of the week based on the current day. [input] |
[output] | concat_strings <- function(string1, string2, length) { return( substr(paste0(string1,string2), 1, length) ) } [instruction] | Code a function in R which concatenates two strings of a given length and returns the resulting string. [input] | let string1 = "Hello"; let string2 = "World"; let length = 10;
[output] | def reverse_array(arr): return arr[::-1] [instruction] | Design a function that takes an array of length n as an argument, and returns an array of the same length, where the output array consists of the elements of the input array in reverse order. [input] | [1, 2, 3, 4, 5]
[output] | <form action="" method="post"> <input type="text" name="email" placeholder="Enter your email address"> <input type="submit" value="Submit"> </form> [instruction] | Create an HTML form with a text field for user to enter an email address and a submit button. [input] |
[output] | for i in range(101): if i % 3 == 0 and i % 5 == 0: print(i) [instruction] | Design a Python program to print all numbers between 0 and 100 that are divisible by 3 and 5. [input] |
[output] | <!DOCTYPE html> <html> <head> <title>Timer</title> </head> <body> <h1>Timer</h1> <p> <span id="minutes">00</span>:<span id="seconds">00</span> </p> <script> let minutes = 0; let seconds = 0; setInter [instruction] | Design an HTML page to display a timer with minutes and seconds. [input] |
[output] | public static boolean compareStrings(String s1, String s2) { return s1.equals(s2); } [instruction] | Create a Java program to compare two strings and check if they are equal or not. [input] | String s1 = "Hello"; String s2 = "World";
[output] | SELECT emp.name, emp.salary FROM employees emp JOIN (SELECT dept, MAX(salary) max_salary FROM employees GROUP BY dept) temp ON emp.dept = temp.dept AND emp.salary = temp.max_salary; [instruction] | Design a SQL query to get the salary of employee who has the maximum salary in each department. [input] |
[output] | def exponent(x,y): if(y == 0): return 1 elif (int(y % 2) == 0): y = int(y / 2) return exponent(x, y) * exponent(x, y) else: return (x * exponent(x, int(y / 2)) * exponent(x, int(y / 2))) exponent(5,3) # Output: 125 [instruction] | Create a function to calculate the exponent of a given number x raised to power y. [input] |
[output] | SELECT item_name, COUNT(*) AS NumberOfOrders FROM orders GROUP BY item_name ORDER BY NumberOfOrders DESC LIMIT 1 [instruction] | Write a query in MySQL to find the most popular item in a store [input] |