← 목록

Synth · CodeAlpaca일부

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

[output] | To verify that a given string is a valid email address, you should use a regular expression. A regular expression is a sequence of characters which can be used to check if the string matches a predefined pattern. The pattern for a valid email address should ensure that it contains the symbol "@" and [instruction] | How would you verify that a given string is a valid email address? [input] |

[output] | def nth_smallest(nums, n): sorted_nums = sorted(nums) return sorted_nums[n-1] print(nth_smallest([5, 8, 1, 9, 4], 3)) # Output: 5 [instruction] | Create a function in Python which takes an integer n and an unsorted list of numbers as input and returns the nth smallest number in the list. [input] | [5, 8, 1, 9, 4], 3

[output] | #include <iostream> int main() { int arr[] = {1, 2, 3, 4, 5}; int sum = 0; int n = 5; for (int i = 0; i < n; i++) { sum = sum +arr[i]; } int avg = sum/n; std::cout << "Average = " << avg; return 0; } [instruction] | Create a C++ program that computes the average of the given array elements. [input] | arr = {1, 2, 3, 4, 5}

[output] | list = ["apple", "banana", "mango", "pear"] [instruction] | Sort the following list of strings. [input] | list = ["apple", "mango", "banana", "pear"]

[output] | function add(a, b) { return a + b; } [instruction] | Write a function in JavaScript that takes two arguments and adds them. [input] |

[output] | def check_anagrams(word1, word2): return sorted(word1) == sorted(word2) word1 = 'earth' word2 = 'heart' print(check_anagrams(word1, word2)) [instruction] | Create a program that accepts two strings as input, and then check to see if the two strings are an anagram of each other. [input] | word1 = ‘earth’ word2 = ‘heart’

[output] | for num in range(0, 11, 2): print(num) [instruction] | Generate a correct for loop that prints every other number between 0 and 10. [input] |

[output] | def get_value(dictionary, integer): return dictionary[integer] dictionary = {1: "Monday", 2: "Tuesday", 3: "Wednesday"} integer = 2 print(get_value(dictionary, integer)) [instruction] | Create a function that takes a dictionary and an integer as parameters, and returns the value of the dictionary corresponding to the given integer. [input] | dictionary = {1: "Monday", 2: "Tuesday", 3: "Wednesday"} integer = 2

[output] | function reverseString(str) { var reversedStr = ''; for (var i = str.length - 1; i >= 0; i--){ reversedStr += str[i]; } return reversedStr; } console.log(reverseString(str)); // gnirtSEtsT [instruction] | Create a function in JavaScript for reversing the order of the characters in a given string. [input] | var str = "TestString";

[output] | <!DOCTYPE html> <html> <head> <title>Hello World</title> </head> <body> <b>Hello, World!</b> </body> </html> [instruction] | Create an HTML document to display "Hello, World!" in bold. [input] |

[output] | for (int i = 0; i < 10; i++) { Console.WriteLine(i); } [instruction] | Rewrite the following C# program to use a for loop instead of a while loop. [input] | int i = 0; while (i < 10) { Console.WriteLine(i); i++; }

[output] | <input type="button" value="Open New Window" onclick="window.open('https://example.com/');" /> [instruction] | Use HTML to create a button for opening a new browser window when clicked. [input] |

[output] | .parent { position: relative; } .child { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } [instruction] | Use CSS to center a div inside a parent div. [input] |

[output] | Area = 25 cm^2 Perimeter = 15.59 cm [instruction] | Compute the area and perimeter of a triangle [input] | Base: 5 cm Height: 10 cm

[output] | SELECT Job, AVG(Salary) FROM Employee GROUP BY Job [instruction] | Write a SQL query to group salary data by job type [input] | Table Employee: +----+----------+-----------+-----------+ | ID | Name | Job | Salary | +----+----------+-----------+-----------+ | 1 | John | Manager | 150000 | | 2 | Tom | Engineer | 80000 | | 3 | Nick | Manager | 120000 | | 4 | Alice | Engineer | 87

[output] | String "06/05/2019, 08/10/2020" [instruction] | Using regex, convert a string of dates from the format 'dd/mm/yyyy' to 'mm/dd/yyyy' [input] | String "05/06/2019, 10/08/2020"

[output] | <!DOCTYPE html> <html> <head> <title>Two-Column Layout</title> <style> /* define a fixed width for the entire content */ .wrapper{ width: 1000px; margin: 0 auto; } /* define the size and margin of the two columns */ .main-column{ [instruction] | Using HTML and CSS, create a simple two-columns landing page. [input] |

[output] | table = [["Name", "Age", "Gender"],["John", 20, "Male"], ["Anna", 18, "Female"],["Adam", 22, "Male"], ["Sophie", 19, "Female"]] [instruction] | Create the following table using the Python language: [input] |

[output] | total = 0 for num in nums: total += num mean = total/len(nums) print(mean) [instruction] | Come up with a python code to find the mean of a list of numbers. [input] | nums = [78, 79, 79, 79, 79, 80]

[output] | <style> .container { display: flex; justify-content: space-around; } .text { width: 45%; } </style> <div class="container"> <div class="text"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam vel tempus velit, vel auctor erat. Nam [instruction] | Create HTML code for a two-column page layout with two paragraphs in each column. [input] |

[output] | SELECT * FROM customers WHERE postal_code = '32412'; [instruction] | Write a query to find all entries in a table called customers with postal code 32412. [input] |

[output] | INSERT INTO customers (name, address, city) VALUES ('John', '123 Main Street', 'Winter Park'); [instruction] | Generate an SQL statement to add a row in the customers table where the columns are name, address, and city. [input] | name = 'John'; address = '123 Main Street'; city = 'Winter Park';

[output] | UPDATE customers SET address = '321 Market Street' WHERE user_id = 10; [instruction] | Devlop a SQL query to update the address for a user with id 10. [input] | user_id = 10 new_address = '321 Market Street'

[output] | This poet is one of America's most beloved poets. [instruction] | Edit the following piece of code to form a valid sentence. [input] | This poet is one of America's most loved poets.

[output] | model = LinearRegression() model.fit(X, y) [instruction] | Train a linear regression model on a dataset containing m columns and n rows. [input] |

[output] | The total number of weights in the network layer is 4 * 3 = 12. [instruction] | For a given network layer, compute the total number of weights. [input] | Number of input neurons: 4, Number of output neurons: 3

[output] | True. The square root of 4 is 2. [instruction] | Classify the following statement as true or false. The square root of 4 is 2. [input] |

[output] | def max_num(arr): n = arr[0] for i in range(len(arr)): if arr[i] > n: n = arr[i] return n max_num([2, 4, 8, 6]) # Output: 8 [instruction] | Implement a function which takes an array and returns the maximum number. [input] | [2, 4, 8, 6]

[output] | 4 9 16 25 36 49 [instruction] | Determine the output of the following code. for i in range(2, 8): print(i * i) [input] |

[output] | [student['name'] for student in students if student['age'] > 18] [instruction] | Convert the following SQL query to its equivalent Python expression. SELECT name FROM students WHERE age > 18 [input] |

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