← 목록

Synth · CodeAlpaca일부

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

[output] | DELETE FROM users WHERE name IN ('John', 'David'); [instruction] | Construct an SQL query to delete records from the "users" table that have a name of "John" or "David". [input] |

[output] | #Set the result based on the boolean value if bool1: result = 1 else: result = 0 #Print the result print(result) [instruction] | Depending on the provided boolean value, set the result to 0 or 1. [input] | bool1 = False

[output] | def calculatePerimeter(s1, s2, s3): """This function will calculate the perimeter of a triangle given its three side lengths""" #Calculate the perimeter perimeter = s1 + s2 + s3 #Return the perimeter return perimeter [instruction] | Write a function to calculate the perimeter of a provided triangle by using its three side lengths. [input] |

[output] | The average of 2 and 5 is 3.5. [instruction] | Calculate the average of the given two integers. [input] | Integer 1: 2 Integer 2: 5

[output] | class Car: def __init__(self, color, make, model): self.color = color self.make = make self.model = model def start(self): print("Engine started!") ford_mustang = Car('Red', 'Ford', 'Mustang') ford_mustang.start() [instruction] | Provide an example of a Python class and its elements. [input] |

[output] | import re sentence = "The quick brown fox jumps over the lazy dog." filtered_words = re.findall(r"\b[tT]\w+", sentence) print(filtered_words) # Output: ['The', 'that', 'the'] [instruction] | Use regular expressions to filter words beginning with 't' from a given sentence. [input] | Sentence: The quick brown fox jumps over the lazy dog.

[output] | SELECT * FROM employee WHERE salary > 2000 AND salary < 3000; [instruction] | Write a code in SQL to select the employee information from 'employee' table where the salary is greater than 2000 and is less than 3000. [input] |

[output] | #include <stdio.h> #include <stdlib.h> // Node of a linked list struct Node { int data; struct Node *next; }; // Function to create a new node struct Node *newnode(int data) { struct Node *temp = (struct Node*)malloc(sizeof(struct Node)); temp->data = data; temp->next = NULL [instruction] | Construct a linked list data structure in C language. [input] |

[output] | #include <stdio.h> void printBinary(unsigned int num) { if (num == 0) printf("0"); else { printBinary(num / 2); printf("%d", num % 2); } } int main() { int n = 10; printf("The binary representation of %d is: ", n); printBinary(n); printf( [instruction] | Write a code in C to print a given integer in binary. [input] | Integer: 10

[output] | def replace_chars(s): chars = list(s) res = "" for char in chars: res += chr(ord(char) + 1) return res [instruction] | Replace each character of a string with the next character in alphabetic order. [input] |

[output] | { "name": "John Doe", "age": 25, "address": { "street": "1 Main Street", "city": "New York" } } [instruction] | Edit a given JSON string to set a specific value in it. [input] | JSON String: { "name": "John Doe", "age": 20, "address": { "street": "1 Main Street", "city": "New York" } } Set the age to 25.

[output] | course_id | count ----------+------ C1 | 10 C2 | 5 C3 | 3 [instruction] | Create a table that lists the output of the given SQL query. [input] | SELECT course_id, COUNT(*) as count FROM students GROUP BY course_id

[output] | #include <stdio.h> #include <stdlib.h> int main() { int* a; int n = 20; a = (int *)malloc(n * sizeof(int)); for (int i=0; i<n; i++) scanf("%d", &a[i]); free(a); return 0; } [instruction] | Refactor the following code in C++ to incorporate dynamic memory allocation. [input] | #include <stdio.h> int main() { int a[20]; int n = 20; for (int i=0; i<n; i++) scanf("%d", &a[i]); return 0; }

[output] | { "name" : "Bob", "age" : 32, "profession" : "dentist" } [instruction] | Edit the following JSON to add a new key. [input] | { "name" : "Bob", "age" : 32 }

[output] | <html> <head> <title>Inputs</title> </head> <body> <form> <input type="text" id="inputText"> <input type="submit" value="Submit"> </form> <table> <thead> <tr> <th>Input Text</th> [instruction] | Create an HTML page with a text input box, a submit button and a table to display the results. [input] |

[output] | function extractWordsWithLetter(sentence, letter) { let words = sentence.split(' '); let result = []; words.forEach(word => { if (word.includes(letter)) { result.push(word); } }); return result; } [instruction] | Create a function in JavaScript to extract the words from a given sentence that contains a specific letter. [input] | Sentence: The quick brown fox jumps over the lazy dog Letter: o

[output] | public class Student { public string name; public int age; public string[] classes; public Student(string name, int age, string[] classes) { this.name = name; this.age = age; this.classes = classes; } } [instruction] | Create a C# class that stores student information such as name, age, and classes. [input] |

[output] | const input = [1, 5, 9, 8, 2]; const average = input.reduce((sum, item) => sum + item) / input.length; console.log(average); // 5 [instruction] | Create an array of items and calculate the average of the items. [input] | [1, 5, 9, 8, 2]

[output] | for (i=1; i<11; i++) { console.log(i * 5); } [instruction] | Update the code so that it prints out the first ten multiples of 5. [input] | for (i=1; i<5; i++) { console.log(i * 2); }

[output] | class Shape { constructor() { } getArea() { return 0; } } [instruction] | Create a class named 'Shape' which has a method 'getArea' which returns the area of the shape. [input] |

[output] | const array = ['a', 'b', 'c', 'd', 'e', 'f', 'g']; [instruction] | Create an array of length 7 and set the values to the first 7 letters of the alphabet. [input] |

[output] | HTML is typically written in a markup language such as XML or XHTML. [instruction] | Answer the following question: what language is HTML typically written in? [input] |

[output] | def swap_case(x): return x.swapcase() [instruction] | Improve the function below to make it more efficient [input] | def swap_case(x): y = "" for i in x: if i.isupper(): y += i.lower() else: y += i.upper() return y

[output] | def remove_duplicates(string): res = "" for i in string: if i not in res: res = res + i return res [instruction] | Generate code to remove duplicate characters from a string. [input] | string = "google"

[output] | def binary_search(arr, target): low = 0 high = len(arr) - 1 while low <= high: mid = (low+high) // 2 # Check if target is present at mid if arr[mid] == target: return mid # If target is greater than mid, ignore left half [instruction] | Give an example of the binary search algorithm [input] |

[output] | def find_sum(n): sum = 0 for i in range(n+1): sum += i return sum [instruction] | Generate a program that finds the sum of all natural numbers from 0 to n [input] |

[output] | def find_ones(n): count = 0 while n > 0: if n % 10 == 1: count += 1 n //= 10 return count [instruction] | Change the response to now fulfill the following purpose [input] | Find the number of ones in a binary number 101011

[output] | public static void sort(int arr[]) { int n = arr.length; // Build heap (rearrange array) for (int i = n / 2 - 1; i >= 0; i--) heapify(arr, n, i); // One by one extract an element from heap for (int i=n-1; i>=0; i--) { // Move current root to end [instruction] | Generate a Java program to sort an array of n elements in ascending order [input] |

[output] | SELECT DISTINCT nums FROM table; [instruction] | Generate a SQL query to select all distinct numbers from a column named 'nums' [input] |

[output] | UPDATE employee SET salary = 5000 WHERE id = 2; [instruction] | Generate a SQL query to update existing row in a table [input] | Table = employee Set salary = 5000 where id = 2

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