← 목록

Synth · CodeAlpaca일부

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

[output] | SELECT employee_name, MAX(salary) FROM salary GROUP BY employee_name; [instruction] | Write an SQL query to calculate the maximum salary earned by each employee in the table "salary" which has columns "employee_name" and "salary". [input] |

[output] | def create_matrix(size): matrix = [] for i in range(size): row = [] for j in range(size): row.append(0) matrix.append(row) return matrix [instruction] | Write a Python function to create a matrix of given size filled with zeros. [input] | 3

[output] | class Dice { private int number; private int roll_count = 0; Random random = new Random(); public int roll() { roll_count++; number = random.nextInt(6) + 1; return number; } public int getNumber() { return number; } public int getRol [instruction] | Write a Java program to define a class for a Dice object. [input] |

[output] | <script> function showTooltip() { // code to show tooltip } document.onmouseover = showTooltip; </script> [instruction] | Create an event handler for the onmouseover event in HTML. [input] |

[output] | try { // code to be tried } catch (Exception e) { // code to be executed if exception occurs } [instruction] | How to write a try-catch statement in Java? [input] |

[output] | Creating a database table involves the following steps: 1. Connect to the desired database. 2. Create a SQL statement to define the table's structure and establish fields, field types, primary keys, etc. 3. Execute the SQL statement to create the table. 4. Close the database connection. [instruction] | Illustrate the procedure for creating a database table. [input] |

[output] | The JavaScript method split() can be used to split a string into an array of characters. It takes one parameter, the separator, which can be a single character or multiple characters. The following example splits a string into an array of characters using an empty string as a separator: var str = " [instruction] | Split a string into an array of characters in JavaScript. [input] |

[output] | def greater_than_three(string): words = string.split(" ") result = [] for word in words: if len(word) > 3: result.append(word) return result [instruction] | Write a function that expects a string as a parameter and returns all the words in the string with the length greater than three [input] | This is a test string

[output] | import requests import json def get_weather_information(city): url = 'http://api.openweathermap.org/data/2.5/weather?q={},<APIKEY>'.format(city) response = requests.get(url) data = json.loads(response.text) return data if __name__ == '__main__': print(get_weather_information(" [instruction] | Write a code to get the current weather information for a given city. [input] | city = "New York"

[output] | def find_greatest_product(lst): products = [] for i in range(len(lst)-2): for j in range(i+1, len(lst)-1): for k in range(j+1, len(lst)): products.append(lst[i] * lst[j] * lst[k]) return max(products) [instruction] | Write a Python program to find the group of three numbers in a list that has the greatest product. [input] | list = [2, 3, -2, -3, 4, -5]

[output] | import numpy as np a = [1, 2, 3, 4, 5] b = np.array([i % 2 for i in a]) [instruction] | Edit the following code to generate a boolean array with True for odd numbers and False for even numbers [input] | a = [1, 2, 3, 4, 5]

[output] | import string import random def generate_password(length): symbols = string.punctuation numbers = string.digits lowercase = string.ascii_lowercase uppercase = string.ascii_uppercase characters = symbols + numbers + lowercase + uppercase password = random.choice(symbols) [instruction] | Write a code to generate a random password containing at least one symbol, one number, one lowercase letter and one uppercase letter [input] |

[output] | string = "Hello World" def count_characters(string): count_dict = {} for char in string: if char not in count_dict: count_dict[char] = 1 else: count_dict[char] += 1 return count_dict print(count_characters(string)) [instruction] | Suggest a code to do the following task: Input a string and output the count of all the characters occuring in the string. [input] | String: "Hello World"

[output] | string = "Hello World!" first_char = string[0] last_char = string[-1] print(first_char, last_char) [instruction] | Suggest a code to extract the first and last occuring characters from a string. [input] | String: "Hello World!"

[output] | sum_of_all_blocks = 1750 [instruction] | Outpus the sum of all blocks in the following oracle database table. [input] | Table Name: orders Column Names: order_id, quantity, price Row 1: 12345, 5, 120 Row 2: 67890, 10, 150

[output] | arr = [1,2,3,4,5] print(arr[0:3]) [instruction] | Suggest a code to print the first three positions in an array. [input] | Array = [1,2,3,4,5]

[output] | list = [2,7,16,2,9] for val in list: print(val) [instruction] | Create a loop to iterate through all the values in the following list. [input] | List: [2,7,16,2,9]

[output] | def concatenate_arrays(arr1, arr2): new_array = arr1 + arr2 return new_array arr1 = [1,2,3] arr2 = [5,6] print(concatenate_arrays(arr1, arr2)) [instruction] | Implement a function to concatenate two arrays. [input] | Array 1: [1,2,3] Array 2: [5,6]

[output] | SGVsbG8gV29ybGQh [instruction] | Output the following string after applying a base64 encoding. [input] | String: Hello World!

[output] | False [instruction] | Check if the following string contains any uppercase characters and output the result. [input] | String: hello world!

[output] | complex [instruction] | Output the name of the variable type in the following expression. [input] | Expression: 5 + 6j

[output] | 12 [instruction] | Output the output of the following python script. [input] | Python Script: x = 5 y = 7 def add(x, y): return x + y add(x, y)

[output] | def gravitational_force(m1, m2, r): G = 6.67 * 10**-11 f = G*(m1*m2/r**2) return f if __name__ == '__main__': m1 = 3 m2 = 10 r = 10 force = gravitational_force(m1, m2, r) print(force) [instruction] | Write a code to calculate the gravitational force between two objects [input] | Two objects with a mass of 3kg and 10kg are separated by 10m.

[output] | SELECT * FROM table WHERE B = 'test' AND C = 'example' [instruction] | Create a SQL query to select the rows with column B equal to "test" and column C equal to "example" [input] |

[output] | def Fibonacci_sequence(length): fib_seq = [0, 1] if length == 1: return [0] elif length == 2: return fib_seq else: for i in range(2, length): fib_seq.append(fib_seq[i - 1] + fib_seq[i - 2]) return fib_seq if __name__ == '__main__': le [instruction] | Generate an algorithm that creates a Fibonacci sequence [input] |

[output] | def find_duplicates(lst): duplicate_elements = [] for element in lst: if lst.count(element) > 1 and element not in duplicate_elements: duplicate_elements.append(element) return duplicate_elements if __name__ == '__main__': lst = [1, 2, 3, 4, 5, 6, 1] print(fi [instruction] | Generate a code to identify duplicate elements in a list [input] |

[output] | public class Card { private String suit; private int number; public Card(String suit, int number) { this.suit = suit; this.number = number; } public String getSuit() { return suit; } public int getNumber() { return number; } } [instruction] | Create a Java class named "Card" to represent a standard playing card. The class should contain a constructor which takes the card's suit and number as parameters. It should also contain two getter methods to get the suit and number of the card. [input] | < noinput >

[output] | <?php for($i=0; $i<5; $i++){ echo rand(1, 10)." "; } ?> [instruction] | Generate 5 random numbers between 1 and 10 using a PHP script. [input] |

[output] | CREATE TABLE movies ( id INT NOT NULL AUTO_INCREMENT, title VARCHAR(255) NOT NULL, release_date DATE NOT NULL, PRIMARY KEY (id) ); [instruction] | Create a MySQL table named "movies" with the following columns: id, title, and release_date. [input] |

[output] | <form> <input type="email" name="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$" required> <input type="submit" value="Submit"> </form> [instruction] | Edit the following HTML form to validate an email address. [input] | <form> <input type="text" name="email"> <input type="submit" value="Submit"> </form>

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