← 목록

Synth · CodeAlpaca일부

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

[output] | <html> <head> <title>Data Table</title> </head> <body> <table> <tr> <th>Name</th> <th>Age</th> <th>Occupation</th> </tr> <tr> <td>John</td> <td>32</td> <td>Engineer</td> </tr> <tr> <td>Max</td> <td>28</td [instruction] | Create a HTML page that contains a table with given data. [input] | <html> <head> <title>Data Table</title> </head> <body> <table> <tr> <th>Name</th> <th>Age</th> <th>Occupation</th> </tr> <tr> <td>John</td> <td>32</td> <td>Engineer</td> </tr> <tr> <td>Max</td> <td>28</td

[output] | [a, b] = [b, a]; [instruction] | Write a JavaScript statement to switch the value of two variables. [input] |

[output] | margin-left: 1000px; [instruction] | Write a CSS rule to give a 1000px margin to the left of an element. [input] |

[output] | public class MaxNumber { public static int getMaxNumber(int[] arr) { int max = arr[0]; for (int i = 1; i < arr.length; i++) { if (arr[i] > max) { max = arr[i]; } } return max; } } [instruction] | Generate a Java program to get the maximum number from a given array. [input] |

[output] | SELECT DISTINCT country FROM countries; [instruction] | Construct a SQL query to list the unique countries from table countries. [input] |

[output] | SELECT COUNT(DISTINCT city_name) FROM cities; [instruction] | Construct a SQL query to count the number of distinct cities from table cities. [input] |

[output] | #include <iostream> #include <vector> #include <string> int main() { std::vector<std::string> names; names.push_back("John"); names.push_back("Paul"); names.push_back("Adam"); names.push_back("Linda"); names.push_back("James"); return 0; } [instruction] | Create a C++ vector of strings containing names. [input] |

[output] | SELECT AVG(age) FROM users; [instruction] | Construct a query to calculate the average age of all users from table users. [input] |

[output] | public static boolean isValidEmail(String email){ String emailRegex = "^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$"; Pattern pat = Pattern.compile(emailRegex); if (email == null) return false; return pat.matcher(email).matches(); } [instruction] | Given a string, write a Java program to verify if it is a valid email address. [input] |

[output] | def mergeLists(l1, l2): dummy = curr = ListNode(0) while l1 and l2: if l1.val < l2.val: curr.next = l1 l1 = l1.next else: curr.next = l2 l2 = l2.next curr = curr.next curr.next = l1 or l2 return dummy.nex [instruction] | How would you merge two sorted linked lists into one? [input] |

[output] | Positive sentiment. [instruction] | Analyze the sentiment of the sentence "I am so delighted". [input] |

[output] | Exceptions can be handled in Java using try-catch blocks. A try-catch block includes a try statement followed by the catch clauses. The try statement defines the code which can throw an exception, and the catch clause defines an exception handler which handles the exception thrown by the try stateme [instruction] | Explain how to handle exceptions using try-catch block in Java. [input] |

[output] | 5040 [instruction] | Compute the factorial of the number 7. [input] |

[output] | CREATE DATABASE mydb; CREATE TABLE employees ( employee_id INTEGER PRIMARY KEY, name VARCHAR(50), department_id INTEGER ); CREATE TABLE departments ( department_id INTEGER PRIMARY KEY, name VARCHAR(50) ); [instruction] | Create a SQLite database named "mydb" with two tables "employees" and "departments". [input] |

[output] | [1, 2, 4, 5] [instruction] | Remove the duplicates from the array [1, 2, 2, 4, 5, 5]. [input] | [1, 2, 2, 4, 5, 5]

[output] | class Student(): def __init__(self, name, age, year): self.name = name self.age = age self.year = year def get_name(self): return self.name def get_age(self): return self.age def get_year(self): return self.year [instruction] | Construct a Python class to save details of student. [input] |

[output] | def compare_num(a, b): return -1 if a < b else 0 if a == b else 1 [instruction] | Change the following code to use the ternary operator. [input] | def compare_num(a, b): if a < b: return -1 elif a == b: return 0 else: return 1

[output] | def maxDepth(self, root: TreeNode): if root is None: return 0 leftDepth = self.maxDepth(root.left) rightDepth = self.maxDepth(root.right) return max(leftDepth, rightDepth) + 1 [instruction] | Given a binary tree, find the height of the tree. [input] |

[output] | Insertion sort is an in-place comparison sort algorithm that works by iterating through the input array, removing one element at a time and inserting it in the correct position in the sorted array. It is a comparison-based algorithm that blocks an element from its position until it finds the correct [instruction] | Describe a sorting algorithm that works by putting an algorithm that works by putting elements in the right place. [input] |

[output] | class PriorityQueue(): def __init__(self): self.elements = [] def is_empty(self): return len(self.elements) == 0 def enqueue(self, item, priority): self.elements.append((item, priority)) def dequeue(self): max_priority_index = 0 [instruction] | Implement a priority queue. [input] |

[output] | def reverseList(node): prev = None while (node != None): next = node.next node.next = prev prev = node node = next return prev [instruction] | Reverse a linked list. [input] |

[output] | def is_even(num): if(num % 2 == 0): return True else: return False [instruction] | Write a function that returns 'true' if the number is an even number, and 'false' otherwise. [input] |

[output] | #example { color: red; } [instruction] | Create a css style that changes the color of the text in the div with the ID "example". [input] |

[output] | for i in range(len(array)-1, -1, -1): print(array[i]) [instruction] | Create a for loop to iterate through the given array from the last index to the first. [input] | array = [1, 2, 3, 4, 5]

[output] | class Animal: pass class Dog(Animal): pass [instruction] | Create two classes, "Animal" and "Dog", in which the "Dog" class inherits from the "Animal" class. [input] |

[output] | import json request_payload = json.dumps(data) [instruction] | Using the given code, construct a json request payload. [input] | data = { "name": "John Doe", "age": 30 }

[output] | import matplotlib.pyplot as plt months = [x[0] for x in data] values = [x[1] for x in data] plt.bar(months, values) plt.xlabel("Month") plt.ylabel("Number") plt.show() [instruction] | Visualize the given data using a bar chart. [input] | data = [['January', 10], ['February', 15], ['March', 20], ['April', 17]]

[output] | class Person: def __init__(self, name, age): self.name = name self.age = age [instruction] | Create a class "Person" and add two instance variables "name" and "age". [input] |

[output] | for x in array: if x % 2 == 0: print(x) [instruction] | Iterate through the given array and print the even numbers. [input] | array = [1, 2, 3, 4, 5, 6]

[output] | document.querySelector('p').innerHTML = 'Hello World'; [instruction] | Using DOM manipulation, replace the paragraph text with "Hello World". [input] | <p>My first web page</p>

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