← 목록

Synth · CodeAlpaca일부

총 20,022개 · 페이지 484/668
🔀 랜덤
불러오는 중…

[output] | SELECT * FROM inventory WHERE id = 1; [instruction] | Provide a MySQL query for selecting a record from a table called "inventory". [input] |

[output] | MyInterface myInterface = new MyInterface() { @Override public void myMethod() { // Implement your code here } }; [instruction] | Write a code in Java for creating an instance of an interface. [input] |

[output] | A set in Python is an unordered collection of unique elements. It is an efficient data structure which provides a variety of operations such as membership testing, intersection, union and difference. Sets in Python do not allow duplicate elements and also do not maintain any particular order of the [instruction] | Describe the working of a set in Python. [input] |

[output] | max_num <- function(v){ return(max(v)) } max_num(vec) [instruction] | Create a function in R that will return the maximum number in a given vector. [input] | vec <- c(3,2,5,1,4,0)

[output] | for num in nums: if num % 2 == 1: print(num) break [instruction] | Edit the following code so that it prints the first odd number in a given list. [input] | nums = [2, 3, 4, 5, 6]

[output] | let number = 7; [instruction] | Create a variable in JavaScript that holds the value of a number. [input] |

[output] | <?php class Person { public $id; public $name; public function __construct($id, $name) { $this->id = $id; $this->name = $name; } } [instruction] | Create a PHP class that has two properties, an id and name. [input] |

[output] | { "name": "John Doe", "age": 25 } [instruction] | Design a JSON object with two keys, "name" and "age". [input] |

[output] | const contact = { email: 'example@example.com', phone: '000-000-0000', website: 'www.example.com' }; [instruction] | Create a JavaScript object that stores three pieces of digital contact data, an email address, a phone number, and a website URL. [input] |

[output] | <html> <head> <title>My Website</title> </head> <body> <p>Welcome to my website</p> </body> </html> [instruction] | Update the HTML structure with a <p> tag that contains the text "Welcome to my website". [input] | <html> <head> <title>My Website</title> </head> <body> </body> </html>

[output] | CREATE TABLE people ( id INT PRIMARY KEY, name TEXT, age INT ); [instruction] | Create an SQL table with three columns called id (int type), name (text type), and age (int type). [input] |

[output] | import calendar print(calendar.monthrange(2020, 11)[1]) [instruction] | Create a Python 3 script that prints out the total number of days in the current month. [input] |

[output] | <?php class User { public $name; public $age; public $gender; public function __construct($name, $age, $gender) { $this->name = $name; $this->age = $age; $this->gender = $gender; } } [instruction] | Design a PHP class that can be used to store a user's name, age and gender. [input] |

[output] | [1,4,9,16] [instruction] | Write a JavaScript program to take an array of numbers, and return an array in which each element is the result of squaring the original. [input] | [1,2,3,4]

[output] | 1. If the tree is empty, then return 2. Find the key to be deleted in the tree and store it in a temporary node. 3. Check if the key to be deleted has zero children or one child. a. If the key has one child, then copy the child to the temporary node and delete the key. b. If the key has [instruction] | Give an algorithm to delete a key, say k, from a binary search tree (BST). [input] |

[output] | while i <= 10: # write statement here print(i) i = i + 1 [instruction] | Fill the missing statement for for-while loop based on following pseudocode: [input] | i = 1

[output] | function findProbability(situation) { // code to calculate probability return probability; } [instruction] | Write a function in JavaScript which takes a situation as a parameter and returns the probability of success. [input] | The probability of the stock market rising tomorrow.

[output] | <html> <head> <title>Form Demo</title> </head> <body> <form action="form_action.php" method="post"> <label for="username">Username:</label> <input type="text" name="username"> <input type="submit" name="submit" value="Submit"> </form> </body> </html> [instruction] | Create a HTML page with a form that takes user input and performs some action when the user clicks the submit button. [input] |

[output] | #!/bin/bash if [ -d "my_directory" ]; then echo "The directory exists" else echo "The directory does not exist" fi [instruction] | Write a Bash script to check if the directory exists or not. [input] | my_directory

[output] | SELECT name FROM customers WHERE purchase_date > NOW()-INTERVAL 1 MONTH; [instruction] | Create a MySQL query to select the names of all the customers who have made a purchase in the past month. [input] |

[output] | SELECT * FROM leaderboard ORDER BY score DESC LIMIT 5; [instruction] | Write a query to find the five highest scores in a leaderboard table. [input] |

[output] | SELECT customer_id, SUM(payment_amount) FROM payments WHERE payment_date > NOW() - INTERVAL 30 DAY GROUP BY customer_id; [instruction] | Create a SQL query to find the total payments made a group of customers in the last 30 days. [input] |

[output] | def three_sum(array, number): result_sets = [] for i in range(len(array) - 2): for j in range(i+1, len(array) - 1): for k in range(j+1, len(array)): if array[i] + array[j] + array[k] == number: result_sets.append([array[i], array[j], array[ [instruction] | Implement an algorithm to find all the sets of three numbers in an array which adds up to a given number. [input] | Array: [2, 5, 8], Number: 10

[output] | SELECT SUM(payment_amount) FROM payments WHERE payment_date > NOW() - INTERVAL 10 MONTH AND customer_id = '<customer_id>'; [instruction] | Create a query to find the total payments from one customer in the last 10 months. [input] |

[output] | def longest_common_substring(s1, s2): m = [[0] * (1 + len(s2)) for i in range(1 + len(s1))] longest, x_longest = 0, 0 for x in range(1, 1 + len(s1)): for y in range(1, 1 + len(s2)): if s1[x - 1] == s2[y - 1]: m[x][y] = m[x - 1][y - 1] + 1 [instruction] | Create an algorithm to find the longest common substring from two given strings. [input] | String1: 'Hello World', String2: 'Hey World'

[output] | SELECT * FROM table_name WHERE col1 > 5 AND col2 > 5 AND col3 > 5 AND ...; [instruction] | Write a SQL clause to get all the records from a table if the value in each column is greater than 5. [input] |

[output] | import json import xmltodict xml_data = """ <data> <records> <record name="John Smith" age="27"> <address>123 Main Street</address> </record> <record name="Jane Smith" age="18"> <address>167 King Avenue</address> </record> </records> </data> """ xml_d [instruction] | Suggest a way to convert the following XML code into JSON in Python. [input] | <data> <records> <record name="John Smith" age="27"> <address>123 Main Street</address> </record> <record name="Jane Smith" age="18"> <address>167 King Avenue</address> </record> </records> </data>

[output] | function replaceCharacter(str, char) { return str.replace(new RegExp(char,"g"), str); } let str = "Hello World"; let char = "l"; let result = replaceCharacter(str, char); console.log(result); // Output: Heooo Worod [instruction] | Create a function that takes two arguments, a string and a character, and replaces all occurrences of the character with the string in JavaScript. [input] |

[output] | def sum_of_array(arr): return sum(arr) array = [1, 2, 3, 4, 5] result = sum_of_array(array) print(resutl) # Output: 15 [instruction] | Take the following array as an argument and output the sum of all the numbers in the array using Python. [input] | [1, 2, 3, 4, 5]

[output] | SELECT AVG(column_name) FROM table_name; [instruction] | Write a SQL query to get the average of all the number from a single column. [input] |

← → 방향키로 페이지 이동 · 숫자 입력 후 Enter로 점프