← 목록

Synth · CodeAlpaca일부

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

[output] | <h1 style="color:black; background:red; text-align:center;">Heading 1</h1> [instruction] | Update this HTML as per the given instructions. [input] | Update the <h1> tag to be black and red, and center-align it.

[output] | a = 5; b = 4; c = 2; [instruction] | Find the values of a, b and c in this equation. [input] | 7a + 5b + 4c = 70

[output] | console.log("Goodbye World!"); [instruction] | Change the line of code that prints "Hello World!" to print "Goodbye World!" [input] | console.log("Hello World!");

[output] | perimeter = 24 [instruction] | Calculate the perimeter of a triangle with the given length of sides. [input] | Length of sides: 6, 8, 10

[output] | Binary number: 111111 [instruction] | Convert this octal number to a binary number. [input] | Octal number: 77

[output] | def print_msg(): print("Hello World") [instruction] | Debug this code to remove the syntax error. [input] | def print_msg() print("Hello World")

[output] | def getChar(num): return chr(num) # Test print(getChar(90)) # 'Z' [instruction] | Design a program that takes a number as input and prints out its corresponding ASCII character. [input] | Number: 90

[output] | regex_pattern = r'(\d{3}-\d{3}-\d{4})' [instruction] | Write a regular expression that will check if a given string contains valid phone numbers. [input] | String: Please contact us at 021-555-3119 or email me at contact@example.com

[output] | max_num = lambda x: max(x) # Test nums = [3, 5, 21, 11, 9] max_num = max_num(nums) print(max_num) # 21 [instruction] | Write a Lambda expression for finding the maximum number from a list of integers. [input] | [3, 5, 21, 11, 9]

[output] | def evalExpression(x, y, z): return 4*x + 3*y - 2*z # Test x = 1 y = 3 z = -2 result = evalExpression(x, y, z) print(result) # 5 [instruction] | Create a program to evaluate the expression for the given values. [input] | Expression: 4x + 3y - 2z Values: x = 1, y = 3, z = -2

[output] | div { width: 50px; height: 50px; border-radius: 50px; } [instruction] | Use a CSS code snippet to make a div element into a circle with given radius. [input] | radius = 50px

[output] | SELECT * FROM Employees WHERE salary > 5000 [instruction] | Construct an SQL query to find the employees whose salary is greater than $5,000 from the Employees table. [input] |

[output] | <form action="" method="post"> <label for="name">Name:</label><br> <input type="text" name="name" id="name"> <br> <label for="email">Email:</label><br> <input type="email" name="email" id="email"><br> <label for="message">Message:</label><br> <textarea name="message" id="message" rows="4 [instruction] | Construct an HTML form for a user to enter his or her name, email address and a message [input] |

[output] | while (!q.empty()) q.pop(); [instruction] | Write a C++ statement to delete all the elements from the queue q. [input] |

[output] | window.open("", "_blank"); [instruction] | Produce a JavaScript code snippet for opening a new browser window. [input] |

[output] | highest_number = [i for i in List if i == max(List)] [instruction] | Generate a list comprehension to find the highest number in the given list. [input] | List = [2, 74, 8, 9, 34, 67]

[output] | The best way to store the resume of a job applicant in a database is to break it up into different tables, such as an education table with fields for the degree, field of study, institution, and GPA; a work experience table with fields for job title, company, date, and description; and a skills tabl [instruction] | Describe a way to store the following information in a database. [input] | Resume of a job applicant

[output] | #FFB3B3 and #454545 would generate a light pink and dark gray combination. [instruction] | Generate an example of a combination of two colors using the hexadecimal triplet system. [input] |

[output] | There is a missing semicolon after the "x = x + 1" line, needed to terminate the while loop. [instruction] | Analyze the given C++ code to identify possible errors. [input] | int main() { int x = 0; while (x <= 10) x = x + 1 return 0; }

[output] | import re p = re.compile(r'https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+') words = p.findall(url) [instruction] | Construct a Regex expression in Python to extract words from a given URL. [input] |

[output] | my_list = list(range(0,11)) [instruction] | Create a variable in Python to hold a list of numbers from 0 to 10 [input] |

[output] | import xml.etree.ElementTree as ET tree = ET.parse('data.xml') root = tree.getroot() countries = [] for country in root: countries.append(country.attrib['name']) print(countries) # Output: ['Ghana', 'Iceland'] [instruction] | Parse the following XML data to get a list of country names [input] | <data> <country name="Ghana"> <rank>99</rank> <year>2012</year> <gdppc>2616.7</gdppc> <neighbor name="Togo" direction="W"/> </country> <country name="Iceland"> <rank>16</rank> <year>2015</year> <gdppc>38639.2</gdppc> <neighbor name="Greenland" direction="N"/>

[output] | # Reversing the order of items in an array def reverse_order(input_list): return input_list[::-1] my_list = [1,2,3,4,5] print(reverse_order(my_list)) # Output: [5, 4, 3, 2, 1] [instruction] | Write a code which reverses the order of items in an array [input] | my_list = [1,2,3,4,5]

[output] | # Generating a new list with all the even numbers from the given list def get_even_numbers(input_list): even_numbers = [] for num in input_list: if num % 2 == 0: even_numbers.append(num) return even_numbers my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] print(get_even_numbers(my_list)) [instruction] | Generate a new list with all the even numbers from the given list [input] | my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

[output] | def convert_to_single_column_array(arr): single_column_arr = [] for sub_arr in arr: for val in sub_arr: single_column_arr.append(val) return single_column_arr [instruction] | Write a function in Python to convert a 2D array into a single column array. [input] | arr = [[0, 1, 2], [3, 4, 5], [6, 7, 8]]

[output] | javac HelloWorld.java [instruction] | Compile this Java code to run on a JVM. [input] | public class HelloWorld { public static void main(String[] args) { System.out.println("Hello world!"); } }

[output] | const form = document.querySelector('form'); const nameInput = document.querySelector('#name'); form.addEventListener('submit', event => { event.preventDefault(); // prevent form submission const name = nameInput.value; if (name.length === 0 ) { // invalid name // show an error message [instruction] | Use the HTML form below and provide the corresponding JavaScript code that will validate the form. [input] | <form> <div class="form-row"> <div class="form-group col-7 mb-0"><label>Name</label> <input type="text" class="form-control" placeholder="Your name" name="name"id="name"> </div> </div> <div class="form-row text-center mt-3"> <button type="submit" class="btn btn-success" id="sub

[output] | public class Debugging { public static void main(String[] args) { int x = 5; int y = 2; System.out.println("The answer is " + (x - y + 1)); } } [instruction] | Debug this Java program and make the output print "The answer is 3". [input] | public class Debugging { public static void main(String[] args) { int x = 5; int y = 2; System.out.println("The answer is " + (x - y)); } }

[output] | import requests # API endpoint url = "http://api.openweathermap.org/data/2.5/weather?" # API key api_key = "YOUR_API_KEY" # City name city_name = "New York" # parameter for API call params = { 'q': city_name, 'appid': api_key } # get method of requests module # return response [instruction] | Use an API to fetch and print the current weather information of a given city. [input] | City Name: New York

[output] | #!/bin/sh # trap ctrl-c and call ctrl_c() trap ctrl_c INT ctrl_c() { echo "You have entered wrong command. Type 'exit' or 'Ctrl + c' to quit." } while : do read -p "Your command-> " cmd # taking input from a user if [ "$cmd" == "exit" ]; then break else [instruction] | Write a Bash script that displays a message if you enter a wrong command. [input] |

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