← 목록

Synth · CodeAlpaca일부

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

[output] | model = keras.Sequential([ keras.layers.Dense(64, activation='relu', input_shape=(len(features.keys()),)), keras.layers.Dense(32, activation='relu'), keras.layers.Dense(1, activation='sigmoid') ]) model.compile(optimizer='adam', loss='binary_crossentropy', [instruction] | Build a Keras model to predict whether a patient has cancer. [input] |

[output] | from sklearn.preprocessing import StandardScaler from sklearn.decomposition import PCA pipeline = Pipeline(steps=[ ('scaler', StandardScaler()), ('pca', PCA()) ]) [instruction] | Design a pipeline in Scikit-learn to preprocess a given dataset. [input] |

[output] | intNum = int(binaryNum, 2) [instruction] | How to convert a binary string to an integer number? [input] | binaryNum = "1101"

[output] | import base64 string = base64.b64decode(base64_string).decode("utf-8") [instruction] | How to decode a Base64 string to its corresponding string representation in Python? [input] | base64_string = "SGVsbG8gV29ybGQ="

[output] | word = word[:len(word)-1] [instruction] | How to remove the last character of a string in Python? [input] | word = "Hello"

[output] | Create a Spreadsheet with the following columns: Month, Sales ($), Hours Worked. Fill in the rows with the data given above. [instruction] | Create an Excel spreadsheet that compares the performance of an employee over two different months. [input] | January data: Sales: $20,000, Hours worked: 200 February data: Sales: $25,000 Hours worked: 250

[output] | A multithreaded program is a software program or application that uses multiple threads to execute different parts of its code simultaneously. This allows for faster execution of the program by using more than one processor core at the same time. [instruction] | What is a multithreaded program? [input] |

[output] | <table> <tr> <th>location</th> <th>age</th> <th>name</th> </tr> <tr> <td>Paris</td> <td>28</td> <td>John</td> </tr> <tr> <td>Berlin</td> <td>32</td> <td>Mary</td> </tr> <tr> <td>London</td> [instruction] | Create an HTML table that displays the data in a given JSON object. [input] | { "cols":["location", "age", "name"], "rows":[ ["Paris", 28, "John"], ["Berlin", 32, "Mary"], ["London", 21, "Andy"] ] }

[output] | SELECT EmployeeId, AVG(Sales) as SalesAverage FROM SALES GROUP BY EmployeeId ORDER BY SalesAverage DESC LIMIT 5; [instruction] | Write a SQL script to display the top 5 average sales by employee. [input] | Table: SALES columns: EmployeeId, Sales

[output] | <html> <head> <title>City Temperature Monitor</title> </head> <body> <h1>City Temperature Monitor</h1> <table> <thead> <tr> <th>City</th> <th>Temperature</th> </tr> </thead> <tbody> <tr> [instruction] | Build an HTML page to display the current temperature in major cities. [input] |

[output] | #!/bin/bash string="Hello World" echo $string [instruction] | Build a bash script that prints out a string of characters. [input] | string="Hello World"

[output] | import java.util.Scanner; public class GreetStudent { public static void main(String[] args) { // Create a Scanner object Scanner scanner = new Scanner(System.in); // Accept a student name System.out.println("Please enter student name:"); String studen [instruction] | Write a java code to accept a student name and display a greeting. [input] |

[output] | # Install packages install.packages("wordcloud") # Load libraries library(tm) library(wordcloud) # Create a text corpus text_corpus <- Corpus(VectorSource(text)) # Generate a word cloud wordcloud(text_corpus, min.freq = 1,random.order=FALSE,rot.per=0.35,max.words= 100) [instruction] | Write an R script to generate a word cloud of a given text. [input] | text = "This is a sample text to generate a word cloud."

[output] | #include<iostream> class Point { private: int x; int y; int z; public: Point(int x, int y, int z) { this->x = x; this->y = y; this->z = z; } int getX() { return x; } int getY() { return y; } int getZ() { return z; } }; int main() { Point [instruction] | Define a class in C++ to represent a point in 3-dimensional space. [input] |

[output] | let numbers = [1, 2, 3, 4]; let result = numbers.reduce((a, b) => a + b); console.log("Result: " + result); [instruction] | Write a Javascript code to add four numbers and print the result. [input] | numbers = [1, 2, 3, 4]

[output] | #!/bin/bash string1="Hello" string2="World" echo $string1$string2 [instruction] | Create a bash script to concatenate two given strings. [input] | string1="Hello" string2="World"

[output] | SELECT MIN(salary) FROM (SELECT salary FROM employee ORDER BY salary ASC LIMIT 2, 1) as result; [instruction] | Show the query to find the 3rd smallest salary in the 'employee' table [input] |

[output] | Bubble sort works by comparing adjacent elements of the list and swapping them if they are out of order. It passes through the list multiple times, with each pass through the list moving the highest value elements to their correct position. This process continues until the list is fully sorted. [instruction] | Describe the effects when sorting a list using bubble sort [input] |

[output] | def quicksort(arr): if len(arr) <= 1: return arr pivot = arr[len(arr) // 2] left = [x for x in arr if x < pivot] middle = [x for x in arr if x == pivot] right = [x for x in arr if x > pivot] return quicksort(left) + middle + quicksort(right) sorted_list = quicksort( [instruction] | Sort a list of integers using quicksort [input] | list = [4,2,1,5,3]

[output] | def extract_domain(url_list): domains = list() for url in url_list: url_parts = url.split('.') domains.append(url_parts[-2]+'.'+url_parts[-1]) return domains domain_list = extract_domain(url_list) [instruction] | Extract the domain names from the given list of URLs [input] | url_list = [ "www.abcd.com", "www.something.co.in", "www.example.ng" ]

[output] | public static void sortMerge (int [] array) { //Array must have more than one element if (array.length > 1) { int len = array.length; //Split vector into two halves int mid = len/2; int left [] = Arrays.copyOfRange (array, 0, mid); in [instruction] | Generate a code in Java for sorting an array using Mergesort. [input] |

[output] | class Map(object): def __init__(self): # a dictionary-based data structure # to store (key, value) pairs self.data = {} # insert the given value with the given key def insert(self, key, value): self.data[key] = value # get the val [instruction] | Generate a correct Python code for a data structure which supports the following operations - [input] | insert(key, value) get(key) delete(key)

[output] | public class Fibonacci { static int fib(int n) { int f[] = new int[n+2]; // 1 extra to handle case, n = 0 int i; /* 0th and 1st number of the series are 0 and 1*/ f[0] = 0; f[1] = 1; for (i = 2; i <= n; i++) { f[i] = f[i-1] + f[i-2]; [instruction] | Write a script in Java for printing the first n Fibonacci numbers. [input] |

[output] | num1 = int(input("Enter the first number: ")) num2 = int(input("Enter the second number: ")) sum = num1 + num2 print("The sum of the two numbers is", sum) [instruction] | Modify the following Python program to contain an input. [input] | num1 = 10 num2 = 20 sum = num1 + num2 print("The sum of two numbers is",sum)

[output] | def analyze_sorting_performance(list): """ Analyze the performance of different sorting algorithms on the given list. """ insertion_sort_list = list.copy() insertion_sort(insertion_sort_list) bubble_sort_list = list.copy() bubble_sort(bubble_sort_list) merge_sor [instruction] | Write a Python function to analyze the performance of different sorting algorithms. [input] | List = [6, 8, 0, 1, 4, 5, 7, 3, 2, 9]

[output] | class Student: def __init__(self, name, age, gender): self.name = name self.age = age self.gender = gender def set_details(self, name, age, gender): self.name = name self.age = age self.gender = gender def get_details(self): [instruction] | Create a class in Python that can be used to store the details of a student. [input] |

[output] | def find_pair(lst, target_sum): """ Given a list of integers and a target sum, this function returns a pair of said integers that add up to the target sum. """ seen = set() for num in lst: inverse = target_sum - num if inverse in seen: return [instruction] | Given a list of integers and a target sum, write a function that returns a pair of said integers that add up to the target sum. [input] | list = [3, 9, -4, 0, -7, 8] and target sum = -4

[output] | def binary_search(lst, target): """ Implements a binary search algorithm in Python for searching for a specific element in the given list of numbers. """ low = 0 high = len(lst)-1 while low <= high: mid = (low + high)//2 if lst[mid] == target: [instruction] | Implement a binary search algorithm in Python for searching for a specific element in a given list of numbers. [input] | list = [1, 3, 5, 7, 9, 11 ] and target number =7

[output] | SELECT * FROM Students WHERE gender = 'female' AND age >= 18 [instruction] | Write a comprehensive SQL query that returns all the female students who are over 18 years old. [input] | Table Students | id | gender | age | |-----|--------|-----| | 1 | female | 20 | | 2 | male | 21 | | 3 | female | 17 | | 4 | female | 19 |

[output] | import re words = re.findall(r'\bA\w+', text) [instruction] | Write a regular expression in Python to find all words that start with "A". [input] |

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