← 목록

Synth · CodeAlpaca일부

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

[output] | SELECT * FROM Sales WHERE date BETWEEN '2021-04-01'AND '2021-04-15'; [instruction] | Write a MySQL query that retrieves all data from the table 'Sales' for the date range 01-04-2021 and 15-04-2021 using the date column. [input] |

[output] | n_words = len(passage.split()) print("The number of words in the passage is:", n_words) [instruction] | Determine the number of words in the given passage using text processing in Python. [input] | passage = "Once upon a midnight dreary, while I pondered, weak and weary"

[output] | mylist = list(set(mylist)) print(mylist) [instruction] | Given a list containing strings, write a Python program to filter out unique strings. [input] | mylist = ["fox", "fox", "cat", "dog", "dog"]

[output] | public class MyClass { private int variable1; private int variable2; public MyClass(int variable1, int variable2) { this.variable1 = variable1; this.variable2 = variable2; } public int getVariable1() { return variable1; } public void [instruction] | Create a class in Java with private variables, getter and setter method, and constructor. [input] |

[output] | def selectNthSmallest(arr, n): # sort the array arr = sorted(arr) # return the nth smallest element return arr[n-1] # Driver code arr = [11, -2, 4, 9, -5, 7] n = 3 # Output print(selectNthSmallest(arr, n)) [instruction] | Design a function to select the nth smallest element from an array. [input] | int[] arr = {11, -2, 4, 9, -5, 7}

[output] | function add(a, b) { return a + b; } [instruction] | Convert a Python function to a JavaScript function. [input] | def add(a, b): return a + b

[output] | def is_prime(x): if x<2: return False for i in range(2, int(x**0.5)+1): if x % i == 0: return False return True for x in range(2,1001): if is_prime(x): print(x) [instruction] | Write a code to print all prime numbers up to 1000. [input] |

[output] | Multithreading in Java is a process by which multiple threads can exist within the context of a single program and run concurrently. This allows for multiple processing tasks to be accomplished at the same time and makes the most of your available processing power. In a multithreaded application, th [instruction] | Describe how multithreading works in Java. [input] |

[output] | var array = [5, 7, 15] array.append(21) print(array) [instruction] | Editor a Swift code to add item into an array. [input] | var array = [5, 7, 15]

[output] | let teamMembers = { "Tom": 30, "Harry": 25, "Sally": 28 }; [instruction] | Create a JavaScript variable which stores a dictionary of team members and their respective ages. [input] | { "Tom": 30, "Harry": 25, "Sally": 28 }

[output] | A B + C D - * [instruction] | Convert a given expression to the postfix notation. [input] | (A + B) * (C - D)

[output] | SELECT * FROM licenses WHERE license_state = 'CA'; [instruction] | Create a SQL query to find all records from the table "licenses" with license state "CA". [input] |

[output] | for (let i = 0; i < arr.length; i++) { console.log(arr[i] * arr[i]); } // Output: 1 4 9 [instruction] | Execute a loop over all elements of a given array and print the square of each element. [input] | [1,2,3]

[output] | import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.neural_network import MLPRegressor # Read data into a dataframe df = pd.read_csv('stock_data.csv') # Split the data into features and target X = np.array(df[['open', 'high', 'low', 'volume']]) y = np.array [instruction] | Create an artificial neural network to predict the stock prices. [input] |

[output] | import mysql.connector mydb = mysql.connector.connect( host="localhost", user="username", password="password" ) mycursor = mydb.cursor() mycursor.execute("SELECT * from products") result = mycursor.fetchall() for row in result: print(row) [instruction] | Connect to a MySQL database on localhost, select all columns from the table 'products' and display the results. [input] |

[output] | import java.util.Arrays; public class SortList { public static void main(String[] args) { int unsortedList[] = {7, 6, 5, 4, 3, 2, 1}; Arrays.sort(unsortedList); int n = unsortedList.length; for (int i=n-1; i>=0; i--) System.out.print(uns [instruction] | Write a Java program for sorting a given list of numbers in descending order. [input] | unsortedList = [7, 6, 5, 4, 3, 2, 1]

[output] | def countWords (myString): return len(myString.split()) num = countWords(myString) print("Number of words =", num) [instruction] | Write a Python code snippet for a function to calculate the number of words in a given string. [input] | myString = "The sky is blue"

[output] | SELECT SUM(salary) FROM employees WHERE department = 'department_name'; [instruction] | Write a PL/SQL query to display the sum of salaries of all the employees in a given department. [input] |

[output] | public static void reverse(int arr[]) { int i, j; int n = arr.length; for (i = 0; i < n/2; i++) { j = n - i - 1; int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } } [instruction] | Write a Java function for reversing a given array of integers. [input] | arr = [1,2,3,4,5,6]

[output] | DELETE FROM friends WHERE first_name = 'John'; [instruction] | Construct a SQL query to delete all the records from a table named 'friends' where the first name is "John". [input] |

[output] | function encodeBase64(myString) { return btoa(myString); } var myStringEncoded = encodeBase64(myString); console.log(myStringEncoded); [instruction] | Create a JavaScript function to encode a given string with Base64 encoding. [input] | myString = "Hello World!"

[output] | using System; namespace HelloWorld { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } } } [instruction] | Construct a C# program for displaying "Hello World!" on the console. [input] |

[output] | <?php // Redirect after 4 seconds header("Refresh: 4; url=http://example.com"); ?> [instruction] | Construct a PHP script to redirect a page to another page after 4 seconds. [input] |

[output] | #include<iostream> using namespace std; void bubbleSort(int unsortedList[], int n) { int i, j; for (i = 0; i < n-1; i++) for (j = 0; j < n-i-1; j++) if (unsortedList[j] > unsortedList[j+1]) { int temp = unsortedList[j]; un [instruction] | Write a C++ program for sorting a given list of numbers using bubble sort algorithm. [input] | unsortedList = [7, 6, 5, 4, 3, 2, 1]

[output] | var today = new Date(); var lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1, 0); var lastDayOfMonthTime = lastDayOfMonth.toLocaleString(); console.log(lastDayofMonthTime); [instruction] | Write a code snippet in JavaScript to get the date and time of the last day of the current month. [input] |

[output] | int[] arr = {1, 2, 3, 4, 5}; System.out.println(arr[1]); [instruction] | Modify the following Java code to print the second element in a given array. [input] | int[] arr = {1, 2, 3, 4, 5};

[output] | console.log() [instruction] | What is the name of the method used to log a message to the console in JavaScript? [input] |

[output] | [0, 1, 0, 1, 0, 1, 0, 1, 0, 1] [instruction] | Create an array of size ten with every even slot filled with the value 0 and every odd slot filled with the value 1. [input] |

[output] | You can access the fifth element in an associative array in PHP by using the syntax $array['key_name'], where key_name is the key for the fifth element. [instruction] | Describe how to access the fifth element in an associative array in PHP. [input] |

[output] | public static String decToBinary(int n) { String s=""; while(n > 0) { int a = n % 2; s = a + s; n = n / 2; } return s; } [instruction] | Create a Java method that takes a decimal number as an argument and returns its binary equivalent. [input] |

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