← 목록

Synth · CodeAlpaca일부

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

[output] | SELECT * FROM members WHERE age < 30; [instruction] | Create a SQL query to get the list of members younger than 30. [input] |

[output] | 3 [instruction] | What is the output of this C++ code for n = 3? [input] | int f(int n) { if (n == 0 || n == 1) return 1; else return f(n-1) + f(n-2); }

[output] | public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } [instruction] | Output "Hello World!" using Java. [input] |

[output] | let data = { "name": "John", "age": 30, "city": "New York" }; [instruction] | Add the following data to a JavaScript associative array: {"name": "John", "age": 30, "city": "New York"} [input] |

[output] | <input type="email" name="email" placeholder="Enter your email address"> [instruction] | Create a HTML element for inputting an email address. [input] |

[output] | def calculate_rectangle_length_and_breadth(x, y): length = x breadth = y return length, breadth [instruction] | Write a function in Python to calculate the length and breadth of a given rectangle. [input] |

[output] | <table> <thead> <tr> <th>Grades</th> </tr> </thead> <tbody> <tr><td>85</td></tr> <tr><td>90</td></tr> <tr><td>77</td></tr> <tr><td>95</td></tr> </tbody> </table> [instruction] | Given a list of student grades, write HTML code to display them in a table. [input] | let grades = [85, 90, 77, 95];

[output] | def check_anagrams(str1, str2): if (len(str1) != len(str2)): return False # sorting both strings str1_list = sorted(str1) str2_list = sorted(str2) # Check if both lists are equal for i in range(0, len(str1_list)): if str1_list[i] != str2_list[i [instruction] | Given two strings, write a Python function to check if they are anagrams. [input] |

[output] | <form> <label>Name:</label><input type="text" name="name"><br> <label>Age:</label><input type="number" name="age"><br> <input type="submit" value="Submit"> </form> [instruction] | Write an HTML form with two input fields, one for the user's name and one for the user's age. [input] |

[output] | <a href="https://www.example.com/">Link Text</a> [instruction] | Write a HTML code snippet to create a link which redirects to a given website. [input] |

[output] | int temp = a; a = b; b = temp; [instruction] | Write a Java code snippet to swap two given values. [input] | int a = 10; int b = 20;

[output] | abcdc [instruction] | Given a string, the task is to output a new string with all repeating continuous characters collapsed to a single character. [input] | aabbccddcc

[output] | [6, 5, 4, 3, 2] [instruction] | Reverse the order of an array. [input] | [2, 3, 4, 5, 6]

[output] | String: '&lt;div&gt;' [instruction] | Given a string, replace characters with their corresponding HTML entities [input] | String: '<div>'

[output] | fetch('https://example.com/orders', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: { orderId: '12434', items: [ { itemId: '345', quantity: 3 }, { itemId: '678', quantity: 4 } ] } }); [instruction] | Create an API Request to send a request with a body in JSON format [input] | Endpoint: https://example.com/orders <noinput>

[output] | def combineStrings(strings): combined_string = "" for string in strings: combined_string += string + " " return combined_string combined_string = combineStrings(["This", "is", "a", "list", "of", "strings"]) [instruction] | Create a function that takes a list of strings and combines them together into one string [input] | ["This", "is", "a", "list", "of", "strings"]

[output] | SELECT name, description FROM products; [instruction] | Create a MySQL query to select the name and description of all products [input] |

[output] | SELECT name, price FROM products; [instruction] | Write a SQL query to list out the product names and prices from a database [input] |

[output] | const result = arr.map(obj => ( { name: obj.name, age: obj.age * 2 } )); [instruction] | Transform an array of objects using JavaScript [input] | Array: [{name: "John", age: 21}, {name: "Mary", age: 18}, {name: "Steve", age: 24}]

[output] | import tensorflow as tf # Set up the layers for the model model = tf.keras.models.Sequential([ # Set up the first layer tf.keras.layers.Dense(64, input_shape = (784, ), activation = 'relu'), # Set up the second layer tf.keras.layers.Dense(64, activation = 'relu'), # Set up the o [instruction] | Write a TensorFlow program to construct a basic neural network [input] |

[output] | import MySQLdb # connect to database db = MySQLdb.connect(host="localhost", user="user", passwd="password", db="customers") # create a cursor cursor = db.cursor() # execute SQL query cursor.execute("SELECT name, age FROM customers") # fetch the rows rows = cursor.fetchall() # traverse [instruction] | Write a Python script that extracts the name and age of all customers from the customer table in a database. [input] |

[output] | var num1 = 10; var num2 = 20; console.log(num1 + num2); [instruction] | Modify the following JavaScript code to make it print the result on the console. [input] | var num1 = 10; var num2 = 20;

[output] | var randomNum = Math.floor(Math.random() * (11 - 0)) + 0; [instruction] | How could you modify the following JavaScript code to generate a random number between 0 and 10? [input] | var randomNum = Math.random()

[output] | n = 5 lst = list(range(n, 0, -1)) print(lst) [instruction] | Write a Python program to create a list of n numbers (where n is the input) and print the list in reverse order. [input] | n=5

[output] | import re pattern = re.compile(r'\bcomputer\b') text = "A computer is a machine that can be instructed to carry out sequences of arithmetic or logical operations automatically via computer programming." matches = pattern.finditer(text) for match in matches: print(match) [instruction] | Write a regular expression that finds all occurrences of the word "computer" in the following text. [input] | "A computer is a machine that can be instructed to carry out sequences of arithmetic or logical operations automatically via computer programming.

[output] | int n = 1234; String[] ones = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; String[] teens = {"eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"}; String[] tens = {"", "ten", "twenty", "thirty", "forty", "fifty", [instruction] | Write a C# program to take a given number and print it in words. [input] | int n = 1234

[output] | arr = ["Dog","Cat","Mouse"] longest_str = max(arr, key=len) print(len(longest_str)) [instruction] | Given an array of strings, write a code snippet in Python that finds the longest string and prints its length. [input] | arr = ["Dog","Cat","Mouse"]

[output] | var x = 10; var y = 5; var sum = x + y; var diff = x - y; console.log("The sum of " + x + " and " + y + " is: " + sum); console.log("The difference of " + x + " and " + y + " is: " + diff); [instruction] | Write a code that computes the sum and difference of two numbers in JavaScript. [input] | var x = 10; var y = 5;

[output] | document.querySelector('p').style.fontSize = "14px"; [instruction] | Change the font size of the HTML element <p> to "14px". [input] |

[output] | for (let i = 0; i < array.length; i++) { let element = array[i]; //code to execute for each element } [instruction] | How do you loop over a JavaScript array? [input] |

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