← 목록

Synth · CodeAlpaca일부

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

[output] | import React from 'react'; import ReactDOM from 'react-dom'; class MyFirstReactPage extends React.Component { render() { return ( <div> <h1>This is my first React page!</h1> </div> ); } } ReactDOM.render( <MyFirstReactPage />, document.querySelector('#root') ); [instruction] | Develop a web page with React. [input] |

[output] | import re value = 'The integer value is 12' m = re.search(r'\d+', value) print(int(m.group(0))) [instruction] | Parse this string to extract the integer value. [input] | value = 'The integer value is 12'

[output] | .centerText { text-align: center; margin: auto; } [instruction] | Construct a CSS class for a text that needs to be centered on the page. [input] |

[output] | button:hover { opacity: 1; background-color: #f1f1f1; } [instruction] | Compose a CSS selector that creates buttons that appear on hover. [input] |

[output] | Vue.component('Table', { props: { list: Array }, template: ` <div> <div> <table border="1"> <tr v-for="item in list"> <td v-for="detail in item">{{ detail }}</td> </tr> </table> </div> </div> ` }) [instruction] | Generate a Vue.js component to display a table. [input] |

[output] | <form> <label>First Name:</label> <input type="text" name="fname"> <label>Last Name:</label> <input type="text" name="lname"> <input type="submit" value="Submit"> </form> [instruction] | Create an HTML partial for a form that includes inputs for first name and last name. [input] |

[output] | let sw_dict = py_dict as! [String: Int] [instruction] | Write a Swift program to convert a Python dictionary to a Swift dictionary. [input] | py_dict = {"a": 1, "b": 2, "c": 3}

[output] | CREATE TABLE orders ( order_id INTEGER, customer_name VARCHAR(255) ); [instruction] | Write an SQL query to create a table called "orders" with columns for the order id and customer name. [input] |

[output] | dice_prob <- function(sides = 6) { if (sides <= 2) { stop("The number of sides should be greater than 2.") } 1/sides } [instruction] | Create a function in R to determine the probability of rolling a dice with a given number of sides. [input] |

[output] | <a href="http://www.example.com">Link Text</a> [instruction] | Complete the following HTML code to create a hyperlink. [input] | <a href="

[output] | <?php // Function to check if a given input is a number or a string. function is_number_or_string($input) { if (is_numeric($input)) { echo 'The input is a number.'; } else { echo 'The input is a string.'; } } [instruction] | Write a PHP script to check if an input is a number or a string. [input] |

[output] | let button = UIButton() button.setTitle("Button Title", for: .normal) button.frame = CGRect(x: 0, y: 0, width: 100, height: 50) view.addSubview(button) [instruction] | Write a Swift code snippet to create a button with user specified text and size. [input] |

[output] | public class PrimeNumbers { public static void main(String[] args) { int N = 25; for (int i = 2; i < N; i++) { int count = 0; for (int j = 2; j <= Math.sqrt(i); j++) { if (i % j == 0) { count++; break; [instruction] | Write a Java program that reads an integer value N and prints all prime numbers less than N. [input] |

[output] | function isPerfect(n) { let sum = 0; for (let i = 1; i < n; i++) { if (n % i == 0) { sum += i; } } return sum === n; } [instruction] | Write a JavaScript function to check if a given input number is perfect or not. A perfect number is a number whose sum of divisors equals the number itself. [input] |

[output] | <div style="color: blue;">This is an example text</div> [instruction] | Write a CSS program to change the text color of a given element from red to blue. [input] | <div>This is an example text</div>

[output] | <ol> <li>GDP - Gross Domestic Product</li> <li>GNP - Gross National Product</li> <li>Inflation</li> <li>Deflation</li> <li>Econometrics</li> </ol> [instruction] | Write a html code snippet to create a simple ordered list containing 5 economic terms. [input] |

[output] | #include <stdio.h> int main() { int i = 0; // Iterate from 0 to 500 while (i <= 500) { if (i % 2 != 0) printf("%d ", i); i++; } return 0; } [instruction] | Write a C program to output all odd numbers from 0 to 500. [input] |

[output] | SELECT customers.* FROM customers, products, order_items WHERE customers.id = order_items.customer_id AND order_items.product_id = products.id AND products.category = 'electronics'; [instruction] | Write an SQL query to list all the customers who have purchased any item from the “electronics” category. [input] |

[output] | public class Octal { public static void main(String[] args) { int num = 21; String octal = Integer.toOctalString(num); System.out.println("Octal: " + octal); } } [instruction] | Write a Java program to convert a given integer value to octal. [input] |

[output] | <table> <thead> <th>Color 1</th> <th>Color 2</th> </thead> <tbody> <tr> <td style="background-color: #e12b33;">&nbsp;</td> <td style="background-color: #2771e1;">&nbsp;</td> </tr> <tr> <td style="background-color: #f3af02;">&nbsp;</td> <td style="bac [instruction] | Write an HTML code to create a simple two-column table and fill it with 4 random colors. [input] |

[output] | count = 0 for word in string.split(): count += 1 print("Number of words:", count) [instruction] | Using a for loop, count the number of words in the below string. [input] | string = "This is a test string"

[output] | In Java, data types int and float represent different levels of precision: int is for whole numbers, while float is for decimal numbers. Int has a 32-bit size, which allows for whole numbers from -2^31 to 2^31-1. Float is 32-bit and can refer to decimal values of up to seven digits. Float can also b [instruction] | What are the differences between data types int and float in Java? [input] |

[output] | def word_count_dict(string): word_list = string.split() word_dict = {} for word in word_list: if word in word_dict: word_dict[word] += 1 else: word_dict[word] = 1 return word_dict string = "This is a test string" print(word_count_dict(string)) [instruction] | Create a function that takes in a string and returns a dictionary with each word as a key and its count as the value. [input] | string = "This is a test string"

[output] | a = 0 b = 1 print(a) print(b) while b < 50: c = a + b a = b b = c print(c) [instruction] | Generate Fibonacci numbers up to 50 using a while loop. [input] |

[output] | var inventory = [ {item: 'Apple', qty: 10}, {item: 'Orange', qty: 20},    {item: 'Banana', qty: 5},    {item: 'Grapes', qty: 15} ]; [instruction] | Create an array of objects that contains the inventory of a store. [input] | Inventory of a store: - Apple: 10 - Orange: 20 - Banana: 5 - Grapes: 15

[output] | <html> <head> <title>Weather App</title> </head> <body> <h1>Weather in Philadelphia</h1> <h2>Today</h2> <div id="weather"> <script> // API call to get the weather forecast fetch("https://api.weather.gov/gridpoints/PHI/20,34/forecast") .then(response => response.json()) [instruction] | Create a website that displays the current day's weather forecast in Philadelphia. [input] |

[output] | SELECT Name, Address FROM Customers WHERE NOT EXISTS (SELECT * FROM Orders WHERE Customers.ID = Orders.CustomerID); [instruction] | Write a SQL query to display the names and addresses of customers who have not made any purchases. [input] |

[output] | <!DOCTYPE html> <html> <head> <title>Multiply</title> </head> <body> <h1>Multiplication Result</h1> <form action="" method="POST"> Enter the first number: <input type="text" name="num1"><br> Enter the second number: <input type="text" name="num2"><br> <input type=" [instruction] | Create a HTML page which displays the result of multiplying two user-provided numbers. [input] |

[output] | import datetime calculate_age = lambda dob: int((datetime.date.today() - dob).days / 365.25) [instruction] | Create a lambda function in Python to fetch the age of a person from their given DOB. [input] |

[output] | x = range(1, 10) list(map(print, x)) [instruction] | Re-write the following code using functional programming style. [input] | x = range(1, 10) for i in x: print(i)

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