← 목록

Synth · CodeAlpaca일부

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

[output] | async function myAsync() { const response = await new Promise((resolve, reject) => { setTimeout(() => { resolve("Success!"); }, 1000); }); console.log(response); } myAsync(); // Success! [instruction] | Edit the code so that it can run in JavaScript async/await instead of Promise [input] | const myPromise = new Promise((resolve, reject) => { setTimeout(() => { resolve("Success!"); }, 1000); }); myPromise.then(data => { console.log(data); });

[output] | class Account: def __init__(self, username, password, email): self.username = username self.password = password self.email = email def get_info(self): return (self.username, self.password, self.email) [instruction] | Create a class to save data of a user's account. [input] |

[output] | Numpy arrays are more efficient than lists as they are homogeneous in nature. This means that all the items in a numpy array must be of the same data type, while a list can contain items of any data type. Additionally, numpy arrays can be multi-dimensional while lists are only one-dimensional. Numpy [instruction] | Describe the differences between np.array and a list. [input] |

[output] | for element in list: print(element) [instruction] | Use a loop to print out each element of the list. [input] | list = [1, 2, 3, 4]

[output] | ^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$ [instruction] | Create a Regex pattern to validate mobile phone numbers. [input] |

[output] | CREATE TABLE employees( id INTEGER PRIMARY KEY, first_name TEXT, last_name TEXT, address TEXT, city TEXT, state TEXT, postal_code TEXT ); [instruction] | Create a database table using SQL containing information about employees. [input] | Create table with the following column names and data types: id (integer), first_name (text), last_name (text), address (text), city (text), state (text), postal_code (text)

[output] | <html> <head> <style> .column { float: left; width: 33.33%; padding: 0 10px } </style> </head> <body> <div class="column"> Your content in the first column goes here </div> <div class="column"> Your content in the second column goes here [instruction] | Create a webpage with a two-column layout using HTML. [input] | Create two columns with width of 1/3 and 2/3 respectively

