← 목록

Synth · CodeAlpaca일부

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

[output] | def reverse_string(arr): res = '' for num in arr: res = str(num) + res return res [instruction] | Write a function that takes in an array of integers and returns a string with each number in reverse order. [input] | [1,2,3,4,5]

[output] | def merge_arrays(arr1, arr2): merged = [] i, j = 0, 0 while i < len(arr1) and j < len(arr2): if arr1[i] < arr2[j]: merged.append(arr1[i]) i += 1 else: merged.append(arr2[j]) j += 1 while i < len(arr1): merged.app [instruction] | Create an algorithm that takes in two sorted arrays and merges them together. [input] | arr1 = [1,3,5,7,9] arr2 = [2,4,6,8,10]

[output] | def start_with_a(arr): new_arr = [] for s in arr: if s[0] == 'a': new_arr.append(s) return new_arr [instruction] | Create an algorithm that takes in an array of strings and returns a new array containing only the strings that start with the letter "a". [input] | [apple, banana, alabama, arkansas]

[output] | def max_num(a,b): if a > b: return a else: return b [instruction] | Develop a program that takes in two numbers and returns the bigger one. [input] | 2 and 3

[output] | def is_anagram(s1, s2): if sorted(s1) == sorted(s2): return True else: return False [instruction] | Produce a program that takes in two strings and check if they are anagrams. [input] | silent and listen

[output] | .page-element { border-radius: 5px; } [instruction] | Write a CSS code to display a page element with a border-radius of 5px on all sides. [input] |

[output] | SELECT * FROM employees WHERE department = 1 AND salary > 50000; [instruction] | Write an SQL query to select all employees from department 1 having a salary greater than 50,000. [input] |

[output] | <form action="/register" method="post"> <div> <label>Username:</label> <input type="text" name="username"> </div> <div> <label>Password:</label> <input type="password" name="password"> </div> <div> <label>Confirm Password:</label> <input type="password" name="confir [instruction] | Write a HTML code to create a form to register a new user. [input] |

[output] | const navBar = document.createElement('nav'); navBar.innerHTML = ` <ul> <li><a href="#">Home</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> `; document.body.appendChild(navBar); [instruction] | Write a JavaScript code to create a web page with a navigation bar. [input] |

[output] | "3, 15, 27, 70, 5" [instruction] | Convert the following input into a string and output it. [input] | [3, 15, 27, 70, 5]

[output] | Please select an item from the list [instruction] | Remove all the punctuation from the following sentence and output the resulting sentence. [input] | "Please select an item from the list."

[output] | hello world [instruction] | Print the following string with all asterisks in lower case and output it. [input] | HeLLo WoRLD

[output] | def minimum_value(A): min=-float('inf') for a in A: if a < min: min = a return min print(minimum_value([6, 3, 9, 5, 8, -2, 10])) # Output: -2 [instruction] | Create a function to return the minimum value in a given array and output it. [input] | [6, 3, 9, 5, 8, -2, 10]

[output] | SELECT employee_id FROM employee_table; [instruction] | Write a SQL query to select the employee ID from the following table and output it. [input] | Employee ID Name Address 1 John Street 22 2 Janny Street 12

[output] | 00101 [instruction] | Apply the following transformation to the given bit string and output it. [input] | 10011

[output] | [1,2,3,4,5,6,7,8,9] [instruction] | Given the following matrix, output the corresponding vector form. [input] | [[1,2,3], [4,5,6], [7,8,9]]

[output] | def expression_result(expression): result = eval(expression) return result print(expression_result("2**2 + 4 - 3*6")) # Output: -6 [instruction] | Create a function to calculate the following expression and output the result. [input] | 2^2 + 4 - 3*6

[output] | SELECT * FROM Users WHERE purchase_date BETWEEN DATE_SUB(NOW(), INTERVAL 1 YEAR) AND NOW(); [instruction] | Create a SQL query that selects all customers who bought a product within the last year. [input] | Table 'Customers': | name | id | product_id | purchase_date | |------|----|------------|---------------| | John | A1 | PRD1 | 2020-02-01 | | Jane | B2 | PRD2 | 2019-02-01 | |Bruce | C3 | PRD2 | 2020-04-01 |

[output] | UPDATE Products SET price = 50 WHERE id = 1 [instruction] | Construct an SQL query to update the 'price' column of a table called 'Products' given the ‘id’ of the product. [input] | id = 1 price = 50

[output] | <input type="checkbox" name="remember" value="yes"> Remember me [instruction] | Create an HTML code that renders a checkbox with the text "Remember me" next to it. [input] |

[output] | h1 { font-family: Arial; color: #000000; font-size: 22px; } [instruction] | How would you modify the following CSS code to make its font size 22px? [input] | h1 { font-family: Arial; color: #000000; }

[output] | #!/bin/bash for i in {1..10} do ./myProgram --param $i done [instruction] | Write a Bash shell script to run a program called ’myProgram' 10 times with different parameters each time. [input] |

[output] | <input type="text" placeholder="Enter your name"> [instruction] | Write a HTML fragment to display a textbox with a placeholder "Enter your name". [input] |

[output] | div { background-color: red; } [instruction] | Construct a CSS code that adds a background color of red to the ’div' element. [input] |

[output] | function isPerfectSquare(n) { for (int i = 0; i <= n; i++) { if (i * i == n) { return true; } } return false; } [instruction] | Create a JavaScript function to check if an integer n is a perfect square. [input] |

[output] | SELECT * FROM table_name ORDER BY age DESC; [instruction] | Create a SQL query to sort data from highest to lowest in the column ‘age’. [input] |

[output] | #include<iostream> using namespace std; int main() { int n = 10; int a = 0, b = 1, c; cout << a << " " << b << " "; for (int i = 2; i < n; i++) { c = a + b; cout << c << " "; a = b; b = c; } return 0; } [instruction] | Write a C++ program to generate the Fibonnaci sequence up to the given number n. [input] | 10

[output] | F = 56.4 C = (F - 32) * 5/9 print("Fahrenheit to Celsius:", C) [instruction] | Write a Python program to convert Fahrenheit to Celsius for a temperature of 56.4F. [input] |

[output] | # shopping.py price = float(input("Enter the price: ")) discount = price * 0.10 print("Discount:", discount) [instruction] | From the provided input, create a program name "shopping.py" that prompts the user to enter a price and prints out the amount of discount the user gets. The discount rate is 10%. [input] |

[output] | # Take two strings from user str1 = input('Enter first string: ') str2 = input('Enter second string: ') # Compare strings if str1 == str2: print ("Equal strings") else : print ("Unequal strings") [instruction] | Create a program that prompts the user to enter two strings. The program will compare the two strings and, if the two strings are the same, print out "Equal strings" otherwise, print out “Unequal strings” [input] |

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