← 목록

Synth · CodeAlpaca일부

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

[output] | h1 { font-size: 14px; color: red; } [instruction] | Write a CSS code to create a heading with red color font. [input] |

[output] | import React from 'react'; import { Button } from 'react-native'; const SubmitButton = ({ text }) => { return ( <Button title={text} /> ); } export default SubmitButton; [instruction] | Code a React component that renders a button with a given text. [input] | Text of the button: Submit

[output] | DELETE FROM tableName; [instruction] | Write a code to delete all records in an MS Access table. [input] |

[output] | let date = new Date(); let current_datetime = date.getDate() + "/" + (date.getMonth()+1) + "/" + date.getFullYear() + " @ " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds() [instruction] | How to get the current date and time in a JavaScript program? [input] |

[output] | public class Fibonacci { public static void main(String[] args) { int num = 10; int first = 0; int second = 1; System.out.println("Fibonacci Series of " + num + " numbers:"); for (int i = 0; i < num; i++) { System.out.print(first + " [instruction] | Create a Java program to output the Fibonacci series upto the given number. [input] | Number: 10

[output] | import re string = "My Email address is example@gmail.com" expression = r'[\w\.-]+@[\w\.-]+' address = re.findall(expression, string) print("Email address is: ", address) [instruction] | How to identify an email address from a given string using Regular Expressions? [input] |

[output] | The different types of HTML5 Semantic Elements are: - article, aside, details,figcaption, figure, footer, header, main, nav, section, summary. [instruction] | What are the different types of HTML5 Semantic Elements? [input] |

[output] | public class Rating { public static void main (String[] args) { int inputValue = 7; int rating = 0; if (inputValue >= 8) { rating = 10; } else if (inputValue >= 5) { rating = 7; } else { rating = 4; } System.out.println("Rating: " + rating); } } [instruction] | Write a Java program that prints a rating out of 10 based on user input. [input] | Input value: 7

[output] | [10, 9, 7, 4, 3] [instruction] | How would you reverse this array? [input] | [3, 4, 7, 9, 10]

[output] | function capitalize(str) { return str.charAt(0).toUpperCase() + str.slice(1); } [instruction] | Write a JavaScript function that accepts a string argument and returns its capitalized value. [input] |

[output] | public class MainActivity extends AppCompatActivity { RecyclerView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Instantiate the database AppDataba [instruction] | Write an Android app to display a list of items from a local database. [input] |

[output] | <html> <head> <title>Table Example</title> </head> <body> <table> <tr> <th>Column 1</th> <th>Column 2</th> <th>Column 3</th> </tr> <tr> <td>Row 1, Column 1</td> <td>Row 1, Column 2</td> <td>Row 1, Column 3</td> </t [instruction] | Create an HTML webpage that displays a table. [input] |

[output] | def square(num): return num ** 2 [instruction] | Write a Python function that prints the square of a given number. [input] |

[output] | public static int multiply(int a, int b) { return a * b; } [instruction] | Create a Java method that takes two integer arguments and returns their multiplication. [input] |

[output] | def longer_words(text): words = text.split() longer = [word for word in words if len(word) > 3] return longer [instruction] | Given a text string, write a function in Python to identify all the words that have more than 3 characters. [input] | text = "Python is an easy to learn language"

[output] | public static int[] replaceNegs(int[] arr) { for (int i = 0; i < arr.length; i++) { if (arr[i] < 0) arr[i] = 0; } return arr; } [instruction] | Using Java, write a method that takes an array of integers and replaces all the negative numbers with 0. [input] | int[] arr = {2, 3, -4, 5, 7, -8};

[output] | function updateDict(d, key, value) { d[key] = value; return d; } [instruction] | Create a function to update the existing item of a dictionary with a new value. [input] | mydict = { "name": "John", "age": 25 }

[output] | def common_elements(arr1, arr2): return [x for x in arr1 if x in arr2] [instruction] | Given two arrays of integers, write a Python function which is able to identify common elements. [input] | arr1 = [1,2,3,4,5] arr2 = [3,4,5,6,7]

[output] | const express = require('express'); const app = express(); const http = require("http"); app.get("/api/weather/:location", (req, res, next) => { let location = req.params.location; http.get(`http://api.weatherstack.com/current?access_key=YOUR_API_KEY&query=${location}`, (response) => { let [instruction] | Build a REST API with Node.js which provides the current temperature and humidity data of a given location. [input] |

[output] | SELECT students.id AS student_id, students.name AS student_name FROM students INNER JOIN marks ON students.id = marks.student_id WHERE marks.subject = ‘Subject1’ ORDER BY marks.mark DESC LIMIT 1; [instruction] | Using SQL, write a query to identify the student ID and the name of the student who scored the highest marks in a given subject. [input] |

[output] | """ Design a class named 'Rectangle' that prints out the length, width, area and perimeter of a given rectangle """ class Rectangle: def __init__(self, l, w): self.length = l self.width = w def area(self): return self.length * self.width def perimet [instruction] | Design a class named "Rectangle" that prints out the length, width, area and perimeter of a given rectangle. [input] |

[output] | sum_temp = 0 i = 0 while sum_temp < sum_num: sum_temp += list[i] i += 1 [instruction] | Construct a while loop that continuously adds all elements of a list until reaching a certain number [input] | list=[1, 2, 3, 4, 5] sum_num=10

[output] | def print_odd_num(my_list): for num in my_list: if num % 2 != 0: print(num) [instruction] | Write a function which prints out odd numbers from a given list [input] | [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

[output] | def add_two_nums(a, b): return a + b [instruction] | Make a code that takes two arguments and returns a sum of the two [input] |

[output] | for x in my_list: if x > 10: print("{0} is greater than 10".format(x)) [instruction] | Construct a loop that checks whether each item in a list is greater than 10 [input] | my_list = [5, 11, 8, 15]

[output] | new_list = [x for x in my_list if x < 5] [instruction] | Using list comprehension, create a new list that contains values less than 5 [input] | my_list = [7, 2, 5, 8, 4, 9, 6]

[output] | def check_value(obj, value): for key, val in obj.items(): if val == value: return True return False [instruction] | Construct a code that takes in an object and checks whether each property includes a certain value [input] | my_dict = { 'name': 'John', 'age': 23, 'pet_name': 'Maggy' } value = 'John'

[output] | def bubble_sort(arr): n = len(arr) # Traverse through all array elements for i in range(n): # Last i elements are already in place for j in range(0, n-i-1): # traverse the array from 0 to n-i-1 # Swap if the element found is greater # [instruction] | Edit the code to construct a bubble sort algorithm. [input] | arr = [5, 2, 1, 7, 8]

[output] | for char in a: print(char, end="") [instruction] | Create a loop which prints out characters from a given input [input] | a = 'Hello World!'

[output] | def is_leap_year(year): if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: return True else: return False else: return True else: return False [instruction] | Design a function which can check if a given year is a leap year [input] |

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