← 목록

Synth · CodeAlpaca일부

총 20,022개 · 페이지 1/668
🔀 랜덤 처음으로
불러오는 중…

[output] | SELECT customers.name FROM orders JOIN customers ON customers.id = orders.customer_id WHERE orders.amount > 100; [instruction] | Write a MySQL query to find the names of all customers who have placed an order for more than $100. [input] |

[output] | for(let item of arr) { console.log(item); } [instruction] | Write a code snippet to print out each item in a given array. [input] | [7, 4, 10, 3]

[output] | string = "The quick brown fox jumped over the lazy dog" substring = "brown" new_string = string.replace(substring, "") print(new_string) # Output: The quick fox jumped over the lazy dog [instruction] | Generate a Python code to remove the given substring from the string. [input] | String: "The quick brown fox jumped over the lazy dog" Substring: "brown"

[output] | <table> <tr> <th>Country</th> <th>Population</th> </tr> <tr> <td>China</td> <td>1449107485</td> </tr> <tr> <td>India</td> <td>1369153466</td> </tr> <tr> <td>USA</td> <td>330765152</td> </tr> </table> [instruction] | Generate an HTML table to display the countries and their population. [input] | Country | Population China | 1449107485 India | 1369153466 USA | 330765152

[output] | He was very contentious throughout the meeting. [instruction] | Replace the underlined phrase with a single word that means the same thing: He was very argumentative throughout the meeting. [input] |

[output] | #include <iostream> #include <vector> using namespace std; class Stack { vector<int> items; public: void push(int item) { items.push_back(item); } int pop() { int data = items.back(); items.pop_back(); return data; } [instruction] | Write C++ code to implement a stack data structure. [input] |

[output] | def decimalToBinary(n): return bin(n).replace("0b", "") decimal_num = 7 binary_num = decimalToBinary(decimal_num) print(binary_num) # 111 [instruction] | How would you convert a number from decimal to binary using bitwise operators? [input] |

[output] | def print_list_elements(list): if len(list)>0: for element in list: print(element) else: print("The list has no elements.") #This edited code will print a statement if the given list has no elements. [instruction] | Edit the following code to print a statement if the given list has no elements. [input] | def print_list_elements(list): if len(list)>0: for element in list: print(element)

[output] | SELECT * FROM order_records WHERE orders BETWEEN 1000 AND 3000; [instruction] | Construct an SQL query that returns records from a table with an "orders" field that contains any number between 1000 and 3000. [input] | Table: order_records

[output] | question <- "Do you have a pet?" binary_input <- ifelse(question == "Do you have a pet?", 1, 0) print(binary_input) # prints 1 [instruction] | Create an R code to convert yes/no questions to binary input. [input] | Do you have a pet?

[output] | int itemAtIndex3 = arr[3]; // itemAtIndex3 is equal to 19 [instruction] | Can you retrieve the item at index 3 from the following array? [input] | int[] arr = {11, 30, 45, 19, 20, 60};

[output] | even_nums = [] for num in range(0, 21): if num % 2 == 0: even_nums.append(num) print(even_nums) [instruction] | Output an array of even numbers from 0 to 20 using a for loop in Python. [input] |

[output] | import pandas as pd # Input Data df = pd.DataFrame({'Name': ['John','Jane','Maria'], 'Age': [25, None, 30]}) # Filter the Data filtered_df = df.loc[df['Age'].notnull()] print(filtered_df) [instruction] | Write a Python function using the Pandas library to filter out the rows with a missing value in the specified column. [input] | Dataframe: Name Age John 25 Jane Maria 30 Column Name: Age

[output] | SELECT * FROM orders WHERE tax_rate = 0.07; [instruction] | Write a query in MySQL for finding records with a specific tax rate. [input] | Tax Rate: 7%

[output] | if (number > 0): print("Welcome to my house") else: print("Goodbye") [instruction] | Write a conditional statement that prints "Welcome to my house" when the user enters a positive number and "Goodbye" when the user enters a negative number. [input] | number = 4

