instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
Write a code to find the square of the first n numbers. | codefeedback |
What will happen when the following code is executed?
a_list = [1, 2, 3, 4, 5]
for i in a_list:
a_list.append(i + 6)
print(a_list) | codefeedback |
Rewrite the following code so it can take a list as input instead of an integer.
def list_sum(num):
total = 0
for x in range(num):
total += x
return total | codefeedback |
Design a program to find the intersection of two given arrays.
list_one=[5, 10, 15, 20, 25]
list_two=[15, 17, 20, 22, 25, 27] | codefeedback |
Design a program to find the nth Fibonacci number.
n: 10 | codefeedback |
Use the back-propagation algorithm to learn the weights of a given neural network. | codefeedback |
Create a loop to traverse a given binary tree. | codefeedback |
Write an API to return the average transaction amount of a customer. | codefeedback |
Edit a python function to generate the fibonacci sequence.
def fibonacci(n):
a = 1
b = 0
for i in range(n):
print(a)
a, b = b, a+b | codefeedback |
Use the Gaussian algorithm to learn the optimal parameters of a 2D linear regression model.
Training dataset: {(x1,y1), (x2,y2), (x3,y3)} | codefeedback |
Suggest a better algorithm to find the minimum element in a given array. | codefeedback |
Write a regular expression to extract all email addresses from a string.
string = "My email address is john@doe.com and your email address is jane@doe.com" | codefeedback |
Retrieve the number of letters in the following phrase .
"May the force be with you!" | codefeedback |
You need to read a list of strings, split each into 2 substrings, and output the 2 substrings as a tuple.
['international', 'imagination', 'skyscraper'] | codefeedback |
Create a method to reverse a linked list. | codefeedback |
Build a deep learning model in Python to predict the stock price of a given company. | codefeedback |
Write a JavaScript function to sort an array of integers. | codefeedback |
Create a Python program to generate the Fibonacci series between 0 and 10. | codefeedback |
Implement a stack data structure in Java. | codefeedback |
Make sure the following code runs without errors.
def calculate_sum(numbers):
total = 0
for number in numbers
total += number
return total | codefeedback |
Write a code to get the value of pi (to 6 decimal places) using mathematical methods. | codefeedback |
Create a function that takes a string and returns a new string with each character capitalized.
String = "hello!" | codefeedback |
Explain how to implement a heap sort algorithm in Java. | codefeedback |
Suggest a Python code to parse an XML document. | codefeedback |
In Python, write code to identify whether a given string contains only numeric values. | codefeedback |
Write an R function to calculate the mean of a numerical vector. | codefeedback |
Write a SQL query to find the highest salary of a employee in the salary table? | codefeedback |
Write a C++ program to print all prime numbers between 1 and 100. | codefeedback |
Write a function that takes a string and returns a dictionary counting each character in the string. | codefeedback |
Suggest a sorting algorithm to sort the following array in descending order.
arr = [17, 21, 4, 7, 29, 34, 11] | codefeedback |
Modify the following Java program to find the area of a rectangle.
public class Area
{
public static void main(String[] args)
{
double radius = 10;
double area = 3.14 * radius * radius;
System.out.println("The area of the circle = "+area);
}
} | codefeedback |
Generate a list of 10 random capital letters. | codefeedback |
Merge the two lists below together.
list_a = [1,2,3]
list_b = [4,5,6] | codefeedback |
Rewrite the following code into a generator.
def some_function(nums):
output = []
for x in nums:
y = x ** 2
output.append(y)
return output | codefeedback |
Generate a 5-element tuple of random numbers between 5 and 15 using Python. | codefeedback |
Analyze the given Java code and identify the errors.
public class TestClass {
public static void main (String[] args) {
int x = 10;
int y = 20
int z = x + y;
system.out.println("The sum is: " + z);
}
} | codefeedback |
Create a class to represent a two-dimensional vector. | codefeedback |
Compare the performance of Grover's algorithm and classical search algorithms. | codefeedback |
Implement a linked list in Python. | codefeedback |
Create a class in Java that can store a list of students and the courses they are enrolled in. | codefeedback |
Clean the given data in Python by replacing NaN and None with 0.
import pandas as pd
data = [[1, 'John', None], [2, 'Jane', 18], [3, 'Rudy', NaN]]
df = pd.DataFrame(data, columns = ['id', 'name', 'age']) | codefeedback |
Classify the given article as spam or ham.
Hello everyone, this is a spam message. | codefeedback |
Write a Java Method that takes an array of integers and returns true if the array is sorted in ascending order.
array = [7, 18, 24, 55, 98] | codefeedback |
Create a feature for predicting a customer's subscription plan based off their purchase history.
The customer has purchased 2 shirts, 1 hat, and 3 pairs of jeans in the past month. | codefeedback |
Design an algorithm to find the shortest path in a maze using JavaScript. | codefeedback |
Create a SQL query to find the total revenue for services in the month of February. | codefeedback |
Generate a random string of length 8 that only contains alphabets. | codefeedback |
Reverse a given string.
"Hello World!" | codefeedback |
Write a function to check if a given binary tree is a valid binary search tree | codefeedback |
Return a subset of a given array of size K
arr = [3, 6, 2, 5, 7, 4], K = 3 | codefeedback |
Write an algorithm to remove vowels from a string. | codefeedback |
How would you write a program to find the number of prime numbers between 0 and 100? | codefeedback |
Build a model using scikit-learn that classifies the given text data into ‘Positive’ or ‘Negative’.
The customer service was great, and I will definitely recommend this product to others. | codefeedback |
Generate a code snippet to find the highest common factor of two given numbers | codefeedback |
Output the top 3 strings from the given array that have the greatest length
let arr = ["Pineapple", "Apple","Banana", "Strawberry", "Grape"] | codefeedback |
Generate a code snippet to convert a given string to uppercase | codefeedback |
Given a person's name and the current time, print the difference in time from the person's birthday.
name = "John"
time = datetime.datetime(2021, 3, 25, 10, 0, 0) | codefeedback |
Compute the maximum product of two integers in an array.
[-4, 2, -3, 6] | codefeedback |
Describe the steps for implementing a convolutional neural network. | codefeedback |
Generate a string of 5 random characters from the characters A through Z. | codefeedback |
Build a flask server to handle a GET request to the route '/test'. | codefeedback |
Write a sorting algorithm that sorts an array using a bubble sort.
nums=[3,4,1,2,9,6] | codefeedback |
Create a function to generate a random integer between two given numbers. | codefeedback |
Create a function in Python that returns all permutations of a string. | codefeedback |
Given a character sequence, find the longest palindromic substring.
sequence: madam | codefeedback |
Given a positive integer, find the sum of its digits. | codefeedback |
Explain the concept of Generative Adversarial Networks (GANs). | codefeedback |
Find all substrings from a given string. | codefeedback |
Create a neural network in Python to recognize handwriting.
MNIST hand-written digit dataset | codefeedback |
Develop a machine learning algorithm to predict stock prices.
Historical stock prices | codefeedback |
Write pseudo code for finding the maximum element in an array. | codefeedback |
Write a function that takes a sentence and returns the string with all occurrences of the longest word removed.
"This is a very long sentence" | codefeedback |
Create a basic neural network model to distinguish between cats and dogs. | codefeedback |
Generate a function which will validate a phone number using regular expression. | codefeedback |
Modify the given code to multiply two n x n matrices.
def multiply(m1, m2, n):
result = [[0 for x in range(n)] for y in range(n)]
for i in range(n):
for j in range(n):
result[i][j] = 0 | codefeedback |
Generate a list that has the all even numbers between 1 and 50, inclusive. | codefeedback |
Reverse the string given in the input
Hello world | codefeedback |
Create a class that creates a stack object and implements push and pop functions | codefeedback |
Implement the code in the input to the output
def do_something(data):
# TODO: Your code here
pass | codefeedback |
Generate a list comprehension that has the multiples of 3 between 0 and 30 | codefeedback |
Implement a non-recursive algorithm to compute the factorial of a given number
7 | codefeedback |
Create a function to compute the square root of a given number
9 | codefeedback |
Create a list of all the prime numbers between 3 and 20 | codefeedback |
Find the length of the longest substring of a string
text = "Hello, world!" | codefeedback |
Make a jQuery call to retrieve data from a MySQL database | codefeedback |
Write a code to create a 2-D array with size (4,4) and fill it with 1's. | codefeedback |
Write a C++ code snippet to search for a given value (45) in an array.
arr = [12, 4, 17, 6, 21, 45, 33] | codefeedback |
Describe the concept of OOP in programming. | codefeedback |
Write a function to sort a list of strings by length. | codefeedback |
Generate an artificial neural network code to recognize alphanumeric digits. | codefeedback |
Create a function that takes a number "n" as an argument and returns the nth Fibonacci number
n = 15 | codefeedback |
Construct a code to check if an input string is a palindrome.
s = "racecar" | codefeedback |
Create a for loop for printing out the elements in a given list in reverse order.
my_list = [1,2,3,4] | codefeedback |
Create an algorithm to find the smallest positive integer not present in an array.
arr = [2, 3, 7, 6, 8, -1, -10, 15] | codefeedback |
Generate an HTML table that displays the student names and grades in a 3x3 grid.
Student1: B
Student2: A
Student3: C
Student4: D
Student5: F
Student6: A | codefeedback |
Train a Neural Network model to classify handwritten digits. | codefeedback |
Parse and extract the title of this HTML page.
<html><head><title>This is the Page Title</title></head></html> | codefeedback |
Find the sum of the squares of the following numbers.
[2, 3, 4] | codefeedback |
Calculate the sum of the first 10 Fibonacci numbers in Java. | codefeedback |
Write a function that collects elements from two given arrays and creates a new array.
array1 = [1, 2, 3]
array2 = [4, 5, 6] | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.