messages listlengths 2 2 | category stringclasses 3
values | source stringclasses 6
values |
|---|---|---|
[
{
"content": "Describe the classic text editor \"emacs\" in a short paragraph.",
"role": "user"
},
{
"content": "Emacs is a classic text editor created by Richard Stallman. It is a popular and versatile open-source editor used mainly by developers and system administrators. It has a wide range of fe... | instruction | tatsu-lab/alpaca |
[
{
"content": "Optimize an existing Python script to run as efficiently as possible.\ndef spam(divideBy):\n return 42 / divideBy\n\nprint(spam(2))\nprint(spam(12))\nprint(spam(0))",
"role": "user"
},
{
"content": "def spam(divideBy):\n try:\n return 42 / divideBy\n except ZeroDivision... | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "Create a Java code snippet that takes two integers as parameters and prints the larger one.",
"role": "user"
},
{
"content": "public static void printMax(int a, int b) { \n if (a > b)\n System.out.println(a);\n else\n System.out.println(b);\n}",
"role": "assist... | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "A total of 20 students are running a race. 11 students reached the finish line before Yoongi. How many students came later than Yoongi?",
"role": "user"
},
{
"content": "If 11 students reached the finish line before Yoongi, then Yoongi is the 12th student to finish the race. Since ther... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Write a Python program that checks for duplicates in the input list and replaces the duplicates with the occurrence count of the element.\n[1, 2, 3, 2, 1, 3]",
"role": "user"
},
{
"content": "def check_duplicates_replace(list):\n # keep track of counts of elements\n element_count... | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "Bob and Johnny have a leaf raking business. They charge $4 for each bag of leaves they rake. On Monday they raked 5 bags of leaves. On Tuesday they raked x bags of leaves. On Wednesday, they counted their money and found they had $68 for all three days. How many bags of leaves did they rake on Wed... | math | meta-math/MetaMathQA |
[
{
"content": "Generate a valid python program to convert a given string to its title case.\nhello world",
"role": "user"
},
{
"content": "def to_title_case(string):\n words = string.split()\n\n result = []\n for word in words:\n result.append(word.title())\n\n return ' '.join(resu... | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "If Kent has $1,000 and Brooke has twice as much money as Kent, Brittany has 4 times as much money as Brooke, and Alison has half as much money as Brittany, how much money does Alison have?",
"role": "user"
},
{
"content": "Brooke has twice as much money as Kent, so Brooke has 2 * $1,00... | math | meta-math/MetaMathQA |
[
{
"content": "What value of $a$ satisfies the equation $g(a) = 0$ for the function $g(x) = 3x - 4$?",
"role": "user"
},
{
"content": "To find the value of $a$ that satisfies $g(a) = 0$, we set $g(a) = 3a - 4$ equal to 0 and solve for $a$.\nSo, $3a - 4 = 0$.\nAdding 4 to both sides gives $3a = 4$.\nF... | math | meta-math/MetaMathQA |
[
{
"content": "Russel and Jen went to the circus. Jen played a shooting game twice, while Russel rode the carousel three times. If the shooting game costs 5 tickets and the carousel costs 3 tickets. How many tickets did they use?",
"role": "user"
},
{
"content": "Jen used 5 x 2 = <<5*2=10>>10 tickets... | math | openai/gsm8k |
[
{
"content": "Create a SQL query to find the names of all people who are older than 18 years of age.\n+----+--------+------+\n| id | name | age |\n+----+--------+------+\n| 1 | David | 21 |\n| 2 | Emily | 17 |\n| 3 | Rachel | 23 |\n| 4 | John | 12 |\n+----+--------+------+",
"role": "user... | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "At first, Jungkook had 8 apples. How many apples does Jungkook have in total when he is given 7 apples?",
"role": "user"
},
{
"content": "Jungkook originally had 8 apples. When he is given 7 more apples, you simply add the 7 apples to the original 8 apples to find the total number of a... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Kevin is a fruit vendor who sells a total of 50 crates of fruit per week. Last week he sold 13 crates of grapes, some crates of mangoes, and 17 crates of passion fruits. How many crates of mangoes did he sell?",
"role": "user"
},
{
"content": "To find out how many crates of mangoes Kev... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Create an algorithm in Python that takes a string as an input and returns all its anagrams in alphabetical order.\nword",
"role": "user"
},
{
"content": "def getAnagrams(word):\n alphabet = list(word)\n anagrams = []\n \n def getPermutations(alphabet):\n if len(alphabet) == 0:\n ana... | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "Construct a sentence using the present tense of the verb \"eat\".",
"role": "user"
},
{
"content": "I eat breakfast every morning.",
"role": "assistant"
}
] | instruction | tatsu-lab/alpaca |
[
{
"content": "There are enough provisions in a castle to feed some people for 90 days. After 30 days, 100 people leave the castle. There are 90 more days left until all the food runs out. How many people were initially in the castle?",
"role": "user"
},
{
"content": "Let's denote the initial number ... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Generate a creative, on-brand headline for a blog post about how to save money on groceries.",
"role": "user"
},
{
"content": "\"10 Money-Saving Tips for Your Grocery Shopping Expedition!\"",
"role": "assistant"
}
] | instruction | tatsu-lab/alpaca |
[
{
"content": "The average temperature in Orlando in a particular week was 60 degrees. If the temperature on each of the first 3 days in that week was 40, and the temperature for Thursday and Friday was 80 degrees each, calculate the total temperature of the remaining days of that week.",
"role": "user"
},... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Tony wants to build the longest rope he possibly can, so he collects all the rope in his home. He finds some ropes: an 8-foot rope, a 20-foot rope, a 7-foot rope, and three ropes of the same length. Each knot between the ropes makes him lose 1.2 feet per knot. His rope is 35 feet long when he's do... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "If the angle between the vectors $\\mathbf{a}$ and $\\mathbf{b}$ is $43^\\circ,$ what is the angle between the vectors $-\\mathbf{a}$ and $\\mathbf{b}$?",
"role": "user"
},
{
"content": "\nThe angle between two vectors $\\mathbf{a}$ and $\\mathbf{b}$ is defined as $\\theta$ such that\n... | math | meta-math/MetaMathQA |
[
{
"content": "Create a class that represents a circle\nradius = 5.5",
"role": "user"
},
{
"content": "class Circle:\n def __init__(self, radius):\n self.radius = radius\n def area(self):\n return self.radius * self.radius * 3.14\n\nc = Circle(radius) \nprint(c.area()) # Output: ... | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "Alyssa, Keely, and Kendall ordered some chicken nuggets from a fast-food restaurant. Keely and Kendall each ate twice as many as Alyssa, who ate 20 chicken nuggets. How many chicken nuggets did they order in total?",
"role": "user"
},
{
"content": "If Alyssa ate 20 chicken nuggets, and... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Determine the returned value of the following function.\ndef my_fun(x):\n if x > 5:\n return x * 2\n else:\n return x * 3",
"role": "user"
},
{
"content": "If x = 6, the returned value is 12.",
"role": "assistant"
}
] | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "Margaret started a stamp collection. She collected 8 stamps the first day. Each subsequent day she collected 8 more stamps than she had collected the previous day. If she collected stamps for 5 consecutive days, what was the average number of stamps collected per day?",
"role": "user"
},
{... | math | meta-math/MetaMathQA |
[
{
"content": "In a typical tennis tournament with 4 rounds, there are 8 games in the first round, 4 games in the second round, 2 games in the third round, and 1 game in the finals. If each game requires new tennis balls and each can has 3 tennis balls, and on average each game uses 5 cans of tennis balls, what ... | math | meta-math/MetaMathQA |
[
{
"content": "Roger rode his bike for 2 miles this morning, and then 5 times that amount in the evening. How many miles did Roger ride his bike for?",
"role": "user"
},
{
"content": "Roger rode for 2 miles in the morning, and then 5 times that in the evening for 5*2=10 miles ridden in the evening\n... | math | openai/gsm8k |
[
{
"content": "Each bag of jellies contains 3 strawberry-flavored jellies and 4 grape-flavored jellies. If you get 25 bags of new jellies today and the total number of strawberry-flavored jellies is 150, how many grape-flavored jellies will there be?",
"role": "user"
},
{
"content": "If there are 150... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "When Harriett vacuumed the sofa and chair she found 10 quarters, 3 dimes, 3 nickels, and 5 pennies. How much money did Harriett find?",
"role": "user"
},
{
"content": "She found 10 quarters that are $0.25 each so she found 10*.25 = $<<10*.25=2.50>>2.50\nShe found 3 dimes that are $0.1... | math | openai/gsm8k |
[
{
"content": "Lizzy had $30. She loaned out $15 to her friend. How much will Lizzy have if her friend returned the money with an interest of 20%?",
"role": "user"
},
{
"content": "Initially, Lizzy had $30; she loaned out $15 so she has $30-$15 = $<<30-15=15>>15 left\nHer friend is returning the $15 ... | math | openai/gsm8k |
[
{
"content": "Write an SQL query to select all rows from the table \"customers\" that have the same age as the given customer.\ncustomer = (\"John Smith\", 32)",
"role": "user"
},
{
"content": "SELECT *\nFROM customers\nWHERE age = 32",
"role": "assistant"
}
] | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "The number of goals scored in a game against Barca by exactly two players last season accounts for 20% of all goals scored in the league. If the players scored an equal number of goals, and the total number of goals scored in the league against Barca that season is 300, calculate the number of goa... | math | openai/gsm8k |
[
{
"content": "Anna's mom gave her $10.00 to buy anything she wanted from the candy store. She bought 3 packs of chewing gum for a certain price each, 5 chocolate bars at $1 each and 2 large candy canes for $0.50 each. She had $1 left. How much did each pack of chewing gum cost?",
"role": "user"
},
{
... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Dorothy is 15 years old and wants to go to a museum with her family. Her family consists of her, her younger brother, her parents, and her grandfather. The regular ticket cost is a certain amount. People 18 years old or younger have a discount of 30%. Dorothy had $70 before the trip and had $26 le... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Jill and her brother Jack are going apple picking. Jill's basket can hold twice as much as Jack's basket when both are full. Jack's basket is full when it has 12 apples, but currently has space for a certain number more. Jack's current number of apples could fit into Jill's basket 3 times. How man... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Construct a loop in JavaScript that prints out each item in an array.\nlet arr = [1,2,3,4,5]",
"role": "user"
},
{
"content": "for (let i = 0; i < arr.length; i++) {\n console.log(arr[i]);\n}",
"role": "assistant"
}
] | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "Create an HTML page with a basic structure and text.",
"role": "user"
},
{
"content": "<!DOCTYPE html>\n<html>\n <head>\n <title>Basic HTML Page Structure</title>\n </head>\n <body>\n <h1>Hello, World!</h1>\n <p>This is a basic HTML page structure.</p>\n </body>\n</html>",... | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "The certain amount of salt in 10 liters (L) of salt water is 7/10. If you divide the salt water equally into 4 cups, how many liters of salt are in each cup?",
"role": "user"
},
{
"content": "To find out how much salt is in each cup, we first need to determine the total amount of salt ... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "There are 4 indistinguishable marbles and 1 eraser. How many ways are there to list these on a single line?",
"role": "user"
},
{
"content": "Since the marbles are indistinguishable and there is only one eraser that is distinguishable, we can consider the eraser as a unique item and th... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Create a search engine that can take a query and return a list of matching documents.",
"role": "user"
},
{
"content": "# Load libraries\nfrom sklearn.feature_extraction.text import CountVectorizer\nfrom sklearn.metrics.pairwise import cosine_similarity\n\n# Create a corpus\ndoc1 = \"P... | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "Marcus is having a water balloon party. He has 100 balloons. Each balloon holds 3 ounces of water. He can buy 50 ounces of water for $2.5 a bottle. If he walks into the store with 2 $10 bills, how much change will he have after he buys all the water he needs?",
"role": "user"
},
{
"con... | math | openai/gsm8k |
[
{
"content": "Dan spent $32 buying a new backpack, 1 pack of pens, 1 pack of pencils and 5 multi-subject notebooks for school. If the backpack costs $15 and both the pens and pencils cost $1.00 each, how much did each notebook cost?",
"role": "user"
},
{
"content": "Dan spent $32 in total.\nThe bac... | math | meta-math/MetaMathQA |
[
{
"content": "Summarize the flow and ideas of the following paragraph.\nCats have long been celebrated for their independence and mysterious nature. They possess a unique grace and an uncanny cunning in the wild, which makes them desirable pets. Despite their somewhat aloof attitude towards humans, they are gen... | instruction | tatsu-lab/alpaca |
[
{
"content": "Jed’s family wants to buy 6 different board games. Each board game costs $15 and Jed paid using a $100 bill. If the cashier gave Jed only $5 bills for his change, how many bills did Jed receive?",
"role": "user"
},
{
"content": "Jed paid $15 x 6 = $<<15*6=90>>90 for the 6 board games.\... | math | openai/gsm8k |
[
{
"content": "How do you run a Python script from the command line?",
"role": "user"
},
{
"content": "In order to run a python script from the command line, the \"@python\" command and the path to the file should be used. For example, to execute the \"input.py\" file, the command would be \"@python ... | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "If\n\\[\\frac{\\cos^4 \\alpha}{\\cos^2 \\beta} + \\frac{\\sin^4 \\alpha}{\\sin^2 \\beta} = 1,\\]then find the sum of all possible values of\n\\[\\frac{\\sin^4 \\beta}{\\sin^2 \\alpha} + \\frac{\\cos^4 \\beta}{\\cos^2 \\alpha}.\\]",
"role": "user"
},
{
"content": "From the given equatio... | math | meta-math/MetaMathQA |
[
{
"content": "Create a program in Python that uses a for loop to output the division of two numbers.\nNumber 1: 5 \nNumber 2: 3",
"role": "user"
},
{
"content": "for i in range(2):\n print(5/3)",
"role": "assistant"
}
] | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "A family of 12 monkeys collected 10 piles of bananas. 6 piles had 9 hands, with each hand having a certain number of bananas, while the remaining piles had 12 hands, with each hand having 9 bananas. If they divide the bananas equally amongst themselves, each monkey would get 99 bananas. How many b... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "A basement has a 24-foot by 32-foot rectangular floor. The basement is flooded with water to a depth of 18 inches. Three pumps are used to pump the water out of the basement. Each pump will pump 8 gallons of water per minute. If a cubic foot of water contains 7.5 gallons, how many minutes will ... | math | meta-math/MetaMathQA |
[
{
"content": "Dawn earns 48,000 a year in x equal monthly payments. Each month, she saves 10% of her salary. She saves 400 each month. What is the value of unknown variable x?",
"role": "user"
},
{
"content": "To solve this problem, we need to determine the value of x, which represents the number of... | math | meta-math/MetaMathQA |
[
{
"content": "Mary had 6 lambs and 2 of the lambs had 2 babies each. She traded 3 lambs for one goat. One morning, she woke up and found an extra 7 lambs in the field. How many lambs does Mary have?",
"role": "user"
},
{
"content": "Mary starts with 6 lambs.\n2 of the lambs have 2 babies each, wh... | math | meta-math/MetaMathQA |
[
{
"content": "Create a function in Python which will return the maximum and minimum elements from a given list of numbers.\n[3, 4, 7, 1, 9]",
"role": "user"
},
{
"content": "def max_min(lst):\n return max(lst), min(lst)",
"role": "assistant"
}
] | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "Create a Java class named \"MyClass\" with three methods - getName(), setName(), and displayName().",
"role": "user"
},
{
"content": "public class MyClass {\n private String name;\n \n // constructor\n public MyClass(String name) {\n this.name = name;\n }\n \n // getName... | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "Josie and her family went on a safari. She counted 80 antelopes, 34 more rabbits than antelopes, some fewer hyenas than the total number of antelopes and rabbits combined, 50 more wild dogs than hyenas, and the number of leopards was half the number of rabbits. The total number of animals that Jos... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Generate a correct Python program to build an inverted index.\nA text file contains a list of words",
"role": "user"
},
{
"content": "def build_inverted_index(filename):\n inverted_index = {}\n\n with open(filename) as fin:\n for line in fin:\n for word in line.... | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "What is the value of $x^5 - 5x$ when $x = 4$?",
"role": "user"
},
{
"content": "We substitute $x=4$ into the expression $x^5 - 5x$ to get $4^5 - 5(4)$.\nEvaluating the expression, we have $1024 - 20 = \\boxed{1004}$.\nThe answer is: 1004",
"role": "assistant"
}
] | math | meta-math/MetaMathQA |
[
{
"content": "Write a Python program to add two matrices of different sizes.\nmatrix1 = [[1, 2], [3, 4]]\nmatrix2 = [[5, 6, 7], [8, 9, 10], [1, 4, 6]]",
"role": "user"
},
{
"content": "def add_matrix(m1, m2):\n row1 = len(m1) \n col1 = len(m1[0]) \n row2 = len(m2) \n col2 = len(m2[0])\n... | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "Hannah brought $30 to the county fair. She spent half of it on rides and another $5 on dessert. How much, in dollars, is left?",
"role": "user"
},
{
"content": "\nHalf of $30 is $30/2 = $15. \nHannah spent $15 on rides. \nShe also spent an additional $5 on dessert. \nSo in total, she s... | math | meta-math/MetaMathQA |
[
{
"content": "Develop a script in Perl to sort an array.\narr = (11, 12, 4, 15, 6)",
"role": "user"
},
{
"content": "@sorted_arr = sort {$b <=> $a} @arr; \nprint \"@sorted_arr\\n\";",
"role": "assistant"
}
] | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "Jordan has a new hit song on Spotify. 3 months are left in the year, and she currently has 60,000 listens. If the number of listens per month doubles, how many listens will the song have by the end of the year?",
"role": "user"
},
{
"content": "In the first month, the song will have 60... | math | openai/gsm8k |
[
{
"content": "Create an algorithm in Python that takes a list of numbers and returns a new list with only the even numbers.\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
"role": "user"
},
{
"content": "def get_even_numbers(nums_list):\n even_numbers = []\n for num in nums_list:\n if num % 2 == 0:\n e... | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "Output the maximum element of a list\nlist = [1, 23, 12, 38, 56, 9]",
"role": "user"
},
{
"content": "max_element = 56",
"role": "assistant"
}
] | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "In a board game where Yuko and his brother Yuri roll three dice simultaneously and move their game pieces according to the sum of the dice values, Yuri's dice resulted in the combination 2, 4, and 5. On Yuko's turn, he rolled 1, 5, and an unknown value denoted as X. How many squares should Yuko's ... | math | meta-math/MetaMathQA |
[
{
"content": "Joshua and Justin shared $40. Joshua’s share was some multiple of Justin’s. Joshua's share is $30. What is the ratio of Joshua's share to Justin's share?",
"role": "user"
},
{
"content": "If Joshua's share is $30 and the total amount shared is $40, then Justin's share would be $40 - $3... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Code a function in Python to calculate the nth value of the Fibonacci sequence.",
"role": "user"
},
{
"content": "def fibonacci(n): \n if n <= 0: \n return 0 \n elif n == 1: \n return 1\n else: \n return fibonacci(n-1) + fibonacci(n-2)",
"role": "assis... | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "Each pack of hot dogs contains 10 hot dogs (no buns), but each pack of hot dog buns contains 8 buns. Phil buys a number of these packs for a barbecue. After the barbecue, Phil finds that he has X hot dogs left over. What is the SECOND smallest number of packs of hot dogs he could have bought?\n... | math | meta-math/MetaMathQA |
[
{
"content": "Dan owns an ice cream shop and every sixth customer gets a free ice cream cone. Cones cost $2 each. If he sold $100 worth of cones, how many free ones did he give away?",
"role": "user"
},
{
"content": "Let's first calculate how many cones Dan sold for $100. Since each cone costs $2, w... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "There are two different numbers: A and B. Find A from the two-digit addition formula of A7+3B=73.",
"role": "user"
},
{
"content": "Let's analyze the given two-digit addition formula:\n\nA7 + 3B = 73\n\nThis formula represents a two-digit addition where A7 is a two-digit number with A ... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Dina has some dolls. She has twice as many dolls as Ivy. 2/3 of Ivy's dolls are collectors editions, and Ivy has 20 collectors edition dolls. How many dolls does Dina have?",
"role": "user"
},
{
"content": "If 2/3 of Ivy's dolls are collectors editions and she has 20 collectors edition... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "When a number is multiplied by 9 and then divided by 3, it is 27. Find the number.",
"role": "user"
},
{
"content": "Let's call the number we are looking for \"x\".\n\nAccording to the problem, when x is multiplied by 9 and then divided by 3, the result is 27. We can write this as an e... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Create a Python program to convert a given number of inches to centimeters\ninches = 5",
"role": "user"
},
{
"content": "def convert(inches): \n cm = inches * 2.54\n return cm \n \n# Convert inches to cm \nresult = convert(5) \n \n# Output \nprint(\"5 inches =\",result,\"cm\") ... | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "Create a CSS rule to rotate a text 45 degrees",
"role": "user"
},
{
"content": "transform: rotate(45deg);",
"role": "assistant"
}
] | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "Hillary sells handmade crafts for a certain amount per craft. Today, she sells 3 crafts and is given an extra 7 dollars from an appreciative customer. Later on, she deposits 18 dollars from today's profits into her bank account and is left with 25 dollars. How much does Hillary sell each craft for... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Create a method to print all the prime numbers up to n.",
"role": "user"
},
{
"content": "def print_prime_numbers(n):\n primes = [] \n for num in range(2, n + 1): \n is_prime = True\n for i in range(2, num): \n if (num % i == 0): \n is_prim... | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "Create a SQL query to select the top 5 most expensive items from a table.",
"role": "user"
},
{
"content": "SELECT * FROM TABLE_NAME\nORDER BY PRICE DESC\nLIMIT 5;",
"role": "assistant"
}
] | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "Create an optimization problem in Python to maximize a function subject to constraints.",
"role": "user"
},
{
"content": "import numpy as np\nfrom scipy.optimize import minimize\n\n# Define objective function\ndef objective(x):\n return x[0]*x[3]*(x[0]+x[1]+x[2])+x[2]\n\n# Define co... | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "build a class in Python that holds and manipulate a number of high scores for a game.",
"role": "user"
},
{
"content": "class HighScores:\n \n def __init__(self, num_scores):\n self.scores = [0] * num_scores\n self.curr_index = 0 # stores index of last score filled ... | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "Is the following sentence true or false? Humans can breathe underwater.",
"role": "user"
},
{
"content": "False - humans cannot breathe underwater.",
"role": "assistant"
}
] | instruction | tatsu-lab/alpaca |
[
{
"content": "Bob and Jim decide to skip rocks. Bob can skip a rock 12 times. Jim can skip a rock 15 times. If they each skipped 10 rocks, how many total skips did they get?",
"role": "user"
},
{
"content": "Bob skips a rock 12 times, so for 10 rocks, he would have 12 * 10 = 120 skips.\n\nJim skips ... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Write a for loop that prints all odd numbers between 1 and 10.",
"role": "user"
},
{
"content": "for(let i = 1; i <= 10; i++){\n if(i % 2 !== 0) {\n console.log(i);\n }\n}",
"role": "assistant"
}
] | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "Find the root causes of global warming.",
"role": "user"
},
{
"content": "Global warming is largely caused by the emission of greenhouse gases such as carbon dioxide, methane, and nitrous oxide, which trap heat in the atmosphere. These gases can be emitted from natural sources such as ... | instruction | tatsu-lab/alpaca |
[
{
"content": "If Jennie's son's house is located 200 miles away, what is the difference in her average speed when she encounters heavy traffic (taking 5 hours) and when there is no traffic (taking 4 hours)?",
"role": "user"
},
{
"content": "The distance between Jennie's house and her son's house is ... | math | meta-math/MetaMathQA |
[
{
"content": "Peter has 15 birds. 1/3 are ducks. The rest are chickens and require special feed that costs $2 per bird. How much does it cost to feed the chickens?",
"role": "user"
},
{
"content": "2/3 of the birds are chickens because 1 -(1/3)=2/3\nHe has 10 chickens because 15 x (2/3) =<<15*(2/3)=... | math | openai/gsm8k |
[
{
"content": "Create a Python class for a calculator that can add, subtract, divide and multiply two numbers.",
"role": "user"
},
{
"content": "class Calculator:\n \n def __init__(self):\n pass\n \n def add(self, a, b):\n return a + b\n \n def subtract(self, a, b):\n return a - b\n \n def divide(... | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "Missy had a giant piggy bank in her bedroom. Every day she would search the house for change to put in her bank. After 4 years, the bank was opened and it contained $450 in change. The second, third, and fourth-year she doubled the amount of money she put in the bank from the amount she had put in... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Shara borrowed money from her brother some months ago. She returned $10 per month to her brother. Currently, she was able to return half of the money she borrowed. She will still owe her brother $20, 4 months from now. How many months ago did Shara borrow money from her brother?",
"role": "use... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Create a web scraper using Python that can extract tables from any Wikipedia page.\nNot applicable",
"role": "user"
},
{
"content": "import requests\nfrom bs4 import BeautifulSoup\n\n# Function to extract tables from any Wikipedia page\ndef extract_tables(url):\n\n# Make a GET request ... | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "Name one way to protect the environment\nNo Input",
"role": "user"
},
{
"content": "One way to protect the environment is to reduce the use of single-use plastics and switch to reusable, eco-friendly alternatives.",
"role": "assistant"
}
] | instruction | tatsu-lab/alpaca |
[
{
"content": "Implement a method in Python to calculate the factorial of a given number.\n5",
"role": "user"
},
{
"content": "def factorial(x):\n result = 1\n for i in range(1,x+1):\n result = result*i\n return result\n \nprint(factorial(5))",
"role": "assistant"
}
] | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "Rearrange the contents of the list\n[Tomato, Potato, Onion]",
"role": "user"
},
{
"content": "[Onion, Potato, Tomato]",
"role": "assistant"
}
] | instruction | tatsu-lab/alpaca |
[
{
"content": "If there were initially 18 students assigned to a minibus for a field trip, with 8 of them being boys, and the number of boys and girls on the day of the trip was equal because some of the girls couldn't join, how many girls were unable to participate in the field trip?",
"role": "user"
},
... | math | meta-math/MetaMathQA |
[
{
"content": "The teacher told the class that if they averaged at least 75% on their final exam, they could have a pizza party. Everyone took the exam on Monday, except for William, who was allowed to take it on Tuesday. If there are 30 people in the class, and the average before he took the test was a 74%, wha... | math | openai/gsm8k |
[
{
"content": "There are 6 people going on an airplane trip. They each have 5 bags of luggage. Each of their bags weighs the maximum weight allowed, 50 pounds. The airplane can hold a total luggage weight of 6000 pounds. How many more bags at maximum weight can the plane hold?",
"role": "user"
},
{
"... | math | microsoft/orca-math-word-problems-200k |
[
{
"content": "Split a string of words into an array of words.\nstr = \"This is a test string\"",
"role": "user"
},
{
"content": "arr = str.split(\" \")\n# Output: ['This', 'is', 'a', 'test', 'string']",
"role": "assistant"
}
] | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "What is the value of the least positive base ten number which requires six digits for its binary representation?",
"role": "user"
},
{
"content": "A base ten number requires six digits for its binary representation if and only if it is between $2^5$ and $2^6-1$.\n$2^5=32$ and $2^6-1=63... | math | meta-math/MetaMathQA |
[
{
"content": "If $f(x)=\\frac{x+4}{x^2+ax+b}$, and $f(x)$ has two vertical asymptotes at $x=1$ and $x=-2$, find the sum of $a$ and $b$.",
"role": "user"
},
{
"content": "For $f(x)$ to have vertical asymptotes at $x=1$ and $x=-2$, the denominator $x^2+ax+b$ must have factors of $(x-1)$ and $(x+2)$.\n... | math | meta-math/MetaMathQA |
[
{
"content": "Generate a list of 5 natural wonders.",
"role": "user"
},
{
"content": "1. Aurora Borealis\n2. Mount Everest\n3. Grand Canyon\n4. Great Barrier Reef\n5. Victoria Falls",
"role": "assistant"
}
] | instruction | tatsu-lab/alpaca |
[
{
"content": "Implement a quicksort algorithm in JavaScript that takes an array of numbers as input and returns a sorted array.\ninput_array = [21, 4, 1, 3, 9, 20, 25]",
"role": "user"
},
{
"content": "function quicksort(input_array) {\n if (input_array.length <= 1) {\n return input_array;... | code | sahil2801/CodeAlpaca-20k |
[
{
"content": "Write a Python program to retrieve the titles and scores of the top 10 movies rated by users from the IMDB database.\nNot applicable",
"role": "user"
},
{
"content": "import requests\nfrom bs4 import BeautifulSoup\n\nurl = \"http://www.imdb.com/search/title?count=10&sort=user_rating,de... | code | iamtarun/python_code_instructions_18k_alpaca |
[
{
"content": "Jan buys 5 dozen roses. Each rose cost $6. Since he bought so many he only needs to pay 80%. How much did he pay?",
"role": "user"
},
{
"content": "A dozen is equal to 12, so 5 dozen is equal to 5 x 12 = 60 roses.\nEach rose cost $6, so the total cost before the discount is 60 x $6 ... | math | meta-math/MetaMathQA |
[
{
"content": "Create a python program that calculates and prints the average of the three given numbers.\n4, 5, 6",
"role": "user"
},
{
"content": "def avg(x, y, z):\n total = x + y + z\n return total / 3\n\nx = 4\ny = 5\nz = 6\n\naverage = avg(x, y, z)\nprint('Average of the three numbers is:... | code | iamtarun/python_code_instructions_18k_alpaca |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.