question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Catherine went grocery shopping this week. She bought 4 pounds of apples at $2.50 per pound, 2 gallons of milk for $3.20 per gallon, and a loaf of bread for $1.50. If she gets a 10% off coupon on her total purchase, what is the final amount she pays?
def solve() -> int: apples = 4 * 2.50 milk = 2 * 3.20 bread = 1.50 total_purchase = apples + milk + bread discount = total_purchase * 0.10 amount_paid = total_purchase - discount result = amount_paid return result
A dozen eggs cost $2.40. What is the cost of 27 eggs?
def solve() -> int: cost_dozen = 2.40 eggs_per_dozen = 12 cost_per_egg = cost_dozen / eggs_per_dozen num_eggs = 27 cost_27_eggs = cost_per_egg * num_eggs result = cost_27_eggs return result
Student: A music festival had a total of 850 visitors. If 25% of the visitors were children and 75% were adults, how many children and adults attended the festival?
def solve() -> int: total = 850 percent_children = 0.25 percent_adults = 0.75 children = total * percent_children adults = total * percent_adults result = (children, adults) return result
Mrs. Green has 80 students in her classroom, and 25% of them are absent on a given day. If only 2/3 of the remaining students turn in their homework, how many students did not turn in their homework?
def solve() -> int: students_in_classroom = 80 absent_percentage = 0.25 absent_students = students_in_classroom * absent_percentage present_students = students_in_classroom - absent_students homework_percentage = 2/3 homework_students = present_students * homework_percentage not_homework_stu...
Zoe has 12 pencils and 8 pens. If she loses 5 writing supplies, how many writing supplies does she have left? Four friends shared a total of 12 pizzas. Alice ate 2 slices of pepperoni pizza, while Bob ate 4 slices of mushroom pizza. Charlie ate sausage pizza. How many pizzas of sausage did Charlie eat?
def solve() -> int: pencils = 12 pens = 8 pencils -= 5 pens -= 5 writing_supplies_left = pencils + pens pizzas = 12 alice_slices = 2 bob_slices = 4 charlie_slices = pizzas - alice_slices - bob_slices pizzas_of_sausage = charlie_slices // 8 result...
Mark wants to build a treehouse for his children and needs to calculate the cost of the treehouse's square footage. It will cost him $20 per square foot, and the treehouse requires 100 square feet of space. Mark thinks that the construction cost would be thrice the cost of the land, and his partner will contribute 30% ...
def solve() -> int: cost_per_sqft = 20 sqft_required = 100 land_cost = sqft_required * cost_per_sqft construction_cost = 3 * land_cost total_cost = construction_cost + land_cost partner_contribution = 0.3 * total_cost final_expense = total_cost - partner_contrib...
A box contains 48 pens and 60 pencils. If 1/3 of the pens and 2/5 of the pencils are black, how many black items are there in total?
def solve() -> int: black_pens = 48 * 1/3 black_pencils = 60 * 2/5 total_black_items = black_pens + black_pencils result = total_black_items return result
A group of friends are selling handmade bracelets for a fundraiser. Sarah sells 2 times as many bracelets as Emily. Emily sells 4 more bracelets than three times the amount that Rachel sells. If they sell a total of 60 bracelets, how many bracelets did Sarah sell? Oliver flips a coin twice a week on randomly chosen day...
def solve() -> int: rachel_bracelets = (60-4)/(3+1) emily_bracelets = 4 + 3*rachel_bracelets sarah_bracelets = 2*emily_bracelets prob_salad_cake = (5/7)*(1/7) result = sarah_bracelets, prob_salad_cake return result
arah bought a dress for $80. She returned it and got a refund of $90 after the 5% restocking fee. How much did Sarah pay including the fee?
def solve() -> int: original_cost = 80 refund = 90 re_stocking_fee = 5/100 actual_refund = refund - (refund * re_stocking_fee) total_cost = original_cost + actual_refund result = total_cost return result
If a bookshelf can hold 70 books, and there are already 35 books on the shelf, how many more books can be added to the shelf?
def solve() -> int: a = 70 b = 35 result = a - b return result
Student: John bought a bike for $720. He saved $120 because it was on sale. What was the percentage discount?
def solve() -> int: original_price = 720 savings = 120 discount = 0 discount = (savings / original_price) * 100 result = discount return result
A family goes out to eat and the bill comes to $35. They leave a 15% tip on top of the bill. How much do they leave for the tip in dollars?
def solve() -> int: bill_total = 35 tip_percent = 0.15 tip_amount = bill_total * tip_percent result = tip_amount return result
A pizza consists of 8 slices. If 5 people are sharing a pizza equally, how many slices of pizza does each person get?
def solve() -> int: total_slices = 8 people = 5 slices_per_person = total_slices / people result = slices_per_person return result
Possible new questions and programs: Lena is making a fruit salad with apples, oranges, and bananas. She needs 40% apples, 30% oranges, and 30% bananas. If she has 16 oranges, how many apples does she need?
def solve() -> int: total_fruits = 16 / 0.3 apples = 0.4 * total_fruits result = apples return result
A clock chimes once every hour, and a grandfather clock chimes once every 30 minutes. Over a 24 hour period, how many more times will the grandfather clock chime than the regular clock?
def solve() -> int: hours = 24 regular_chimes = hours grandfather_chimes = hours * 2 extra_chimes = grandfather_chimes - regular_chimes result = extra_chimes return result
Freddy is making a model car. He first places 40 wheels onto the car, followed by 32 windows, and 19 seats. He then adds 24 doors onto the car. If Freddy has only 12 pieces left of the model car, how many pieces did he start with?
def solve() -> int: wheels = 40 windows = 32 seats = 19 doors = 24 total = wheels + windows + seats + doors leftover = 12 pieces = total - leftover result = pieces return result
A restaurant sold 45 hamburgers and cheeseburgers. If it sold 3 times as many hamburgers as cheeseburgers, how many of each were sold?
def solve() -> int: total_burgers = 45 hamburger_ratio = 3 hamburgers = total_burgers / (hamburger_ratio + 1) cheeseburgers = total_burgers / (1 + hamburger_ratio) result = (hamburgers, cheeseburgers) return result
In a park, there are 325 oak trees, 441 pine trees, and 212 maple trees. How many trees are in the park in total?
def solve() -> int: oak = 325 pine = 441 maple = 212 total = oak + pine + maple result = total return result
At home, Mary jogs for 30 minutes. During that time she jogged for 10% of the time at a fast pace, for 70% of the time at a moderate pace and for the remaining time she sprinted. If the total time spent jogging was 18 minutes, how long did Mary sprint for?
def solve() -> int: fast_time = 0.1 * 18 moderate_time = 0.7 * 18 sprint_time = 18 - (fast_time + moderate_time) result = sprint_time return result
A pizza was cut into 8 pieces. Simon ate 3 pieces and Sheryl ate 2 pieces. What fraction of the pizza was left?
def solve() -> int: num_pieces = 8 num_pieces_left = num_pieces - 3 - 2 fraction_left = num_pieces_left / num_pieces result = fraction_left return result
Ben has a rectangular field that measures 30 meters by 40 meters. If he needs to fence the entire field, how much fence, in meters, would he need to buy?
def solve() -> int: length = 30 width = 40 perimeter = 2 * (length + width) result = perimeter return result
Maria drives 85 miles per hour on a highway that has a speed limit of 60 miles per hour. If she drives for 2.5 hours, how many miles will she have traveled in that time?
def solve() -> int: speed_limit = 60 maria_speed = 85 maria_time = 2.5 maria_distance = maria_speed * maria_time result = maria_distance return result
``` In a class of 30 students, 60% of them like math and 40% of them like science. If 12 students like both math and science, how many students like only math or only science?
def solve() -> int: math_students = 0.6 * 30 science_students = 0.4 * 30 both = 12 only_math_or_science = math_students + science_students - 2 * both result = only_math_or_science return result
Student: Ali and Bella shared a pizza. Ali ate 3/8 of the pizza and Bella ate 2/5 of the remaining pizza. How much pizza was left?
def solve() -> int: total_pizza = 1 ali_ate = 3/8 bella_ate = 2/5 remaining_pizza = total_pizza - ali_ate remaining_pizza = remaining_pizza - (remaining_pizza * bella_ate) result = remaining_pizza return result
In January, Michelle paid $45 for her cell phone bill. In February she received a 20% discount on her bill. In March she received a 25% discount on her bill. How much money did Michelle spend on cell phone bills in the first 3 months?
def solve() -> int: january_bill = 45 february_bill = january_bill * 0.8 march_bill = february_bill * 0.75 total_bills = january_bill + february_bill + march_bill result = total_bills return result
On weekdays, a student reads for 2 hours and on weekends, they study for 4 hours on Saturday and 3 hours on Sunday. How many hours do they read and study in a week?
def solve() -> int: weekday_hours = 2 saturday_hours = 4 sunday_hours = 3 total_weekday_hours = weekday_hours * 5 total_weekend_hours = (saturday_hours + sunday_hours) * 2 total_hours = total_weekday_hours + total_weekend_hours result = total_hours return result
A toy store has 120 stuffed animals in stock. They plan to sell 3/4 of them during their summer sale. How many stuffed animals will be left after the sale?
def solve() -> int: number_of_stuffed_animals = 120 percentage_to_sell = 0.75 amount_sold = number_of_stuffed_animals * percentage_to_sell amount_left = number_of_stuffed_animals - amount_sold result = amount_left return result
Maya went grocery shopping and bought a loaf of bread and 2 cartons of eggs. The bread costs $3 and each carton of eggs is $2.50. What was the total cost of her shopping?
def solve() -> int: bread_cost = 3 egg_cost = 2.5 * 2 total_cost = bread_cost + egg_cost result = total_cost return result
ally has 18 stickers. She wants to give 4 stickers to her friend and keep 8 stickers for herself. How many stickers can she give to her other friend?
def solve() -> int: sally_stickers = 18 friend_stickers = 4 self_stickers = 8 leftover_stickers = sally_stickers - friend_stickers - self_stickers result = leftover_stickers return result
Student: A farmer has 48 cows in his barn. Each cow eats 10 kilograms of hay per day. If the farmer feeds his cows for 7 days, how many kilograms of hay does he need?
def solve() -> int: num_cows = 48 daily_intake = 10 num_days = 7 total_intake = num_cows * daily_intake * num_days result = total_intake return result
James wore his loafers to the office. He walked 2 miles to the office in his loafers. Then, he walked half the distance from the office to the park in his loafers. Finally, he walked 1 more than the distance from the park to the library in his loafers. How far, in miles, did James walk in his loafers? A chef baked a do...
def solve() -> int: distance_to_office = 2 distance_to_park = distance_to_office * 2 distance_to_park_walked = distance_to_park / 2 distance_to_library = distance_to_park - distance_to_park_walked distance_to_library_walked = distance_to_library + 1 total_distance = dist...
Ben has 4 sisters and 2 brothers. Each sister has 5 dolls and each brother has 3 cars. Ben has twice as many books as his sisters have dolls altogether. How many toys and books do Ben and his siblings have in total?
def solve() -> int: sisters = 4 brothers = 2 dolls = 5 cars = 3 books = 2 * sisters * dolls toys = sisters * dolls + brothers * cars toys_and_books = toys + books result = toys_and_books return result
A train leaves a station at 3 pm and reaches its destination at 9 pm. How long was the journey in minutes?
def solve() -> int: departure_time = 3 arrival_time = 21 journey_time = (arrival_time - departure_time) * 60 result = journey_time return result
Jake is measuring the distance he runs every day. On Monday, he ran 3 miles. On Tuesday and Wednesday, he ran 2 miles each day. What is Jake's average daily distance run?
def solve() -> int: monday_distance = 3 tuesday_distance = 2 wednesday_distance = 2 total_distance = monday_distance + tuesday_distance + wednesday_distance average_distance = total_distance / 3 result = average_distance return result
A garden has a rectangle shape. Its length is three times its width. If the width is 4 meters, then what is the perimeter of the garden?
def solve() -> int: width = 4 length = width * 3 perimeter = 2 * (length + width) result = perimeter return result
Ben goes to the store to buy 15 oranges at $0.60 each. He also picks up a loaf of bread for $3.50 and a gallon of milk for $2.10. How much does he spend in total?
def solve() -> int: num_oranges = 15 price_orange = 0.60 price_bread = 3.50 price_milk = 2.10 total_oranges = num_oranges * price_orange total_cost = total_oranges + price_bread + price_milk result = total_cost return result
Student: A recipe requires 2 cups of sugar to make 24 cookies. How many cups of sugar are needed to make 96 cookies?
def solve() -> int: cookies = 96 sugar_per_cookie = 2/24 sugar_needed = cookies * sugar_per_cookie result = sugar_needed return result
If a stock increased from $50 to $70, what is the percent increase?
def solve() -> int: start_price = 50 end_price = 70 percent_increase = ((end_price - start_price) / start_price) * 100 result = percent_increase return result
Jack's car can travel 270 miles in one full tank of gas. If Jack drives 80 miles on the first day and 160 miles on the second day, how many miles can Jack drive on the third day?
def solve() -> int: total_miles_covererage = 270 miles_driven_first_day = 80 miles_driven_second_day = 160 miles_left = total_miles_covererage - (miles_driven_first_day + miles_driven_second_day) result = miles_left return result
74% of a hill is filled with rocks. If the hill is 40 meters long and 10 meters wide, how many meters of the hill are not filled with rocks?
def solve() -> int: length_of_hill = 40 width_of_hill = 10 area_of_hill = length_of_hill * width_of_hill percent_filled_with_rocks = 74 percent_not_filled_with_rocks = 100 - 74 area_not_filled_with_rocks = area_of_hill * (percent_not_filled_with_rocks / 100) result = round(area_not_filled_wi...
In a hospital, 20% of the patients are children and the rest are adults. If there are 500 patients in the hospital, how many are children?
def solve() -> int: total_patients = 500 children_percentage = 20 adults_percentage = 100 - children_percentage children = (children_percentage/100) * total_patients adults = (adults_percentage/100) * total_patients result = children return result
Leo is reading a book that has 240 pages. He reads 15 pages every day on weekdays and 20 pages every day on weekends. How many days will it take him to finish the book?
def solve() -> int: weekly_pages = 15 * 5 + 20 * 2 weeks = 240 / weekly_pages result = weeks * 7 return result
Oliver is a chef. Today, he cooked pasta dishes for his customers. He cooked 72 dishes, but 6 of the dishes were vegetarian. How many pasta dishes with meat did Oliver cook?
def solve() -> int: total_dishes = 72 vegetarian_dishes = 6 meat_dishes = total_dishes - vegetarian_dishes result = meat_dishes return result
am makes 6 sandwiches. They are 4 slices of bread each. The bread costs $3. How much did one sandwich cost?
def solve() -> int: total_slices = 6 * 4 cost_per_slice = 3 / total_slices cost_of_one_sandwich = cost_per_slice * 4 result = cost_of_one_sandwich return result
A number is increased by 20% and then this new number is decreased by 20%. What is the final percentage change?
def solve() -> int: num = 100 num = num * 1.2 num = num * 0.8 final_percent_change = (num - 100) / 100 * 100 result = final_percent_change return result
Price buys 5 yards of fabric for his project. If each yard costs $12, how much does Price need to pay?
def solve() -> int: yards = 5 cost_per_yard = 12 result = yards * cost_per_yard return result
Sophie has 800 cards and 3/4 as many envelopes as cards. After giving each of her friends 1/10 of each paper item, how many paper items does Sophie have left in total?
def solve() -> int: cards = 800 envelopes = (3/4) * cards paper_items = cards + envelopes friends = 10 items_given = (1/10) * paper_items items_left = paper_items - (friends * items_given) result = items_left return result
-Make all the variables' name **CLEAR and INFORMATIVE**. Possible questions and programs are: Ben can mow a lawn in 15 minutes. Alice can mow the same lawn in half the time. Carl can mow the same lawn in 10 more than triple the amount of minutes as Alice. How long will it take Carl to mow the lawn?
def solve() -> int: ben_time = 15 alice_time = ben_time / 2 carl_time = 10 + 3 * alice_time result = carl_time return result
9. John has 18 more toy cars than Jacob has. If John has 96 toy cars, how many toy cars does Jacob have?
def solve() -> int: john_cars = 96 jacob_cars = john_cars - 18 result = jacob_cars return result
Mark can run 8 miles in 80 minutes and walk 2 miles in 30 minutes. If he started running at 8am and walked the last 2 miles, what time did he finish his journey?
def solve() -> int: speed_run = 8 time_run = 80 speed_walk = 2 time_walk = 30 total_time = time_run + time_walk final_time = total_time + 8 result = 11.5 return result
Student: If Alex saved up $77, and he spends 5/6 of it on new shoes, how much money does he have left?
def solve() -> int: amount_saved = 77 amount_spent = 5/6 * amount_saved amount_left = amount_saved - amount_spent result = amount_left return result
A furniture store gives a discount of 20% on all their products. If a sofa is originally priced at $2,500, what will be the new price after the discount?
def solve() -> int: original_price = 2500 discount_percent = 20 discount_amount = original_price*discount_percent/100 new_price = original_price-discount_amount result = new_price return result
James received 210 books from his aunt. If he has to divide them equally between his two brothers, how many books will each brother get?
def solve() -> int: total_books = 210 num_brothers = 2 result = total_books // num_brothers return result
Jenny has 3 dogs and each dog needs to eat 2 cans of food a day. Each can contains 1 pound of food. How many pounds of food does she need for 7 days?
def solve() -> int: num_dogs = 3 cans_per_dog_per_day = 2 pounds_per_can = 1 num_days = 7 total_cans = num_dogs * cans_per_dog_per_day * num_days total_pounds = total_cans * pounds_per_can result = total_pounds return result
ome possible new questions are: Ella is baking cupcakes for her friends. She has 12 muffin cups and each cupcake needs 25 grams of flour. She has a 500-gram bag of flour. How many cupcakes can she make with the flour she has?
def solve() -> int: flour_per_cupcake = 25 flour_for_12 = 12 * flour_per_cupcake flour_left = 500 - flour_for_12 cupcakes_left = flour_left // flour_per_cupcake result = cupcakes_left return result
Student: Lauren has a total of 30 stickers. She gives 5 to her brother and 3 to her friend. She then buys 10 more stickers at the store. How many stickers does she have now?
def solve() -> int: stickers = 30 stickers = stickers - 5 - 3 stickers = stickers + 10 result = stickers return result
Daniel is a student who enjoys reading. He read for 30 minutes per day for the first week of the month. For the second week, he increased his reading time to 45 minutes per day. How many minutes did he read in total for the two weeks?
def solve() -> int: week1_reading_time = 30 week2_reading_time = 45 total_reading_time = week1_reading_time * 7 + week2_reading_time * 7 result = total_reading_time return result
6. At the football stadium, Sarah had to pay 23 euros for her ticket and her brother's ticket. She had 14 euros already. How much money does she have left?
def solve() -> int: sum = 0 sum = sum + 23 sum = sum + 14 result = sum - 23 - 14 return result
Walt is building a shelf in his house and his goal is to build at least 40 shelves this week. He built 9 shelves on Monday and 14 shelves on Tuesday. How many shelves does Walt have to build on Wednesday to meet his goal?
def solve() -> int: shelves_needed = 0 shelves_Monday = 9 shelves_Tuesday = 14 total_shelves = shelves_Monday + shelves_Tuesday shelves_needed = 40 - total_shelves result = shelves_needed return result
Student: It costs $2 to buy 4 apples. How much does it cost to buy 10 apples?
def solve() -> int: cost_per_apple = 2 number_of_apples = 10 cost = cost_per_apple * number_of_apples result = cost return result
If Mary wants to save $5000 in 6 months, how much should she save per month, assuming she saves the same amount each month?
def solve() -> int: savings_per_month = 5000/6 result = savings_per_month return result
Student: John, Peter and William have 8 pencils to share, if they each get the same number of pencils, how many pencils does each get?
def solve() -> int: pencils = 8 pencils_each = pencils // 3 result = pencils_each return result
A bakery sells cakes for $30 each. They have a monthly rent of $600 and their monthly utilities cost $400. If they sell 25 cakes in a month, what is their profit for the month?
def solve() -> int: cake_price = 30 rent = 600 utilities = 400 cakes_sold = 25 total_revenue = cake_price * cakes_sold total_expenses = rent + utilities profit = total_revenue - total_expenses result = profit return result
A recipe calls for 2 1/2 cups of flour. If Emily only has 1 3/4 cups of flour, how much more does she need?
def solve() -> int: flour_needed = 2 + 1/2 flour_have = 1 + 3/4 flour_needed -= flour_have result = flour_needed return result
Student: Paul needs to get from point A to point B, which is 500 miles away. He drives for 5 hours at a constant speed of 75mph and then takes a 5 minute break. Then he drives for another 7 hours at a speed of 65mph. How many miles has Paul traveled?
def solve() -> int: distance_A_B = 500 speed_1 = 75 time_1 = 5 break_time = 5 speed_2 = 65 time_2 = 7 distance_1 = speed_1 * time_1 break_time_hours = break_time / 60 distance_2 = speed_2 * (time_2 - break_time_hours) total_distance = distance_1 + distance_2 result =...
John has a basket with 2 dozen apples. If he gives 4 apples each to 8 children, how many apples are still in the basket?
def solve() -> int: apples_in_dozen = 12 total_apples = 2 * apples_in_dozen num_children = 8 apples_per_child = 4 total_apples_given = num_children * apples_per_child apples_remaining = total_apples - total_apples_given result = apples_remaining return ...
If Natalie goes for a walk for 1 mile on Monday and 2 miles on Tuesday. Then she goes for a walk for 3 miles every day for the next 6 days. If Natalie wants to walk a total of 25 miles in the week (Monday to Sunday), how many miles should she walk on Sunday?
def solve() -> int: monday = 1 tuesday = 2 daily = 3 total_miles = 25 remaining_miles = total_miles - (monday + tuesday + (daily * 6)) sunday = remaining_miles result = sunday return result
Rodney has a collection of 20 coins. 6 of the coins are dimes, 8 of the coins are pennies and the other 6 coins are nickels. How much money is in his collection?
def solve() -> int: dime_num = 6 penny_num = 8 nickel_num = 6 dime_value = 0.10 penny_value = 0.01 nickel_value = 0.05 total_dime_value = dime_num * dime_value total_penny_value = penny_num * penny_value total_nickel_value = nickel_num * nickel_value total_value ...
Possible new questions and programs: A farmer plants 36 rows of corn, each with 24 plants. He expects to harvest 3 ears of corn from each plant. However, due to a drought, he only gets 2 ears of corn from 15% of the plants, and 1 ear of corn from 10% of the plants. The rest of the plants yield 3 ears of corn as expecte...
def solve() -> int: ROWS = 36 PLANTS = 24 EAR_NORMAL = 3 EAR_LOW = 2 EAR_POOR = 1 PERCENT_LOW = 0.15 PERCENT_POOR = 0.1 normal_plants = PLANTS * (1 - PERCENT_LOW - PERCENT_POOR) low_plants = PLANTS * PERCENT_LOW poor_plants = PLANTS * PERCENT_POOR ears_normal = norm...
Michael read 6 fewer pages of the novel than his friend, John. John read 60 pages and each page had 400 words. For the pages that Michael read, he read each page with 350 words. How many words did Michael and John read in total?
def solve() -> int: john_pages = 60 john_words_per_page = 400 michael_pages = john_pages - 6 michael_words_per_page = 350 john_total_words = john_pages * john_words_per_page michael_total_words = michael_pages * michael_words_per_page total_words = john_total_words + michael_total_...
Rajiv received a 25% commission on a $1000 sale. How much money did he make from the commission?
def solve() -> int: sale_amount = 1000 commission_percentage = 25 commission_amount = (commission_percentage/100)*sale_amount result = commission_amount return result
There were 20 caterpillars living in the garden. 8 grew wings so the flew away and 3 laid eggs of which hatched 2 caterpillars, how many caterpillars were left in the garden?
def solve() -> int: caterpillars_in_garden = 20 fly_away = 8 laid_eggs = 3 new_caterpillars_from_eggs = laid_eggs * 2 result = caterpillars_in_garden + new_caterpillars_from_eggs - fly_away return result
Jack is planning a road trip that is 200 miles long and would normally take him 5 hours. But he misses a turn and has to drive an extra 70 miles. If he maintains the same speed, how long will his trip take?
def solve() -> int: distance = 200 + 70 speed = distance / 5 time = distance / speed result = time return result
Student: A triangle has 6 more than twice as many degrees as a right angle. What is the measure of the triangle in degrees?
def solve() -> int: right_angle = 90 triangle = 0 triangle = right_angle + 6 * 2 result = triangle return result
Emily is a cook, and she needs to make 50 cupcakes for her niece's birthday party. If each cupcake requires 3 eggs, how many eggs does she need to make all of the cupcakes?
def solve() -> int: num_cupcakes = 50 eggs_per_cupcake = 3 total_eggs = num_cupcakes * eggs_per_cupcake result = total_eggs return result
In a pharmacy, they normally fill an average of 50 prescriptions a day. With 90 days left in the year, they've filled 4000 prescriptions. How many prescriptions on average do they need to fill to finish the year with the normal average?
def solve() -> int: avg_daily_prescriptions = 50 days_left = 90 total_prescriptions_filled = 4000 total_days = 365 total_prescriptions_needed = (avg_daily_prescriptions * total_days) - total_prescriptions_filled prescriptions_per_day_needed = total_prescriptions_needed / days_left ...
Find 3 times the difference of the square of 4 and the cube of 2?
def solve() -> int: num1 = 4 num2 = 2 square = num1**2 cube = num2**3 difference = square - cube three_times_difference = difference * 3 result = three_times_difference return result
andyread 15 books in a week, but she lost 2 books in the library. How many books does Sandy have left?
def solve() -> int: total = 0 for i in range (15): total += 1 for i in range(2): total -= 1 result = total return result
Student: Viral can draw 20 pictures in an hour. How many pictures can Viral draw in 5 hours?
def solve() -> int: pictures_per_hour = 20 hours = 5 total_pictures = pictures_per_hour * hours result = total_pictures return result
Laura has ordered cupcakes for her party and is putting all of them on trays. Most of the cupcakes are put into large trays and the remaining 14 cupcakes are put into small trays. The large trays each contain 24 cupcakes each. If Laura has ordered a total of 420 cupcakes, how many large trays did she use?
def solve() -> int: small_trays = 14 large_trays = 24 total_cupcakes = 420 cupcakes_on_small_trays = small_trays cupcakes_on_large_trays = total_cupcakes - cupcakes_on_small_trays num_large_trays = cupcakes_on_large_trays // large_trays result = num_large_trays ...
If a square-shaped garden has an area of 100 square meters, how many 1-meter long garden hoses can be placed end-to-end across the diagonal of the garden?
def solve() -> int: area = 100 side_length = area ** 0.5 diagonal_length = (2 * side_length) ** 0.5 num_hoses = diagonal_length result = num_hoses return result
A car can go 280 miles on a full tank of gas. If the car has already driven 85 miles, how much more distance can it travel on the remaining gas?
def solve() -> int: total_distance = 280 driven_distance = 85 remaining_distance = total_distance - driven_distance result = remaining_distance return result
A baker made 24 loaves of bread and cut each loaf into 12 slices. He sold 8 slices for $1 each and gave away the rest to charity. How much money did he make and how many slices did he donate?
def solve() -> int: loaves = 24 slices_per_loaf = 12 price_per_slice = 1 slices_sold = 8 total_slices = loaves * slices_per_loaf slices_donated = total_slices - slices_sold money_earned = slices_sold * price_per_slice result = (money_earned, slices_donated) ...
During the summer sale, the department store is offering a 45% discount on all swimwear. On Thursdays, there is an additional $12.00 off on all swimwear after the summer discount is applied. If a swimsuit costs $38 before sales tax, what was the original price of the swimsuit before all the discounts?
def solve() -> int: original_price = 38 discount = 0.45 additional_discount = 12.00 price_after_discount = original_price * (1 - discount) final_price = price_after_discount - additional_discount original_price = final_price / (1 - discount) result = original_price re...
Robert wants to buy a ticket for a concert. The ticket price is $75 and he is charged 5% convenience fee. If the tax rate is 12%, how much will Robert end up spending on the ticket?
def solve() -> int: price = 75 convenience_fee = 0.05 tax = 0.12 total_price = price + price * convenience_fee + price * tax result = total_price return result
Alex has a comic book collection he likes to add to. He started with 200 comic books he inherited from his grandfather. Over the next year, he increased this by 50%. The following year he collected 10 each week. The year after that he collected 4 every fifth week. The year after that he lost three-eighths of them when ...
def solve() -> int: initial_collection = 200 increase = initial_collection * 0.5 new_collection = initial_collection + increase weekly_collection = 10 * 52 new_collection += weekly_collection five_weeks = 52 // 5 four_each_five_weeks = 4 * five_weeks new_collection += four...
Jane has 30 basketball cards. If she has traded away 16 of them, how many cards does Jane have now?
def solve() -> int: remaining_cards = 0 total_cards = 30 traded_cards = 16 remaining_cards = total_cards - traded_cards result = remaining_cards return result
Jack's grandma gave him $40 to buy a jacket for $32.50, a hat for $5.75, and a scarf for $6.50. He also had a coupon for 10% off the jacket. At the store, the cashier informed him that the hat was buy one get one 25% off. How much money did Jack have left after buying all the items?
def solve() -> int: jacket_price = 32.50 hat_price = 5.75 scarf_price = 6.50 jacket_discount = jacket_price * 0.10 jacket_final_price = jacket_price - jacket_discount hat_discount = hat_price * 0.25 hat_final_price = hat_price - hat_discount total_cost = jacket_final_price...
Sarah is adding chocolate chips, walnuts and raisins to her cookies in a 1 : 2 : 3 ratio. If she uses 4 cups of raisins, how many cups of ingredients does she use total?
def solve() -> int: raisins = 4 chocolate_chips = raisins * 1 walnuts = raisins * 2 total_cups = raisins + chocolate_chips + walnuts result = total_cups return result
Possible math questions and programs: Emma bakes 4 batches of cookies. Each batch has 18 cookies and she sells them for 50 cents each. How much money does she make?
def solve() -> int: batches = 4 cookies_per_batch = 18 price_per_cookie = 0.5 total_cookies = batches * cookies_per_batch revenue = total_cookies * price_per_cookie result = revenue return result
A rectangular garden has a length of 12 meters and a width of 8 meters. What is the area of the garden in square meters?
def solve() -> int: length = 12 width = 8 area = length * width result = area return result
The souvenir shop on the Space Station Gamma sells magnets and stickers. The cost of three magnets is equal to the cost of five stickers. If one sticker costs $0.50, how much does 15 magnets cost, in dollars?
def solve() -> int: sticker_cost = 0.5 magnet_cost = (sticker_cost * 5) / 3 result = magnet_cost * 15 return result
Student: Q9: The box contains twice as many crayons as in the bag. The bag has seven crayons. How many crayons are in the box?
def solve() -> int: bag = 7 box = bag * 2 result = box return result
Emily is an avid tennis player. She spends $80/month on court rental, $15 on tennis balls every month, and $50 for new shoes every six months. How much does she spend on tennis expenses in a year?
def solve() -> int: court_rental = 80 tennis_balls = 15 shoes = 50/6 total_monthly_expenses = court_rental + tennis_balls + shoes total_yearly_expenses = total_monthly_expenses * 12 result = total_yearly_expenses return result
``` To make homemade popcorn, John added 1/3 cup of kernels to the pot, and 2 tbsp of oil. If the pot held 7 cups of popped corn, what is the ratio of unpopped kernels to popped corn?
def solve() -> int: cups_of_kernels = 1/3 cups_of_popped_corn = 7 unpopped_to_popped_ratio = cups_of_kernels / cups_of_popped_corn result = unpopped_to_popped_ratio return result
David and James are both planting new shrubs in their garden. David can plant 10 shrubs in 5 hours while James can plant 9 shrubs in 3 hours. After 6 hours, how many more shrubs will David have planted than James?
def solve() -> int: david_shrubs_per_hour = 10 / 5 james_shrubs_per_hour = 9 / 3 david_shrubs_planted = david_shrubs_per_hour * 6 james_shrubs_planted = james_shrubs_per_hour * 6 more_shrubs_planted = david_shrubs_planted - james_shrubs_planted result = more_shrubs_planted ret...
Dan has $10 more than Grace and they both have the same amount of money. How much money do they each have?
def solve() -> int: difference = 10 total = difference * 2 each = total / 2 result = each return result
Some possible new questions are: Four students had a bake sale and sold 36 cupcakes, 20 pies, and 48 muffins. The cupcakes were sold for $1.5 each, the pies for $3 each, and the muffins for $2 each. How much money did they make in total?
def solve() -> int: cupcakes = 36 pies = 20 muffins = 48 cupcake_price = 1.5 pie_price = 3 muffin_price = 2 total_money = cupcakes * cupcake_price + pies * pie_price + muffins * muffin_price result = total_money return result
Gail has 11 ducks and 1/6 of them are male. She gave away 4 of the male ducks. What percent of her remaining ducks are male (rounded to the nearest percent)?
def solve() -> int: male_ducks = 11 * 1/6 given_away = 4 remaining_ducks = male_ducks - given_away percentage = male_ducks / remaining_ducks * 100 result = round(percentage) return result
I had 74 apples in all. I had 5 more red apples than green apples. How many green apples did I have?
def solve() -> int: total_apples = 74 more_red_apples = 5 green_apples = total_apples - more_red_apples result = green_apples return result