← 목록

Synth · CodeAlpaca일부

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

[output] | /^[ab]+$/ [instruction] | You need to write a regular expression that will match any string containing only the letters 'a' and 'b'. [input] |

[output] | <ul> <li>One</li> <li class="example">Two</li> <li>Three</li> </ul> [instruction] | You need to edit this given HTML code to apply a class name "example" to the second element. [input] | <ul> <li>One</li> <li>Two</li> <li>Three</li> </ul>

[output] | let x = 5; let factorial = 1; while (x > 0) { factorial *= x; x--; } console.log(factorial); [instruction] | You need to create a JavaScript program that will find the factorial of a given number stored in the variable x. [input] |

[output] | let fibonacci = [0, 1]; let x = 0; let y = 1; for (let i = 1; i < 10; i++) { let z = x + y; x = y; y = z; fibonacci.push(z); } [instruction] | This program needs an array containing the first 10 numbers of the Fibonacci sequence. [input] |

[output] | SELECT name, email FROM users WHERE name LIKE "John%" [instruction] | Create an SQL query that will return a table containing name and email columns from a table called "users" where the name begins with the given name parameter. [input] | John

[output] | def even_count(arr): count = 0 for i in arr: if i % 2 == 0: count += 1 return count [instruction] | You need to write a function that takes an array and returns the count of even elements in the array. [input] | [1, 2, 3, 4, 5, 6]

[output] | /\d+/ [instruction] | Construct a regular expression that will match only strings that contain a number. [input] |

[output] | <!DOCTYPE html> <html> <head> <title>Two Buttons</title> </head> <body> <button onclick="alert('Hello World!')">Print Hello World</button> <br /> <button onclick="alert('Goodbye World!')">Print Goodbye World</button> </body> </html> [instruction] | Create a HTML page with two buttons, one to display "Hello World!" and one to display "Goodbye World!" [input] |

