Codealpaca 20K
Hugging FaceThis dataset splits the original CodeAlpaca dataset into train and test splits.
Ask a question about this data
Type any question in plain English — Helix builds the chart with AI. Sign in to run it and save your charts.
Data preview
500 rows · 2 columns · showing first 12| # | prompt text | completion text |
|---|---|---|
| 1 | Create a Java class which sorts the given array of numbers. [9, 2, 4, 3, 6, 1] | class ArraySort { void sort(int arr[]) { int n = arr.length; // One by one move boundary of unsorted subarray … |
| 2 | Create an algorithm in JavaScript to find the closest pair of points from a given set of points. let points = [[2, 0], [4, 4], [-2, 2], [-3… | // algorithm to find closest pair of points // uses divide and conquer approach const closestPair = (points) => { // base case: two or… |
| 3 | Change the following loop so that it prints out the numbers from 10 to 1 in descending order. for i in range(1, 11): print(i) | for i in range(10, 0, -1): print(i) |
| 4 | Write an SQL query that returns the 5 most popular books in the library. SELECT * FROM libraryBook | SELECT bookID, bookTitle, COUNT(*) AS Count FROM libraryBook GROUP BY bookID, bookTitle ORDER BY Count DESC LIMIT 5; |
| 5 | Train an AI model to predict whether an email is spam or not. | import nltk from sklearn.feature_extraction.text import CountVectorizer from sklearn.naive_bayes import MultinomialNB # loading data data … |
| 6 | Suggest a solution to the following problem: Write a program to sort a list of strings in alphabetical order. list_of_strings = ['banana', … | list_of_strings.sort() # Sorts the list in alphabetical order |
| 7 | Use a loop in Java to print out the squares of numbers from 1 to 10. | for (int i = 1; i <= 10; i++) { System.out.println(i * i); } |
| 8 | Help debug this code snippet by adding comments with the appropriate error messages. def greetings(name): num = 5 message = "Hello, " + nam… | def greetings(name): # assert name is a string assert isinstance(name, str), "name must be a string" num = 5 # "message" va… |
| 9 | Write a code to parse a URL and return the domain name. https://example.com/page | def get_domain_name(url): parsed_url = urlparse(url) return parsed_url.netloc |
| 10 | Write a function to take three integers as input and return their product. x=3, y=5, z=7 | def product(x,y,z): return x*y*z x = 3 y = 5 z = 7 res = product(x,y,z) print(res) |
| 11 | Edit the following code to make it print out the sum of two numbers. num1 = 10 num2 = 5 print(num1 * num2) | num1 = 10 num2 = 5 print(num1 + num2) |
| 12 | How can you insert a comment into the following CSS code? div { margin: 0 auto; width: 50%; text-align: center; } | /* Center the div element on the page */ div { margin: 0 auto; width: 50%; text-align: center; } |
Interesting queries to try
Columns
- prompt text
- completion text