← 목록

Synth · CodeAlpaca일부

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

[output] | # import libraries import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression # load the data imdb = pd.read_csv('imdb.cs [instruction] | Write a code to train a sentiment classification model on the IMDB sentiment analysis dataset. [input] |

[output] | def print_numbers(n): x = list(range(1,n+1)) print([i for i in x if i % 3 == 0 and i % 5 == 0]) # Driver code n = 15 print_numbers(n) [instruction] | Write a code to print out all numbers between 1 and n divisible by 3 and 5 without using a loop. [input] |

[output] | def repeat_string(string, n): """ This function takes a string and an integer as input and returns the string repeated n times. Parameters: string (string): The string that needs to be repeated. n (int): The number of times the string needs to be repeated. Returns: [instruction] | Create a function that takes a string and an integer as input and returns the string repeated n times. [input] |

[output] | # Add the following line to the top of this Python code to make it syntactically correct. def test_it(): print("This is a test") [instruction] | Add the following line to the top of this Python code to make it syntactically correct. [input] | begin def test_it(); print("This is a test")

[output] | def shift_array(arr, k): k %= len(arr) return arr[-k:] + arr[:-k] [instruction] | Create a function that shifts an array by k positions to the right. [input] | arr = [1, 2, 3, 4, 5] k = 3

[output] | def create_list(start, end, step): list = [] while start < end: list.append(start) start += step return list [instruction] | Create a function that takes three parameters, a start number, an end number, and a step. It should return a list containing all the numbers between the start and end numbers in steps of the given size. [input] | start = 0 end = 10 step = 2

[output] | def add_one(arr): for i in range(len(arr)): arr[i] += 1 return arr [instruction] | Write a function to add one to every element in an array of integers. [input] | arr = [1,3,5,7]

[output] | const Navbar = (props) => { return ( <nav isOpen={props.isOpen}> {/* Content of the navbar component */} </nav> ) } [instruction] | Suppose you have a React component named 'Navbar' and you need to add a new prop named 'isOpen'. Please write the code to for this. [input] |

[output] | public static int getArraySum(int[] array) { int total = 0; for (int element : array) { total += element; } return total; } [instruction] | You are requested to implement a function that takes an array of integers and returns the sum of the array. [input] | int[] array = {1, 2, 3, 4, 5};

[output] | <form action=""> <label for="name">Name: </label> <input type="text" name="name" id="name" /> <label for="email">Email: </label> <input type="text" name="email" id="email" /> <label for="address">Address: </label> <input type="text" name="address" id="address" /> <button type="submit"> [instruction] | Create a HTML form that contains 3 fields (name, email and address). [input] |

[output] | SELECT * FROM records WHERE age > 3*30*24*60*60 AND age < 5*12*30*24*60*60; [instruction] | Write a MySQL query to select records that are older than 3 months and younger than 5 years. [input] |

[output] | let obj = { 1: false, 2: true, 3: false, 4: true, 5: false, 6: true, 7: false, 8: true, 9: false, 10: true }; [instruction] | Construct an object in JavaScript where the key is an integer from 1 to 10 and the value is a boolean representing if it is an even number or not. [input] |

[output] | <ul> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4</li> </ul> [instruction] | Edit the following HTML list by adding another item, number 4. [input] | <ul> <li>item 1</li> <li>item 2</li> <li>item 3</li> </ul>

[output] | const sum = (a, b) => a + b; [instruction] | Rewrite the following JavaScript code to use arrow functions instead of regular functions. [input] | function sum(a, b) { return a + b; }

[output] | class Interface { public: virtual int Method1(int x) = 0; virtual std::string Method2(std::string s) = 0; }; [instruction] | Create an interface in C++ with two methods, one that takes an integer and one that takes a string. [input] |

[output] | def split_string(string, separator): return string.split(separator) [instruction] | Create a function to split a string into substrings based on a given separator. [input] | string = "apple,banana,cherry"

[output] | <a href="http://example.com" target="_blank">Link to Website</a> [instruction] | Generate a valid HTML tag that can be used to link to an external website. [input] |

[output] | int arr[3][3] = {{1,2,3}, {4,5,6}, {7,8,9}}; [instruction] | Write a C++ program to declare and initialize a two-dimensional array of numbers. [input] |

[output] | In JavaScript, a class is defined using the class keyword. The class definition consists of a constructor method, which is called automatically when an instance of the class is created, and other methods which can be called on the instance. ``` class MyClass{ constructor(){ //Constructor [instruction] | How do you define a JavaScript class? [input] |

[output] | CREATE TABLE myTable( id INT NOT NULL, name VARCHAR(255) ); [instruction] | Generate valid SQL to create a table with two columns, id and name. [input] |

[output] | A block of code can be commented out in C++ by enclosing it within /* and */, as shown below: /* [block of code] */ [instruction] | Suggest a way to comment out a block of code in C++. [input] |

[output] | In Lua, date strings can be formatted using os.date(). For example, the following code will give the date string in the format "YYYY-MM-DD": dateString = os.date("%Y-%m-%d") [instruction] | Suggest a way to format a date string in Lua. [input] |

[output] | li { color: green; font-size: 14px; font-weight: bold; } [instruction] | Write CSS code to style a list of items with color green, font-size 14px and font-weight bold. [input] |

[output] | my_array = ["Apple", "Banana", "Orange", "Lemon", "Grape"] [instruction] | Create an array of 5 Strings: "Apple", "Banana", "Orange", "Lemon" and "Grape". [input] |

[output] | <!DOCTYPE html> <html> <head> <title>Simple PHP Website</title> </head> <body> <?php $data = [ [ "firstname" => "Oliver", "lastname" => "Smith", "address" => "1234 Main Street, City, Country" ], [ "firstname" => "John", "lastname" => [instruction] | Create a simple php website using the following data records. [input] | [ { "firstname": "Oliver", "lastname": "Smith", "address": "1234 Main Street, City, Country" }, { "firstname": "John", "lastname": "Doe", "address": "5678 Long Road, City, Country" }, { "firstname": "Chris", "lastname": "Fitzgerald", "address": "9123 Eag

[output] | SELECT id, name FROM Users WHERE address = "New York"; [instruction] | Write a SQL query to find the ids and names of all users in the Users table who have address "New York". [input] |

[output] | num = 8573 [instruction] | Convert the following character stream into a number. [input] | char_stream = “8kk573"

[output] | SELECT Id, Name, Age FROM employee; [instruction] | Create a SQL query that performs a SELECT operation on a table "employee" with columns Id, Name, Age. [input] |

[output] | class Bird { constructor(name, color) { this.name = name; this.color = color; } // Add another method or property fly() { console.log(`${this.name} is flying`); } } [instruction] | Suggest a completion for the following JavaScript to define a class. [input] | class Bird {

[output] | SELECT name, score, category FROM scoreboard; [instruction] | Write a SQL query to print all the data in a table "scoreboard" with columns "name", "score", and "category". [input] |

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