[output] | body { background-color: #000000; color: #FFFFFF; } [instruction] | Create a CSS stylesheet to style a website with a black background and white text. [input] |

[output] | <table> <tr> <th>Name</th> <th>Age</th> </tr> <tr> <td>John</td> <td>20</td> </tr> <tr> <td>Dylan</td> <td>15</td> </tr> <tr> <td>Mary</td> <td>18</td> </tr> </table> [instruction] | Write an HTML program to display a table with a list of names and ages of people. [input] | names = ["John", "Dylan", "Mary"], ages = [20, 15, 18]

[output] | def compare_strings (str1, str2): if str1 == str2: print ("The strings are equal") else: print ("The strings are not equal") [instruction] | Create a program to compare two strings and print the result. [input] | str1 = “Hello”, str2 = “World”

[output] | A = rand(3,3); [instruction] | Write MATLAB code to generate a 2-D array called "A" and fill it with random numbers. [input] |

[output] | SELECT COUNT(DISTINCT customer_name) FROM Orders; [instruction] | Create a SQL query that counts the total distinct `customer_name` from a table called `Orders`. [input] | Input: Orders Table ┌─────────┬────────┬──────────┐ │ order_id│item_id │ customer_name│ ├─────────┼────────┴──────────┤ │1 │ 100 │ John │ │2 │ 200 │ John │ │3 │ 300 │ Peter │ │4 │ 400 │ Rachel │ │5 │ 500 │ Peter │ └───

[output] | function checkInt(number){ if(number % 1 === 0){ return true; } return false; } checkInt(653); // returns true [instruction] | Create a JavaScript function that validates a given number as an integer. [input] | Input: 653

[output] | SELECT * FROM Customers WHERE status = 'active'; [instruction] | Generate a SQL query to return all customers in a table that have a `status` of `active`. [input] | Input: Customers Table ┌─────────┬────────┬───────┐ │ cust_id│name │ status│ ├─────────┼────────┴───────┤ │1 │ John │ active│ │2 │ Peter │ inactive│ │3 │ Rachel │ active│ │4 │ David │ active│ └─────────┴────────┴───────┘

[output] | public class CountFrequency { static int countFrequency(String sentence, String word) { int frequency = 0; String[] words = sentence.split(" "); for (String w : words) { if (w.equals(word)) frequency++; } return f [instruction] | Develop a Java program that counts the frequency of a given word in a sentence. [input] | Input: sentence = "I am learning to code" , word = "code"

[output] | SELECT * FROM Customers WHERE processing_time > 5; [instruction] | Develop a SQL query to select customers with a processing time greater than 5 minutes. [input] | Input: Customers Table ┌─────────┬────────┬────────┬───────────┐ │ cust_id│name │ status │processing_time│ ├─────────┼────────┴────────┴───────────┤ │1 │ John │ active │ 3 │ │2 │ Peter │ inactive│ 7 │ │3 │ Rachel │ active │ 2 │ │4

[output] | class Car: def __init__(self, model, year): self.model = model self.year = year [instruction] | Create a Python class called "Car" which has the "model" and "year" parameters. [input] |

[output] | for num in range(10,0,-1): if(num % 2 == 0): print(num) [instruction] | Write a code that prints the even numbers from 10 to 0 in descending order. [input] |

[output] | print("Hello World") [instruction] | Modify the following code as required to display the message “Hello World” on the screen. [input] | print("Hello")

[output] | 3x^2 + 5x + 5 = 0 [instruction] | Convert the following linear equation into a quadratic equation. [input] | 3x + 5 = 0

[output] | [[4, 2, -3], [0, 4, 3], [-2, 0, 7]] [instruction] | Add a 3x3 identity matrix to the following matrix. [input] | [[1, 2, -3] [0, 1, 3] [-2, 0, 4]]

[output] | [[0.7071, -0.7071, 0.0], [0.7071, 0.7071, 0.0], [0.0, 0.0, 1.0]] [instruction] | Create a 3x3 rotation matrix with an angle of 45 degrees. [input] |

[output] | def multiply(num1, num2): try: result = num1 * num2 return result except TypeError: print("Error: Inputs must be numbers") [instruction] | Rewrite the following Python function to include a try/except block. [input] | def multiply(num1, num2): result = num1 * num2 return result

[output] | int x = 10, result = 0; while (x > 0) result += x--; [instruction] | Rewrite this code to make it shorter. [input] | int x=10; int result=0; while(x>0){ result+=x; x--; }

[output] | protocol = "https" host = "www.example.com" path = "/articles/first-article" [instruction] | Parse a given URL into its component parts. [input] | url = "https://www.example.com/articles/first-article"

[output] | /* customers table */ CREATE TABLE customers ( id INT PRIMARY KEY, name VARCHAR(255), address VARCHAR(255) ); /* orders table */ CREATE TABLE orders ( id INT PRIMARY KEY, customer_id INT REFERENCES customers(id), total DECIMAL ); /* products table */ CREATE TABLE products ( [instruction] | Design a database with tables and columns representing customers, orders and products. [input] |

[output] | import React from 'react'; const Header = () => ( <h1>My Website</h1> ); export default Header; [instruction] | Build a React component to render a header with the text "My Website". [input] |

[output] | def count_words(text): words = text.split() count = 0 for word in words: count += 1 return count string = "Hello world" # we need to add a check for empty string if string != '': print(count_words(string)) else: print(0) [instruction] | Debug the following program and make it function correctly [input] | def count_words(text): words = text.split() count = 0 for word in words: count += 1 return count string = "Hello world" print(count_words(string))

[output] | def print_prime_numbers(n): # iterate through all numbers up to the provided number for num in range(2, n+1): is_prime = True # check if a number is prime for j in range(2, num): if num % j == 0: is_prime = False # if prime print it [instruction] | Implement a function that prints all prime numbers up to the provided number. [input] |

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