← 목록

Synth · CodeAlpaca일부

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

[output] | public class CharacterCount { public static void main(String[] args) { String str = "GPT models are a type of machine learning algorithms"; int[] count = new int[256]; for (int i = 0; i < str.length(); i++) count[str.charAt(i)]++; for (int i = 0; i < [instruction] | Create a Java program to count character occurrences in a given string. [input] | String = "GPT models are a type of machine learning algorithms"

[output] | .header { font-family: sans-serif; font-weight: bold; font-size: 1.5em; color: #333; margin-bottom: 40px; text-align: center; } [instruction] | Create a CSS class called "header" with some styling. [input] |

[output] | The purpose of machine learning is to develop algorithms and models that are able to learn from data and make predictions or decisions without being explicitly programmed. Machine learning algorithms can discover hidden patterns from large amounts of data and use the knowledge acquired to improve th [instruction] | Describe the purpose of machine learning. [input] |

[output] | let student = { name: "John", age: 25, grade: "A" }; [instruction] | Create a JavaScript object literal for a student with properties (name, age, grade). [input] |

[output] | The result is 1000. [instruction] | Calculate the result when a power of 10 is raised to the power of 3 [input] |

[output] | This is an isosceles triangle. [instruction] | Identify the type of triangle when given three sides [input] | side1 = 10, side2 = 10, side3 = 8

[output] | function someFunction(arr){ console.log('someFunction called'); let str = "" for (const obj of arr){ str += `object is ${obj.key1} ` } return str; } [instruction] | Update the following Node.js function so that it can handle an array of objects. [input] | function someFunction(obj1, obj2){ console.log('someFunction called'); return `object 1 is ${obj1.key1} object 2 is ${obj2.key2}`; }

[output] | SELECT * FROM Employees WHERE age > 30; [instruction] | Write a SQL query to find all employees over the age of 30. [input] |

[output] | 2675019 [instruction] | Generate a unique seven-digit number. [input] |

[output] | import React, { useState, useEffect } from 'react'; const Clock = () => { const [time, setTime] = useState(new Date()); useEffect(() => { const handle = setInterval(() => setTime(new Date()), 1000); return () => clearInterval(handle); }, []); return ( <div> [instruction] | Create a React component that updates itself with the current time every second. [input] |

[output] | import java.time.LocalDateTime; import java.time.Period; public class DateTime { public static void main(String[] args) { LocalDateTime dateTime1 = LocalDateTime.of(2020,11,5,14,45); LocalDateTime dateTime2 = LocalDateTime.of(1999,1,15,9,30); Period diff = Period.betw [instruction] | Update the following Java code to print the difference between two dates in years, months and days [input] | import java.time.LocalDateTime; public class DateTime { public static void main(String[] args) { LocalDateTime dateTime1 = LocalDateTime.of(2020,11,5,14,45); LocalDateTime dateTime2 = LocalDateTime.of(1999,1,15,9,30); // Update code to print the difference } }

[output] | function countMatchingItems(arr1, arr2) { return arr1.filter(num => arr2.includes(num)).length; } count = countMatchingItems(arr1, arr2); console.log(count); // Output: 2 [instruction] | Write a JavaScript function to find the number of matching items in two arrays. [input] | arr1 = [1, 2, 3, 4] arr2 = [3, 4, 5, 6]

[output] | <!DOCTYPE html> <html> <head> <title>My Page</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> </body> </html> [instruction] | Edit the following HTML to link the page with a stylesheet [input] | <!DOCTYPE html> <html> <head> <title>My Page</title> </head> <body> </body> </html>

[output] | <?php echo 'Current week number: ' . date('W'); ?> [instruction] | Write a PHP script to print the current week number [input] |

[output] | from flask import Flask, request app = Flask(__name__) users = {"John": "123456", "Jenny": "456789"} @app.route('/', methods=['GET']) def root(): if request.authorization and request.authorization.username in users \ and request.authorization.password == users[request.authorizatio [instruction] | Create an API endpoint in Python with Flask that requires authentication. [input] | users = {"John": "123456", "Jenny": "456789"}

[output] | <form action=""> Name:<br> <input type="text" name="name"> <br> Age:<br> <input type="number" name="age"> <br> Email:<br> <input type="email" name="email"> <br><br> <input type="submit" value="Submit"> </form> [instruction] | Create an HTML form for inputting user details. [input] | name, age, email

[output] | CREATE TABLE customer ( ID INTEGER PRIMARY KEY, name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, phone_number VARCHAR(255) NOT NULL ); CREATE TABLE payment ( payment_id INTEGER PRIMARY KEY, customer_id INTEGER NOT NULL, amount INTEGER NOT NULL, date DATETIME NOT NULL, FOREIGN KEY (customer_ [instruction] | Create a SQL database schema for storing customers and their payments. [input] | customer(id, name, email, phone_number); payment(payment_id, customer_id, amount, date);

[output] | SELECT customer.* FROM customer JOIN payment ON customer.ID = payment.customer_id WHERE payment.amount > 100; [instruction] | Create a MySQL query for finding customers who paid more than $100. [input] | payment

[output] | SELECT AVG(salary) OVER (PARTITION BY department) AS department_avg_salary FROM salary; [instruction] | Write a query with window functions in PostgreSQL to calculate the average salary per department. [input] | salary

[output] | import React from 'react'; const Header = () => { return ( <div> <h1>Header</h1> <button>Button 1</button> <button>Button 2</button> </div> ) } export default Header; [instruction] | Create a component in React for display a header with two buttons. [input] |

[output] | const { Client } = require('pg'); const client = new Client({ connectionString: process.env.DATABASE_URL }); async function createCustomerTable() { await client.connect(); const query = ` CREATE TABLE customers ( customer_id SERIAL PRIMARY KEY, first_name VARCHAR(255) NOT NU [instruction] | Create a Migration Script in Node.js for creating a table for customers. [input] | customer_id, first_name, last_name, email

[output] | * { font-weight: bold; } [instruction] | Create a CSS rule for making all text elements bold. [input] |

[output] | let name = 'John Doe'; let city = 'New York'; [instruction] | Create two variables "name" and "city" and assign your name and the city you live in to them. [input] |

[output] | function isOdd(number) { return number % 2 === 1; } [instruction] | Write a code snippet that checks whether a number is odd or even. [input] |

[output] | words_frequencies = {'the': 2, 'quick': 1, 'brown': 1, 'fox': 1, 'jumps': 1, 'over': 1, 'lazy': 1, 'dog': 1} [instruction] | Create a word frequency dictionary for the following sentence: [input] | "The quick brown fox jumps over the lazy dog."

[output] | UPDATE customers SET age = 30 WHERE customer_id = 24; [instruction] | Write a SQL statement to update the age of a customer with a specific ID. [input] | Customer_id = 24, Age = 30

[output] | arr.sort() # arr = [2, 4, 6, 8] [instruction] | Sort the following array from smallest to largest. [input] | [4, 6, 2, 8]

[output] | class Vehicle { constructor(brand, model) { this.brand = brand; this.model = model; } } [instruction] | Create a JavaScript class called "Vehicle" with two properties: brand and model. [input] |

[output] | const items = [ { company: 'A', date: '02-09-19' }, { company: 'B', date: '18-4-19' }, { company: 'C', date: '03-12-19' }, { company: 'A', date: '29-07-18' }, ]; // Complete code here function latestDateForCompany(items, company) { let latestDate; for (let item of items) { const { c [instruction] | Complete the following javascript code to perform a task. [input] | const items = [ { company: 'A', date: '02-09-19' }, { company: 'B', date: '18-4-19' }, { company: 'C', date: '03-12-19' }, { company: 'A', date: '29-07-18' }, ]; // Complete code here

[output] | def f(x): numbers = [] for i in range(1, x + 1): numbers.append(x * i) return numbers [instruction] | Rewrite the following code snippet to improve readability. [input] | def f(x): return [x * i for i in range(1, x + 1)]

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