← 목록

Synth · CodeAlpaca일부

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

[output] | colors = dict(items) [instruction] | Write code to create a dictionary from a list of tuples, where each tuple consists of a color name and its value. [input] | items = [("red", "#FF0000"), ("blue", "#0000FF")]

[output] | SELECT * FROM products WHERE price > 50; [instruction] | Write an SQL query to find the list of products whose price is greater than 50. [input] |

[output] | SELECT AVG(salary) as avg_salary FROM Employees WHERE MONTH(CURDATE()) = MONTH(salary); [instruction] | Design a MySQL query to find the average monthly salary of people in the table "Employees". [input] | Table: Employees Columns: employee_id, name, salary

[output] | h1 { color: blue; } [instruction] | Create a css class to set the text color of a h1 element to blue. [input] |

[output] | square_num = lambda x: x ** 2 [instruction] | Create a python anonymous function that squares an input number. [input] |

[output] | SELECT c.customer_id, c.name FROM Customers c INNER JOIN Orders o ON c.customer_id = o.customer_id WHERE o.total > 100; [instruction] | Suggest a type of join to use to find all customers with an order total greater than $100. [input] | Table: Customers Columns: customer_id, name Table: Orders Columns: order_id, customer_id, total

[output] | for i in range(2, 16): if i % 2 == 0: print(i) [instruction] | Write a python loop to print all the even numbers between 2 and 15 (inclusive). [input] |

[output] | SELECT name, age FROM Employees WHERE age < 25; [instruction] | Create an SQL query to select the name and age of all employees that are younger than 25. [input] | Table: Employees Columns: employee_id, name, age

[output] | import math factorial = math.factorial(6) [instruction] | Write a python statement to calculate the factorial of 6. [input] |

[output] | 9 8 6 5 4 2 1 [instruction] | Print all the elements in the following array in descending order. [input] | [4, 2, 6, 8, 5, 9, 1]

[output] | struct Student { name: String, age: u32, course: String, } [instruction] | Design a data structure to store the details of a student (Name, Age, Course). [input] |

[output] | def to_title_case(string): return string.title() [instruction] | Create a method to transform a string from lowercase to title case. [input] |

[output] | list = [1, 2, 3, 4, 5, 6][:5] [instruction] | Modify the following block of code to set a maximum length of the list [input] | list = [1, 2, 3, 4, 5, 6]

[output] | def swap(a, i, j): temp = a[i] a[i] = a[j] a[j] = temp [instruction] | Write an algorithm to swap two elements a[i] and a[j] in a given array a. [input] |

[output] | d = { 'apple': 'small ', 'orange': 'medium size' } [instruction] | Update the strings stored in a dictionary, so that all strings have the same length. [input] | d = { 'apple': 'small', 'orange': 'medium size' }

[output] | class Coordinates: def __init__(self, x, y, z): self.x = x self.y = y self.z = z coordinates = Coordinates(x=10, y=20, z=30) [instruction] | Create an object to store the variables that are necessary for the following code snippet. [input] | x = 10 y = 20 z = 30

[output] | def isIncreasing(arr): for i in range(len(arr)-1): if arr[i] >= arr[i+1]: return False return True [instruction] | Make a program to determine if the elements of the array are in increasing order [input] | [3, 5, 7]

[output] | #include <iostream> #include <cmath> using namespace std; // Function to calculate bond yield float calculateYTM(float faceValue, float price, int numInterestPayments, float couponRate, float MaturityPeriod) { float guess = 0.1, ytm = 0; floa [instruction] | Generate a correct c++ program to compute the YTM of a bond [input] |

[output] | def contains_cycle(head): slow = head fast = head while fast is not None and fast.next is not None: fast = fast.next.next slow = slow.next if slow is fast: return True return False [instruction] | Suggest a code snippet to detect a cycle in a linked list [input] |

[output] | def sort_and_reverse(list): res_list = sorted(list, reverse=True) return res_list sort_and_reverse(input_list) # Output [10, 9, 8, 3, 1] [instruction] | Given a list of integers, write a function in Python to sort and reverse the list. [input] | input_list = [3, 8, 10, 1, 9]

[output] | public class CalculateSquareArea { public static double calculateArea(double sideLength) { double area = sideLength * sideLength; return area; } public static void main(String[] args) { double sideLength = 5; double area = calculateArea(sideLength); System.out.println [instruction] | Write a Java program to calculate the area of a square given the length of a side. [input] |

[output] | import string, random def generate_unique_id(stringLength=12): lettersAndDigits = string.ascii_letters + string.digits return ''.join(random.choice(lettersAndDigits) for i in range(stringLength)) unique_string = generate_unique_id() print("unique string: ",unique_string) [instruction] | Generate a unique ID string of length 12 using a Python function. [input] |

[output] | SELECT DISTINCT city FROM customer_data; [instruction] | Write a SQL query to select the distinct cities from a table of customer data. [input] |

[output] | def convertToRoman(num): val = [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ] syb = [ "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" ] [instruction] | Convert a given number to its corresponding Roman numeral. [input] |

[output] | even_numbers = [] for num in range(20, 41): if num % 2 == 0: even_numbers.append(num) print(even_numbers) # Output: [20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40] [instruction] | Generate a list of all even numbers between 20 and 40. [input] |

[output] | arr = [5, 4, 3, 2, 1] [instruction] | Find the reverse of an array in Python. [input] | arr = [1, 2, 3, 4, 5]

[output] | normal, italic, oblique, small-caps, inherit [instruction] | Output the name of the font styles available in HTML. [input] |

[output] | for (let i = 0; i < 8; i++) { // code to be executed } [instruction] | Write JavaScript code for a for loop with condition that iterates 8 times. [input] |

[output] | arr.length //4 [instruction] | Count the number of elements in an array using HTML. [input] | arr = ['a', 'b', 'c', 'd']

[output] | #include <algorithm> #include <iostream> #include <vector> std::vector<int> find_missing_numbers(const std::vector<int>::iterator begin, const std::vector<int>::iterator end) { int n = end - begin; int total_sum = (n + 2)*(n + 1)/2; int missing_sum = 0; [instruction] | Find two missing numbers in an array in C++. [input] | arr = [1, 3, 6, 5, 8, 9, 10]

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