question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
John was given 24 crayons and each crayon box has 10 pieces. How many boxes of crayons did John get?
def solve() -> int: crayons = 24 piecesPerBox = 10 totalBoxes = crayons//piecesPerBox result = totalBoxes return result
If it takes 8 hours for 4 machines to complete a job, how long will it take for 5 machines to complete the same job?
def solve() -> int: num_machines_1 = 4 hours_1 = 8 num_machines_2 = 5 work_done = num_machines_1 * hours_1 hours_2 = work_done / num_machines_2 result = hours_2 return result
A bakery has 156 cupcakes of various flavors. There are four times as many vanilla cupcakes as chocolate. There are eleven fewer strawberry cupcakes than vanilla cupcakes. If there are 12 chocolate cupcakes, how many pink and purple cupcakes are there if they have the same amount and there are no other flavors?
def solve() -> int: chocolate_cupcakes = 12 vanilla_cupcakes = 4 * chocolate_cupcakes strawberry_cupcakes = vanilla_cupcakes - 11 total_cupcakes = chocolate_cupcakes + vanilla_cupcakes + strawberry_cupcakes pink_and_purple_cupcakes = (total_cupcakes - 156) / 2 result = pink_and_purple_cupcakes ...
Amanda has 24 stickers. She traded seven of them with her friend and then lost five of them. How many stickers does Amanda have left?
def solve() -> int: stickers = 24 traded = 7 lost = 5 stickers -= traded stickers -= lost result = stickers return result
At the same time that Liam turned 25, Stella turned 32. If Tim is 7 years less than triple Stella's age, and Tim is 79, how old is Liam?
def solve() -> int: liam_age = 25 stella_age = 32 tim_age = 79 triple_stella_age = (tim_age + 7) / 3 stella_age_diff = triple_stella_age - stella_age liam_age = liam_age + stella_age_diff result = liam_age return result
Student: 5. During a bicycle race, 36 people were able to finish the race, making up 19% of the entire participants. How many participants took part in the race?
def solve() -> int: percentage = 19 total_finishers = 36 total_participants = total_finishers / (percentage / 100) result = total_participants return result
Kevin wants to find out how much money he saved by buying a shirt on sale. The original price of the shirt was $24.99, and he got a 20% discount. He also had to pay a 7% sales tax on the discounted price. How much money did he save in total?
def solve() -> int: discounted_price = 24.99 * 0.8 sales_tax = discounted_price * 0.07 final_price = discounted_price + sales_tax savings = 24.99 - final_price result = savings return result
Sarah is counting how many pieces of candy she eats per day. On Monday she ate 8. The following days, she ate 3 pieces per day. What is Sarah’s average number of pieces of candy per day over the three days?
def solve() -> int: monday = 8 tuesday = 3 wednesday = 3 thursday = 3 total_candy = monday + tuesday + wednesday + thursday average_candy = total_candy / 4 result = average_candy return result
Alex can make a sandwich in 2 minutes. He can make a burger in 6 minutes which is 2 minutes slower than he makes a hotdog. He can make scrambled eggs in 4 minutes. What is the total time, in minutes, it would take for him to make all four dishes?
def solve() -> int: sandwich_time = 2 burger_time = 6 hotdog_time = burger_time + 2 scrambled_eggs_time = 4 total_time = sandwich_time + burger_time + hotdog_time + scrambled_eggs_time result = total_time return result
A company has 80 employees. If 1/4 of the employees are managers and 2/5 of the managers are women, how many female managers does the company have?
def solve() -> int: total_employees = 80 managers = total_employees * 1/4 female_managers = managers * 2/5 result = female_managers return result
Grace has 1/3 as many marbles as Jack has. If Jack has 24 marbles and each marble weighs 0.5 oz, how many ounces of marbles does Grace have?
def solve() -> int: jack_marbles = 24 grace_marbles = jack_marbles * (1/3) marble_weight = 0.5 total_weight = grace_marbles * marble_weight result = total_weight return result
Samantha is buying candies for her little sister's birthday party. She wants to give each child 3 candies. She is inviting 20 children and a packet of 20 candies costs $4. How much will she spend in total on candies?
def solve() -> int: num_children = 20 candies_per_child = 3 candies_per_packet = 20 cost_per_packet = 4 total_candies_needed = num_children * candies_per_child total_packets_needed = total_candies_needed / candies_per_packet total_cost = total_packets_needed * cost_per_packet ...
Possible questions and programs: Linda has $25 in her wallet and she wants to buy 3 books and a coffee. Each book costs $6.50 and the coffee costs $2.75. How much money will be left from Linda after the purchase?
def solve() -> int: linda_money = 25 book_price = 6.5 coffee_price = 2.75 books = 3 total_cost = book_price * books + coffee_price remaining = linda_money - total_cost result = remaining return result
Joe was travelling from city X to city Y. If the total distance between the two cities is 1100km, and he covered the journey in one stretch at an average speed of 75km/hr, how long did the whole journey take him?
def solve() -> int: distance = 1100 speed = 75 time = distance / speed result = time return result
A bus travels 200 miles in 4 hours. What is the average speed of the bus in miles per hour?
def solve() -> int: distance = 200 time = 4 speed = distance/time result = speed return result
Claire wanted to buy a book that costs $18 and a bookmark that costs $2. She also wanted to donate $10 to a charity. She had $50 in her piggy bank. How much money did she have left after she made her purchases and donation?
def solve() -> int: money_spent = 18 + 2 money_donated = 10 money_left = 50 - money_spent - money_donated result = money_left return result
Five years ago, Terrence was half the age of his aunt. His aunt is 54. How old is Terrence?
def solve() -> int: Aunt_age = 54 Terrence_age = (Aunt_age - 5)/2 result = Terrence_age + 5 return result
A rectangle has an area of 80 square meters and a width of 10 meters. What is the length of the rectangle?
def solve() -> int: area = 80 width = 10 length = area/width result = length return result
Michael has a bucket filled with fish. Every day, Michael feeds each fish 1 worm. It takes Michael 30 seconds to find each worm. If it takes Michael 2 hours to find enough worms to feed all of his fish, how many fish does Michael have in his bucket?
def solve() -> int: worms_per_fish = 1 time_to_find_worm = 30 time_to_find_worm_in_hours = time_to_find_worm / 3600 total_time_to_find_worms = 2 total_time_to_find_worms_in_seconds = total_time_to_find_worms * 3600 total_worms = total_time_to_find_worms_in_seconds / time_to_find_wo...
Max is buying school supplies for the year. Each notebook costs $2 and each pen costs $1. He needs to buy 5 notebooks and 10 pens. How much will he spend on school supplies, in dollars?
def solve() -> int: notebook_cost = 2 pen_cost = 1 num_notebooks = 5 num_pens = 10 total_cost = (notebook_cost * num_notebooks) + (pen_cost * num_pens) result = total_cost return result
Marquis has four times as many CDs as his best friend. If his best friend has 10 CDs, how many CDs do they own together?
def solve() -> int: friend_cds = 10 marquis_cds = 4 * friend_cds total_cds = friend_cds + marquis_cds result = total_cds return result
A jewelry store earns $150 every day on weekdays and $600 every day on the weekends. How much money does it earn by the end of the month?
def solve() -> int: total=0 for day in range(1, 31+1): if day % 7 < 5: total = total + 150 else: total = total + 600 result = total return result
Juan is a chef who cooks for a restaurant. He prepares 30 meals every day and serves 25 of them. How many meals will still need to be cooked at the end of one week?
def solve() -> int: meals_prepared_per_day = 30 meals_served_per_day = 25 days_per_week = 7 meals_prepared_per_week = meals_prepared_per_day * days_per_week meals_served_per_week = meals_served_per_day * days_per_week meals_remaining_per_week = meals_prepared_per_week - meals_served_pe...
``` A rectangular pool is 6 meters long and 4 meters wide. What is the area of the pool?
def solve() -> int: length = 6 width = 4 area = length * width result = area return result
John and his friends went out for lunch and the total bill came to $45. They split the bill evenly, how much did each person have to pay?
def solve() -> int: totalPrice = 45 numPeople = 4 amountPerPerson = totalPrice/numPeople result = amountPerPerson return result
A certain foxtrot team consists of 5 dancers and each dancer performs 4 twirls during their dance routine. If they danced 20 times, how many twirls did the entire team perform in total?
def solve() -> int: dancers = 5 twirls = 4 routines = 20 total_twirls = dancers * twirls * routines result = total_twirls return result
A group of friends went out to eat and split the bill equally. The total bill was $101.20. If there were 8 friends, how much did each person pay?
def solve() -> int: total_bill = 101.20 number_of_friends = 8 each_person_pays = total_bill / number_of_friends result = round(each_person_pays, 2) return result
Maria and her younger sister need to buy school supplies. Their aunt gives them $65 to use. Maria purchases two binders and four pens at $6 each, and her sister uses the remaining amount to buy eight pencils at $2 each and some markers. How much money did Maria's sister spend on markers?
def solve() -> int: total_money = 65 num_binders = 2 num_pens = 4 pen_price = 6 num_pencils = 8 pencil_price = 2 maria_spending = (num_binders * pen_price) + (num_pens * pen_price) remaining_money = total_money - maria_spending - (num_pencils * pencil_price) marker_pri...
There are 24 cupcakes to be shared equally among 6 kids. How many cupcakes will each kid get?
def solve() -> int: cupcakes = 24 kids = 6 cupcakes_per_kid = cupcakes / kids result = cupcakes_per_kid return result
A particular type of fish in the lake grows an average of 1 meter each year. If the fish is 2 meters long this year, how long was it four years ago?
def solve() -> int: current_length = 2 growth_rate = 1 time_period = 4 length_four_years_ago = current_length - (growth_rate * time_period) result = length_four_years_ago return result
Alex wants to make some paper cranes for his art project. He knows that he needs 1 sheet of paper and 3 inches of ribbon for each crane. If he has 50 sheets of paper and 120 inches of ribbon, how many cranes can he make? How much ribbon will be left over?
def solve() -> int: cranes = min(50, 120 // 3) remaining_ribbon = 120 - cranes * 3 result = (cranes, remaining_ribbon) return result
If a company produces 500 boxes of cookies every hour and there are 10 hours of work every day, how many boxes will be produced daily?
def solve() -> int: boxes_per_hour = 500 hours_per_day = 10 boxes_per_day = boxes_per_hour * hours_per_day result = boxes_per_day return result
Scarlett needs to buy 4 packs of pencils, each pack has 6 pencils. She already bought 2 packs, how many more pencils does Scarlett need to buy?
def solve() -> int: pencil_in_pack = 6 packs_needed = 4 packs_bought = 2 pencils_needed = (packs_needed - packs_bought) * pencil_in_pack result = pencils_needed return result
To win a trip to Disneyland, Bobby has to collect 30 Mickey Mouse stickers; each Mickey Mouse sticker is obtained by trading in 12 Donald Duck stickers; each Donald Duck sticker is obtained by trading in 3 Goofy stickers; and Goofy stickers are earned by watching Disney movies. Bobby currently has 20 Mickey Mouse stick...
def solve() -> int: mickey_stickers_needed = 30 donald_stickers_needed = mickey_stickers_needed * 12 goofy_stickers_needed = donald_stickers_needed * 3 mickey_stickers_owned = 20 donald_stickers_owned = 48 goofy_stickers_owned = 156 goofy_stickers_needed -= goofy_stickers_owned ...
Student: John has a collection of toy cars. In his collection, he has 18 red cars, 6 blue cars, half as many green cars as red cars, and twice as many yellow cars as blue cars. How many toy cars does John have in his collection?
def solve() -> int: red = 18 blue = 6 green = red // 2 yellow = blue * 2 total = red + blue + green + yellow result = total return result
A fruit stand sells oranges for $0.50 each and watermelons for $7 each. If Ron has $100, what's the maximum number of oranges and watermelons he can buy if he also needs to pay the $3 taxi fare each way, and wants to buy at least one watermelon?
def solve() -> int: orange_cost = 0.5 watermelon_cost = 7 starting_money = 100 taxi_fare = 3 remaining_money = starting_money - taxi_fare*2 minimum_total_cost = watermelon_cost remaining_money_after_minimum = remaining_money - minimum_total_cost maximum_watermelons = remaining_money_afte...
Sam has 3 times as many stamps as Jack. If Sam has 42 stamps, how many stamps does Jack have?
def solve() -> int: num_sams_stamps = 42 num_jacks_stamps = num_sams_stamps / 3 result = num_jacks_stamps return result
In a 30-60-90 triangle, the hypotenuse has a length of 10 cm. What is the length of the shortest side?
def solve() -> int: hypotenuse = 10 shortest_side = hypotenuse/2 result = shortest_side return result
Mia works 8 hours per day and makes $12 per hour. If she works 5 days per week, how much does she make in a month?
def solve() -> int: hours_per_day = 8 pay_per_hour = 12 days_per_week = 5 hours_per_week = hours_per_day * days_per_week pay_per_week = hours_per_week * pay_per_hour pay_per_month = pay_per_week * 4 result = pay_per_month return result
am, Alice, Tom, and Kim are siblings. Sam is 4 years older than Alice, and Tom is half as old as Kim. If Alice is 14 years old, and Kim is 16 years old, how old are all four siblings in total?
def solve() -> int: alice = 14 kim = 16 sam = alice + 4 tom = kim / 2 result = sam + alice + tom + kim return result
- A bottle of water costs $1.20 at a vending machine. If the price is reduced by 20%, how many bottles can you buy with $10?
def solve() -> int: new_price = 1.20 * (1 - 0.2) number_of_bottles = 10 // new_price result = number_of_bottles return result
Student: 44 people are sharing a large pizza. If each person eats two slices, how many slices will remain?
def solve() -> int: people = 44 slices_per_person = 2 total_slices = people * slices_per_person remaining_slices = total_slices - (people * slices_per_person) result = remaining_slices return result
A shirt that was originally $30 is on sale for 20% off. How much does the shirt cost on sale?
def solve() -> int: original_price = 30 percent_off = 0.2 discount = original_price * percent_off sale_price = original_price - discount result = sale_price return result
If a recipe calls for 3/4 cup of sugar and makes 12 servings, how much sugar is needed to make 6 servings?
def solve() -> int: sugar_per_serving = 3/4 total_servings = 12 sugar_needed = sugar_per_serving * total_servings sugar_needed_for_6_servings = sugar_needed / 2 result = sugar_needed_for_6_servings return result
In six years, Maya will be 24 years old. Maya's cousin is currently twice as old as Maya is today. In five years, Maya's aunt will be the same age as Maya's cousin is today. Currently, how many years old is Maya's aunt?
def solve() -> int: mayas_age_in_6_years = 24 mayas_age_today = mayas_age_in_6_years - 6 mayas_cousins_age_today = mayas_age_today * 2 mayas_aunts_age_in_5_years = mayas_cousins_age_today + 5 mayas_aunts_age_today = mayas_aunts_age_in_5_years - 5 result = mayas_aunts_age_today return result
Jacob wants to discourage some insects from entering his garden. He sprays half as many grasshoppers as ants. If he sprays 60 insects total, how many ants does he spray?
def solve() -> int: ants = 2 grasshoppers = ants / 2 total_insects = ants + grasshoppers while total_insects!= 60: ants += 1 grasshoppers = ants / 2 total_insects = ants + grasshoppers result = ants return result
If Ben is twice the age of Lauren and Lauren is 3 years younger than Rachel. If Rachel is 13, how old is Ben?
def solve() -> int: age_rachel = 13 age_lauren = age_rachel - 3 age_ben = 2 * age_lauren result = age_ben return result
The sum of two numbers is 54. If one-third of the first number is 8 more than one-fourth of the second number, what are the two numbers?
def solve() -> int: total = 54 a = total / 2 b = ((4/3)*a - 8) / (1/4) result = (a, b) return result
Possible questions and programs: Kelly wants to buy a pair of earrings and a necklace. The earrings cost $40 and the necklace is 5 times that price. She gets a coupon for 15% off. How much does she pay for both items?
def solve() -> int: earrings = 40 necklace = 5 * earrings total = earrings + necklace discount = total * 0.15 final = total - discount result = final return result
Emma sells bracelets at a craft fair, and she charges $4 per bracelet. She makes 15 bracelets every day. On the first day, she sold 12 bracelets. On the second day, she sold 10 bracelets. On the third day, she sold 8 bracelets. She also had to pay a $10 fee to rent a table at the fair for three days. How much did she p...
def solve() -> int: price = 4 made = 15 sold1 = 12 sold2 = 10 sold3 = 8 fee = 10 profit = (sold1 + sold2 + sold3) * price - fee result = profit return result
There are 64 apples in a basket. If 20 apples are taken out, how many apples are left in the basket?
def solve() -> int: apples = 64 apples -= 20 result = apples return result
John types 25 words in a minute but takes a 1.5-minute break every 12 minutes. How much time does he need to type 375 words?
def solve() -> int: words_per_minute = 25 break_duration = 1.5 break_interval = 12 total_words = 375 typing_time = total_words / words_per_minute number_of_breaks = typing_time // break_interval total_break_time = number_of_breaks * break_duration total_time = typing_time + tot...
A group of 30 people went on a picnic. They brought 5 loaves of bread and 48 slices of cheese. If each person eats 1 slice of bread and 2 slices of cheese, how many slices of cheese will be left over?
def solve() -> int: num_people = 30 num_bread = 5 num_cheese_slices = 48 bread_slices_per_person = 1 cheese_slices_per_person = 2 total_cheese_slices_needed = num_people * cheese_slices_per_person cheese_slices_left_over = num_cheese_slices - total_cheese_slices_needed res...
A company sells a product for $20 per unit. If they sell 100 units, they can offer a discount of 10%. How much money will they make if they sell 150 units with the discount?
def solve() -> int: unit_price = 20 num_units_discount = 100 discount_rate = 0.10 num_units_sold = 150 if num_units_sold > num_units_discount: total_cost_discount = num_units_discount * unit_price * (1 - discount_rate) extra_units = num_units_sold - num_units_discount total_cost_no...
The sum of two numbers is 128. If one of the numbers is twice the other, what are the numbers?
def solve() -> int: total = 128 smaller_number = total/3 larger_number = smaller_number * 2 result = (smaller_number, larger_number) return result
-Do not use the same names or numbers as the original question. Example: Alice's bike gets 60 mi/gal. She rides 15 miles to school each way 4 days a week. She also rides another 30 miles a week for fun. How many gallons of gas does she use a week?
def solve() -> int: miles_to_school = 15 * 2 * 4 miles_for_fun = 30 total_miles = miles_to_school + miles_for_fun gallons_per_mile = 1 / 60 gallons_used = gallons_per_mile * total_miles result = gallons_used return result
At a playground, Lucy saw 16 slides and each slide had 3 steps. How many steps were at the playground?
def solve() -> int: total_steps = 0 for slide in range(16): total_steps = total_steps + 3 result = total_steps return result
3. Emily bought 4 notebooks for $5 each and 6 erasers for $3 each. How much did she spend in total?
def solve() -> int: total_cost_of_notebooks = 4*5 total_cost_of_erasers = 6*3 total_cost = total_cost_of_notebooks + total_cost_of_erasers result = total_cost return result
10. Thonas was shopping for groceries. He bought 4 bags of chips that cost 2.50 each. He also bought 6 bottles of juice for 4.00 each. How much did Thomas spend in total?
def solve() -> int: number_of_chips = 4 chips_price = 2.50 number_of_juice = 6 juice_price = 4.00 chips_total_price = number_of_chips * chips_price juice_total_price = number_of_juice * juice_price total_price = chips_total_price + juice_total_price result = total_pri...
The sum of two numbers is 24 and the difference between them is 2. Find the numbers.
def solve() -> int: sum_numbers = 24 diff_numbers = 2 x = 13 y = sum_numbers - x result = (x, y) return result
Danielle & Jason have opened a candy store. They have 120 lollipops and 100 boxes of sour gummies. They price the lollipops at $0.50 and the gummies at $1.50. How much money will they make if they sell them all?
def solve() -> int: lollipops = 120 gummies = 100 lollipop_price = 0.50 gummy_price = 1.50 total_lollipop_price = lollipops * lollipop_price total_gummy_price = gummies * gummy_price total_price = total_lollipop_price + total_gummy_price result = total_price return result
Lisa has $360 and she wants to save half of it. How much money does she have to save?
def solve() -> int: total = 360 half = total//2 result = half return result
If John jogged 4 kilometers at a pace of 8 minutes per kilometer, how long did he take to complete the jog in hours and minutes (rounded to nearest minute)?
def solve() -> int: distance = 4 pace_in_minutes = 8 total_time_in_minutes = distance * pace_in_minutes total_time_in_hours = total_time_in_minutes / 60 rounded_total_time_in_minutes = round(total_time_in_minutes % 60) result = (round(total_time_in_hours), rounded_total_time_in_minutes) ret...
John is driving from city A to city B which is 480 miles away. He drives at 70 miles/hour for the first 2 hours, then he takes a 30-minute break before continuing the journey at 90 miles/hour for the next 3 hours. What is his average speed for the entire journey?
def solve() -> int: distance1 = 70 * 2 distance2 = 90 * 3 total_distance = distance1 + distance2 total_time = 2 + 3.5 average_speed = total_distance/total_time result = average_speed return result
Jack has 4 books. The first two books need 200 pages each and the other two need 100 fewer pages than the first two books. If Jack needs to read every week, how many pages will he need to read in a month?
def solve() -> int: books = 4 pages_book1 = 200 pages_book2 = 200 pages_book3 = pages_book1 - 100 pages_book4 = pages_book2 - 100 total_pages = (pages_book1 + pages_book2 + pages_book3 + pages_book4) * books pages_per_month = total_pages / 4 result = pages_per_month return ...
Maria has 25 cherries, 10 plums, and five times as many peaches as plums. If she eats three of each fruit, how many fruits does she have left?
def solve() -> int: cherries = 25 plums = 10 peaches = 5 * plums cherries -= 3 plums -= 3 peaches -= 3 result = cherries + plums + peaches return result
Student: A company has 500 employees. If 20% of the employees are managers and the rest are workers, how many workers does the company have?
def solve() -> int: total_employees = 500 percent_managers = 0.2 num_managers = total_employees * percent_managers num_workers = total_employees - num_managers result = num_workers return result
A ride at the amusement park costs $5.75 and a funnel cake costs $6.00. If a group of friends wants to buy 4 rides and 3 funnel cakes, how much would they have to spend in total?
def solve() -> int: ride_cost = 5.75 funnel_cake_cost = 6.00 rides_amount = 4 funnel_cakes_amount = 3 total_cost = ride_cost * rides_amount + funnel_cake_cost * funnel_cakes_amount result = total_cost return result
Julie has 4 $100 bills, 5 $20 bills, and 15 $1 bills. John has 6 $50 bills, 2 $20 bills, and 8 $1 bills. How much more money does Julie have than John?
def solve() -> int: bill_total_julie = 4*100 + 5*20 + 15*1 bill_total_john = 6*50 + 2*20 + 8*1 difference = bill_total_julie - bill_total_john result = difference return result
Jack bought a product for $420. He got a 40% discount. How much did he have to pay?
def solve() -> int: initial_amount = 420 discount_percentage = 40 result = initial_amount - (initial_amount * (discount_percentage/100)) result = initial_amount - (initial_amount * (discount_percentage/100)) return result
If a pizza has a radius of 8 inches, what is its area?
def solve() -> int: radius = 8 pi = 3.14 area = pi*(radius**2) result = area return result
A company has three employees who make $30,000, $40,000, and $50,000 per year. What is the average salary of the three employees?
def solve() -> int: total_salary = 30000 + 40000 + 50000 average_salary = total_salary / 3 result = average_salary return result
To make pizza, the pizzeria needs dough, cheese and tomato sauce. Dough is bought at $2 per kilogram, cheese at $5 per kilogram and tomato sauce at $3 per liter. To make one pizza, the pizzeria needs 0.4 kilograms of dough, 0.2 kilograms of cheese and 0.1 liters of tomato sauce. How much does it cost the pizzeria to pr...
def solve() -> int: dough_cost = 2 cheese_cost = 5 sauce_cost = 3 dough_amount = 0.4 cheese_amount = 0.2 sauce_amount = 0.1 dough_cost_one_pizza = dough_cost * dough_amount cheese_cost_one_pizza = cheese_cost * cheese_amount sauce_cost_one_pizza = sauce_cost * sauce_amount ...
A book has 320 pages. A student reads 40 pages each day. How many days does she need to finish the book?
def solve() -> int: pages = 320 pages_per_day = 40 days = pages / pages_per_day result = days return result
Justin started with 72 tokens. He wasted one third of his tokens on Pac-Man, a fourth of his tokens on Candy Crush, and 12 on Ski-ball. After that, his sister gave him 3 times as many tokens as he just spent on Ski-ball. How many tokens does Justin have at first?
def solve() -> int: tokens_start = 72 tokens_wasted_pacman = tokens_start / 3 tokens_wasted_candy = tokens_start / 4 tokens_wasted_skiball = 12 tokens_added = tokens_wasted_skiball * 3 tokens_final = tokens_start-(tokens_wasted_pacman+tokens_wasted_candy+tokens_wasted_skiball...
Lila has a lot of candies and chocolates. She has 80 candies and 50 chocolates in total. She eats 1/4 of her candies and 1/5 of her chocolates. Then she shares half of the remaining candies and chocolates with her brother. How many candies and chocolates does she have left?
def solve() -> int: candies_eaten = 80 * 1 / 4 chocolates_eaten = 50 * 1 / 5 candies_left = 80 - candies_eaten chocolates_left = 50 - chocolates_eaten candies_shared = candies_left * 1 / 2 chocolates_shared = chocolates_left * 1 / 2 candies_final = candies_left - candies_shared chocolate...
A rectangular prism has a length of 8 cm, a width of 6 cm and a depth of 4 cm. What is its volume?
def solve() -> int: volume = 8 * 6 * 4 result = f'{volume}' result = volume return result
At a farm, there are 4 workers harvesting apples. Each of them harvests 10 apples an hour. As a group, they harvest an additional apple every 5 hours. In total, how many apples have been harvested after 5 hours?
def solve() -> int: workers = 4 apples_per_hour = 10 additional_apples_every = 5 total_apples = workers * apples_per_hour * 5 + (5 // additional_apples_every) * workers result = total_apples return result
Student: Ruby wants to buy a book for $24.99, but the store currently has a 25% discount. How much will she pay for the book?
def solve() -> int: price = 24.99 discount = 0.25 discounted_price = price * (1 - discount) result = discounted_price return result
Liam had 40 marbles. He lost one-fifth of them in a bet and then bought 10 more marbles with his allowance. He gave one-fourth of his new total to his sister. How many marbles did Liam have left?
def solve() -> int: marbles_lost = 40 / 5 marbles_left = 40 - marbles_lost marbles_left += 10 marbles_gave = marbles_left / 4 marbles_left -= marbles_gave result = marbles_left return result
Student: Alice is spinning a wheel that has 12 sections, each with a different number from 1 to 12, and won't stop spinning until the average of all her spins is 6. She spins a 4, a 9, a 7, a 3, a 10, a 5, a 8, a 1, a 11 and a 6. What does she need to spin on the next spin to be able to stop?
def solve() -> int: spins = [4, 9, 7, 3, 10, 5, 8, 1, 11, 6] current_average = sum(spins) / len(spins) total_sum_needed = 6 * (len(spins) + 1) - sum(spins) next_spin = total_sum_needed / 1 result = next_spin return result
9. A store has 3 boxes of chocolates, each box has 10 chocolates. How many chocolates are there in total?
def solve() -> int: boxes = 3 box_chocolates = 10 total_chocolates = boxes * box_chocolates result = total_chocolates return result
Sam collected 12 cans of soda and 8 bottles of water for recycling. He got 5 cents for each can and 10 cents for each bottle. How much money did he earn in total?
def solve() -> int: cans = 12 bottles = 8 can_rate = 0.05 bottle_rate = 0.1 earnings = cans * can_rate + bottles * bottle_rate result = earnings return result
A bag of candy contains 36 pieces. If you want to divide the candy equally among 6 people, how many pieces will each person receive?
def solve() -> int: candy = 36 people = 6 pieces_pp = candy / people result = pieces_pp return result
The perimeter of a rectangle is 80 cm. If the length of the rectangle is 25 cm, what is the width of the rectangle?
def solve() -> int: perimeter = 80 length = 25 width = (perimeter - 2 * length) / 2 result = width return result
A restaurant kitchen has 6 cooks who can prepare a dish in 12 minutes and cook it in 18 minutes. How many dishes can they prepare and cook in 2.5 hours?
def solve() -> int: cooks = 6 prep_time = 12 cook_time = 18 total_time = prep_time + cook_time hours = 2.5 minutes = hours * 60 total_dishes = (minutes // total_time) * cooks result = total_dishes return result
Jack runs for a maximum of 3 miles every day. After a week of training, he increased his maximum run distance to 5 miles. How many miles did Jack run during the first 7 days of training?
def solve() -> int: max_distance_per_day = 3 new_max_distance_per_day = 5 days_of_training = 7 total_distance_first_week = max_distance_per_day * days_of_training total_distance_second_week = new_max_distance_per_day * days_of_training total_distance_during_training = total_distance_fi...
Mariah is driving from New York to Los Angeles. She started in New York and has driven 1200 miles so far. She drives at a speed of 60 miles per hour and now there are 4 days left in her travel. How many miles can she drive every day if she wants to make it to Los Angeles on time?
def solve() -> int: miles_left = 2786 days_left = 4 speed = 60 miles_per_day = (miles_left - 1200) / days_left result = miles_per_day return result
Student: Sarah went to the store to buy paint for her room. The paint states that it covers 225 square foot per gallon. She needs to cover a room which is 16 feet by 12 feet. How many gallons of paint will she need to cover the room?
def solve() -> int: length = 16 width = 12 area = length * width coverage = 225 gallons = area / coverage result = gallons return result
Fiona grows flowers and sells them at a farmers market. On Friday, she sells 15 flowers. On Saturday, she sells one third as many flowers as on Friday. On Sunday, she sells 5 more flowers than on Saturday. On Monday, she sells 10 fewer flowers than on Sunday. How many total flowers does she sell for the 4 days?
def solve() -> int: friday = 15 saturday = friday // 3 sunday = saturday + 5 monday = sunday - 10 total = sum([friday, saturday, sunday, monday]) result = total return result
The heating bill of an apartment is $200/month. If the apartment owner decides to decrease the temperature by 3 degrees Celsius, he can save $20/month. What is the cost of 1 degree Celsius at current setting?
def solve() -> int: temperature_change = 3 bill_change = 20 cost_per_change = bill_change / temperature_change current_temperature = 20 current_bill = 200 temperature_cost = cost_per_change / current_temperature result = temperature_cost return result
55 students are planning to go on a field trip. 22 students are not going on the trip and 13 more students decide to join the trip. How many students are going on the field trip?
def solve() -> int: students_planning_trip = 55 students_not_going = 22 students_joining = 13 students_going = students_planning_trip - students_not_going + students_joining result = students_going return result
Tyson is an Uber driver who charges $2.25 per mile and an additional $10 per trip. If Tyson drove a customer 20 miles, how much would he have earned?
def solve() -> int: miles_driven = 20 cost = miles_driven*2.25 + 10 result = cost return result
A music store received 3 different shipments of CDs. The first two shipments of 20 and 33 CDs arrived on the same day. The next day's shipment was 45 CDs. If it takes 3 CDs to fill a bin, how many bins can the store fill with the new shipment?
def solve() -> int: total_cds = 20 + 33 + 45 total_bins = total_cds // 3 result = total_bins return result
Rachel had five times as many flowers as Ryan, but she gave away a bouquet to a friend. If Ryan had 10 flowers and kept them all, how many flowers did they have altogether?
def solve() -> int: ryan_flowers = 10 rachel_flowers = 5 * ryan_flowers rachel_flowers -= 1 total_flowers = ryan_flowers + rachel_flowers result = total_flowers return result
A museum sells tickets for $8.50 for adults and $5 for children. On a certain day, a total of 200 tickets were sold and the museum earned $1400. How many adult tickets and how many children's tickets were sold?
def solve() -> int: adult_price = 8.5 child_price = 5 total_tickets = 200 total_earnings = 1400 from sympy import symbols, solve a, c = symbols('a c') eq1 = a + c - total_tickets eq2 = adult_price * a + child_price * c - total_earnings sol = solve((eq1, eq2), (a, c)) re...
Miguel makes a pizza for his family of 4. The pizza is divided into 8 even slices. If each person wants to eat the same amount of pizza, how many slices can each person have?
def solve() -> int: total_slices = 8 num_people = 4 slices_per_person = total_slices / num_people result = slices_per_person return result
A car rental company charges $50 per day for rental and an additional $0.15 per mile driven. If Jen drove the car for 3 days and covered 200 miles during this time, how much did she pay for the rental?
def solve() -> int: rental = 50 * 3 miles = 200 * 0.15 result = rental + miles return result
Student: A train travels at a speed of 60 km/h for the first 100 km, then travels at a speed of 80 km/h for the next 200 km. What is the total time taken for the journey?
def solve() -> int: speed_1 = 60 speed_2 = 80 distance_1 = 100 distance_2 = 200 time_1 = distance_1 / speed_1 time_2 = distance_2 / speed_2 total_time = time_1 + time_2 result = total_time return result
A worker is paid $12.50 per hour for the first 40 hours worked in a week. After that, the worker is paid time-and-a-half (1.5 times the regular hourly rate) for any hours over 40. If the worker works 50 hours in a week, how much will they earn?
def solve() -> int: regular_hourly_rate = 12.5 overtime_hourly_rate = regular_hourly_rate * 1.5 hours_worked = 50 if hours_worked <= 40: pay = hours_worked * regular_hourly_rate else: pay = (40 * regular_hourly_rate) + ((hours_worked - 40) * overtime_hourly_rate) result = pay ...