[output] | def rotateMatrix(matrix): N = len(matrix[0]) for i in range(N // 2): for j in range(i, N - i - 1): temp = matrix[i][j] matrix[i][j] = matrix[N - 1 - j][i] matrix[N - 1 - j][i] = matrix[N - 1 - i][N - 1 - j] matrix[N - 1 - i][N - 1 - j] [instruction] | Given a matrix, write a program to rotate it by 90 degrees clockwise. [input] | matrix = [[1,2,3], [4,5,6], [7,8,9]]

[output] | <form action="/contact.php" id="contactForm" class="contactForm"> <input type="text" name="name"> <input type="email" name="email"> <input type="submit" value="Submit"> </form> [instruction] | Using the code snippet given below, add a class called contactForm to the HTML form. [input] | <form action="/contact.php" id="contactForm"> <input type="text" name="name"> <input type="email" name="email"> <input type="submit" value="Submit"> </form>

[output] | SELECT SUM(RentalFee) FROM Rentals WHERE RentalDate >= DATE_SUB(CURDATE(),INTERVAL 7 DAY); [instruction] | Write SQL query to calculate total rental fees for customers who have rented a movie in the past 7 days. [input] | Table Name: "Rentals" Columns: "CustomerId", "RentalDate", "RentalFee"

[output] | """ Modify the code to display a simple error message whenever a parameter is passed as string """ function sum(a, b) { // Test if either a or b is a string if (typeof a === 'string' || typeof b === 'string') { throw new Error('Parameters must be numbers'); } return a + b; } [instruction] | Modify the code to display a simple error message whenever a parameter is passed as string. [input] | function sum(a, b) { return a + b; }

[output] | NSMutableArray *names = [NSMutableArray array]; [instruction] | Write an Objective-C statement to create an empty array to hold names. [input] |

[output] | def clean_binary_data(binary_data): return ''.join(map(lambda x:chr(x) if 32 <= x <= 126 else '', binary_data)) [instruction] | Design a function to clean binary data (strings) by keeping only printable characters. [input] | binary_data = b'h\x9Fl\x04o'

[output] | SELECT COUNT(*) FROM people WHERE year_of_birth < 1992; [instruction] | Develop a SQL query to count the number of people who are born before 1992. [input] |

[output] | SELECT Name, Title FROM Employees WHERE Department = 'Marketing'; [instruction] | Write a SQL query that finds, in a table of employees, the names and titles of all employees who work in the Marketing department. [input] | Table: Employees | EmployeeID | Name | Department | Title | |------------|------|--------------|-------------------------| | 1 | Bob | Marketing | Senior Marketing Manager | | 2 | Joe | Finance | Financial Analyst | | 3 | Jane | Marketi

[output] | $('#main').click(function(event) { console.log('The element was clicked!'); }); [instruction] | Rewrite the following JavaScript code to jQuery. [input] | document.querySelector('#main').addEventListener('click', event => { console.log('The element was clicked!') })

[output] | CREATE TABLE users ( user_id INT NOT NULL AUTO_INCREMENT, first_name VARCHAR(50) NOT NULL, last_name VARCHAR(50) NOT NULL, username VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, PRIMARY KEY (user_id) ); CREATE TABLE accounts ( account_id INT NOT NULL AUTO_INCREMENT, user_id INT NOT [instruction] | Design a database schema for an online banking system. [input] |

[output] | pattern = r"^[0-9]+$" [instruction] | Create a regular expression to detect if a string contains only digits (start with 0 to 9). [input] |

[output] | 3xy + 12x [instruction] | Reduce the following equation by applying the distributive property. [input] | 3x(y + 4)

[output] | let upperCaseStr = ""; for (let char of str) { upperCaseStr += char.toUpperCase(); } console.log("Uppercase string:", upperCaseStr); [instruction] | Write code for converting each character of a string to uppercase. [input] | String: "gpt is great"

[output] | def find_average(arr): sum = 0 for num in arr: sum += num return sum/len(arr) arr = [1, 2, 3, 4, 5] print(find_average(arr)) # 3.0 [instruction] | Compute the average value in an array of integers [input] | [1, 2, 3, 4, 5]

[output] | def filter_array(arr, num): return [x for x in arr if x > num] [instruction] | Create a function that filters an array for all numbers greater than the given number. [input] |