[output] | const { NlpManager } = require('node-nlp'); const manager = new NlpManager({ languages: ['en'] }); manager.addDocument('en', 'Good morning', 'greet.morning'); manager.addDocument('en', 'Good evening', 'greet.evening'); manager.addDocument('en', 'Hi', 'greet.hello'); manager.addAnswer('en', 'gre [instruction] | Create an AI chatbot using JavaScript and Natural Language Processing. [input] |

[output] | $('#element').addClass('className'); // To add $('#element').removeClass('className'); // To remove [instruction] | Write jQuery code to add/remove a class on a webpage. [input] |

[output] | class TemperatureViewer extends React.Component { constructor(props) { super(props); this.state = { tempFahrenheit : 0, tempCelsius: 0, tempKelvin: 0 }; this.handleTemperatureChange = this.handleTemperatureChange.bind(this); } handleTemperatureChange(tempFa [instruction] | Create a web application in React that displays the temperature in Fahrenheit, Celsius and Kelvin. [input] |

[output] | import nltk from nltk.sentiment.vader import SentimentIntensityAnalyzer sid = SentimentIntensityAnalyzer() text = "The movie is awesome" scores = sid.polarity_scores(text) print(scores['compound']) # Output 0.6249 [instruction] | Use NLTK to analyse the sentiment of a given text. [input] | The movie is awesome

[output] | section .data msg db 'Hello, World!', 10 len equ $ - msg section .text global _start ;must be declared for linker (ld) _start: ;tells linker entry point mov edx,len ;message length mov ecx,msg ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) [instruction] | Write an assembly language program to print "Hello, World!" [input] |

[output] | public class Customer { private int id; private String firstName; private String lastName; private String email; private String address; // getter and setter methods public int getId() { return id; } public void setId(int id) { this.i [instruction] | Create a customer class in Java that can be used to store information about customers. [input] | Create a class with field names: id (integer), firstName (text), lastName (text), email (text), address (text)

[output] | <?php echo "Hello, World!"; ?> [instruction] | Write a PHP script that prints out "Hello, World!" on the web page. [input] |

[output] | $result = array_filter(["abc123", "123abc", "abc456", "abc"], function($value){ return preg_match('/^\d+$/', $value); }); print_r($result); # Output Array ( [1] => 123abc [2] => 456 ) [instruction] | Filter out a given array of strings and make sure that the strings only contain digits. [input] | Filter array of strings ["abc123", "123abc", "abc456", "abc"]

[output] | import nltk from sklearn.feature_extraction.text import CountVectorizer from sklearn.naive_bayes import MultinomialNB # loading data data = [('This is an email about about a promotion', 'spam'), ('We want to transfer money to your account', 'spam'), ('This email is about programming', 'not_spam') [instruction] | Train an AI model to predict whether an email is spam or not. [input] |

[output] | """ Python script to determine how many lowercase letters are in a given string """ # Initialize a variable to count the lowercase letters lowercase_letter_count = 0 # Loop through each character in the string for char in string: # Check if the character is a lowercase letter if char.islo [instruction] | Write a Python script to determine how many lowercase letters are in a given string. [input] | string = "Hello World!"

[output] | """ Java method to check if a string is a palindrome """ public static boolean isPalindrome(String s) { //base case if(s.length() == 0 || s.length() == 1) return true; if(s.charAt(0) == s.charAt(s.length()-1)) return isPalindrome(s.substring(1, s.length()-1)); //i [instruction] | Write a Java method to check if a string is a palindrome (same forwards and backwards). [input] | string = "racecar"

[output] | """ Java class to store the number of letters, numbers and special characters in a given string """ public class StringInfo { // Instance Variables int letterCount; int numberCount; int specialCharCount; // Constructor to initialize all the instance variables public String [instruction] | Design a class in Java that stores the number of letters, numbers, and special characters in a given string. [input] |

[output] | function biggestNum(){ var num1 = parseInt(prompt("Please enter the first number: ")); var num2 = parseInt(prompt("Please enter the second number: ")); if(num1 > num2){ alert("The largest number is: " + num1); } else if(num2 > num1){ alert("The largest number is: " + num2); } else{ aler [instruction] | Write a JavaScript program that allows the user to input two numbers and shows the bigger number. [input] |

[output] | import matplotlib.pyplot as plt x_list = [155, 159, 166, 165, 186] y_list = [50, 60, 55, 45, 75] plt.scatter(x_list, y_list ) plt.xlabel("Height (cm)") plt.ylabel("Weight (kg)") plt.title("Height vs Weight of Grade 8 Students") plt.show() [instruction] | Generate a graphical representation of a dataset. [input] | The following data describes the height of students in grade 8: X: 155 cm , 159 cm , 166 cm , 165 cm, 186 cm Y: 50 kg , 60 kg , 55 kg, 45 kg , 75 kg

[output] | x = [1, 2, 3, 4] y = list(set(x)) y.sort() print(y) [instruction] | Modify the following Python code to print the program output unique and ordered. [input] | x = [1, 2, 3, 4, 4, 3, 1] print(x)

[output] | <table> <tr> <th>Header1</th> <th>Header2</th> </tr> <tr> <td>Value1A</td> <td>Value1B</td> </tr> <tr> <td>Value2A</td> <td>Value2B</td> </tr> <tr> <td>Value3A</td> <td>Value3B</td> </tr> </table> [instruction] | Create an HTML table that contains the following string values and rows. [input] | Header1 Header2 Value1A Value1B Value2A Value2B Value3A Value3B

[output] | <?php function checkEqual($a, $b) { if ($a == $b) { return true; } else { return false; } } ?> [instruction] | Create a PHP program that declares a function that takes two parameters. The function should check if the two parameters are equal and if so, return true. [input] |

[output] | arr = ["cat", "dog", "fish"] [instruction] | Create an array in Ruby that contains the following strings: "cat", "dog", "fish". [input] |

[output] | h1 { font-size: 3rem; } [instruction] | Create a CSS style sheet that changes the font size of all 'h1' tags to "3rem". [input] |

[output] | List<string> fruits = new List<string> { "apple", "banana", "mango" }; foreach (string fruit in fruits) { Console.WriteLine(fruit); } [instruction] | Write a C# code snippet to create a list with the following string payload and print it out. [input] | "apple", "banana", "mango"

[output] | def printEven(n): for i in range(2, n+1): if(i % 2 == 0): print(i, end = " ") [instruction] | Write a Python function that takes a number n as parameter and prints out all even numbers from 2 to n. [input] |

[output] | SELECT * FROM people WHERE name='John'; [instruction] | Create a SQL query to select the records with the name "John" from the table "people". [input] |

[output] | import Foundation var a = 0 var b = 0 var c = 0 print("Enter 3 values:") if let aInput = readLine() { if let aInt = Int(aInput) { a = aInt } } if let bInput = readLine() { if let bInt = Int(bInput) { b = bInt } } if let cInput = readLine() { if let cInt = Int [instruction] | Create a Swift program that reads in three values from the user and prints out the maximum value. [input] |

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