question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A pool has a length of 20 meters, a width of 15 meters, and a depth of 3 meters. If it is filled with water, how many cubic meters of water will it have?
def solve() -> int: length = 20 width = 15 depth = 3 volume = length * width * depth result = volume return result
Rachel and Eric are going to a concert. It takes 1 hour for Rachel to get to the concert and it takes three times as much time for Eric to get there. If Rachel leaves her home at 7 p.m., at what time should Eric leave his home so that they both arrive at the same time?
def solve() -> int: rachel_time = 1 eric_time = rachel_time * 3 total_time = rachel_time + eric_time eric_leave_time = 7 - eric_time result = f'{eric_leave_time}:00 PM' return result
You want to rent a car for 3 weeks. The cost of renting a car for 1 week is $150. What is the total cost of renting the car for 3 weeks?
def solve() -> int: weekly_cost = 150 num_weeks = 3 total_cost = weekly_cost * num_weeks result = total_cost return result
Clair watches TV for 5 hours a day from Monday to Thursday, and 11 hours a day on Friday and Saturday. How many hours does Clair spend watching TV in one week?
def solve() -> int: sum_week = 0 for day in range(5): sum_week += 5 sum_week = sum_week + 22 result = sum_week return result
Emily owes her school library $50 for an overdue book but paid back $25 before agreeing to work off the rest. If she earns $10 per hour, how many hours will Emily have to work to pay off her remaining debt?
def solve() -> int: debt = 50 paid_back = 25 remaining_debt = debt - paid_back hourly_wage = 10 hours_to_work = remaining_debt / hourly_wage result = hours_to_work return result
There are 30 children at a birthday party. There are 72 cupcakes available for them. Half the children have 2 cupcakes each. The other half have 1/2 a cupcake each. How many cupcakes are leftover?
def solve() -> int: num_children = 30 num_cupcakes = 72 num_2_cupcakes = num_children // 2 num_half_cupcakes = num_children // 2 total_cupcakes_used = num_2_cupcakes * 2 + num_half_cupcakes * 0.5 num_cupcakes_leftover = num_cupcakes - total_cupcakes_used result ...
A classroom has 24 students who each need a notebook, a pencil, and an eraser for a math test. The teacher buys the notebooks from a store that sells them for $1.50 each, the pencils from another store that sells them for $0.25 each, and the erasers from a third store that sells them for $0.10 each. However, due to a s...
def solve() -> int: notebook_original = 1.50 notebook_current = notebook_original * 1.10 pencil_original = 0.25 pencil_current = pencil_original * 1.20 eraser_original = 0.10 eraser_current = eraser_original * 1.30 original_cost = notebook_original * 24 + pencil_original * 24 + erase...
Alex has $100. He spent 20% of it on a video game. How much money does he have left?
def solve() -> int: original_money = 100 percent_spent = 20 money_spent = original_money * (percent_spent/100) money_left = original_money - money_spent result = money_left return result
Some possible new questions and programs are: Sam has 24 chocolates to share with his friends. He gives 3 chocolates to each of his 4 best friends, and the rest of the chocolates are divided equally among 5 other friends. How many chocolates does each of the 5 other friends get?
def solve() -> int: chocolates_left = 24 - 3 * 4 chocolates_per_friend = chocolates_left / 5 result = chocolates_per_friend return result
Student: A store is offering a 10% discount on all items. If the original price of a watch was $80, what is the new price including the discount?
def solve() -> int: original_price = 80 discount_rate = 0.1 discount_amount = original_price * discount_rate new_price = original_price - discount_amount result = new_price return result
A jar holds some marbles, two fifths are green, 25 are yellow, and the rest are blue. If there are 78 marbles in total, how many blue marbles are there?
def solve() -> int: total_marbles = 78 green_marbles = total_marbles * 2 // 5 yellow_marbles = 25 blue_marbles = total_marbles - green_marbles - yellow_marbles result = blue_marbles return result
A restaurant has 500 customers on a busy day. 60% of the customers order pizza and 20% of the pizza orders are vegetarian. How many vegetarian pizzas are ordered?
def solve() -> int: total_customers = 500 pizza_customers = total_customers * 0.6 vegetarian_pizzas = pizza_customers * 0.2 result = vegetarian_pizzas return result
A water tank can hold 2000 liters of water. In one minute, 20 liters of water is pumped into the tank. How long will it take to fill the tank completely?
def solve() -> int: tank_capacity = 2000 water_pumped_per_minute = 20 time = tank_capacity / water_pumped_per_minute result = time return result
Tom saved $10 less than Angela. Together they saved $50. How much did Tom save? Use A to represent how much Angela saved.
def solve() -> int: A = 50 - 10 result = A return result
Olivia can buy a new bike for $600 that will last 10 years, or buy 2 used bikes for $250 each that will each last 5 years. How much money will she save by picking the cheaper option?
def solve() -> int: new_bike_cost = 600 new_bike_lifetime = 10 used_bike_cost = 250 used_bike_lifetime = 5 new_bike_total_cost = new_bike_cost used_bike_total_cost = 2 * used_bike_cost new_bike_cost_per_year = new_bike_total_cost / new_bike_lifetime used_bike_cost_per_year...
Amy can eat a whole pizza in 20 minutes, while Betty can eat a whole pizza in 30 minutes. How long would it take for them both to eat a whole pizza if they eat together?
def solve() -> int: a = 20 b = 30 work_rate = 1/a + 1/b time_taken = 1/work_rate result = time_taken return result
Norma had 45 photos on her wall. She took down 10 of them and replaced them with 3 new photos. How many photos remain on the wall?
def solve() -> int: photos_original = 45 photos_taken_down = 10 photos_added = 3 result = photos_original - photos_taken_down + photos_added return result
John has $40 and Jane has $10. If John gives Jane half of his money, Jane will have more money than John. But if Jane spends $8, how much more money does she have left than John?
def solve() -> int: john_money = 40 jane_money = 10 john_money = john_money - john_money/2 jane_money = jane_money + john_money/2 jane_money = jane_money - 8 difference = jane_money - john_money result = difference return result
Tyler wants to buy ice cream for himself and his 10 friends. Each scoop costs $1.50 and can feed 1 person. If Tyler earns $5 every 30 minutes washing cars, how many minutes will he have to work to afford the ice cream?
def solve() -> int: scoops_needed = 11 cost_per_scoop = 1.50 total_cost = scoops_needed * cost_per_scoop earnings_per_hour = 10 earnings_per_minute = earnings_per_hour / 60 minutes_needed = total_cost / earnings_per_minute result = minutes_needed return result
Dan had a bicycle that could go 20 miles on a fully charged battery. He rode his bicycle to a library 8 miles away, and then to a cafe 4 miles away. He spent some time at the cafe and realized that he had only 2 miles of battery left. He decided to go to a nearby charging station 3 miles away. How much battery did he u...
def solve() -> int: battery_per_mile = 20 / 20 battery_after_library = 20 - (8 * battery_per_mile) battery_after_cafe = battery_after_library - (4 * battery_per_mile) battery_to_charge = (3 * battery_per_mile) - battery_after_cafe battery_to_go_home = (4 + 8) * battery_per_mile ...
A company's total expenses for a month are $5000. If $1500 of that goes towards rent and $750 goes towards employee salaries, how much money is left for other expenses?
def solve() -> int: total_expenses = 5000 rent_expense = 1500 salaries_expense = 750 other_expenses = total_expenses - rent_expense - salaries_expense result = other_expenses return result
Amanda runs from her school to the park. Then she runs at the same speed, 30 miles to her friend's house. It takes Amanda one and a halfSamantha goes to the gas station and buys 3 bottles of water for $1.25 each. She then buys 6 bags of chips that cost $0.75 each. She spent 1/8 of the money she earned from babysitting....
def solve() -> int: bottles_of_water = 3 cost_per_bottle = 1.25 bags_of_chips = 6 cost_per_bag = 0.75 total_cost = (bottles_of_water * cost_per_bottle) + (bags_of_chips * cost_per_bag) money_earned = total_cost * 8 hours_of_babysitting = money_earned / 2.25 result = hours_of_babysitting ...
Emily works at a grocery store and gets paid $10 per hour. If she works 40 hours a week, how much money will she make?
def solve() -> int: pay_rate = 10 num_hours = 40 total_money = pay_rate * num_hours result = total_money return result
A recipe calls for 2/3 cup of sugar and 3/4 cup of flour. If you want to triple the recipe, how much sugar and flour do you need in total?
def solve() -> int: sugar = (2/3)*3 flour = (3/4)*3 result = sugar + flour return result
Jason has $55 more than Molly but $20 less than Victoria. If Victoria has $130, how much will each person get if they donate their money to eleven shoppers to be shared equally?
def solve() -> int: jason = 0 molly = 0 victoria = 130 jason = victoria - 20 - 55 total_money = jason + molly + victoria money_per_shopper = total_money / 11 result = money_per_shopper return result
A library has 540 books, with 5 times as many non-fiction books as fiction books. How many fiction books are there in total?
def solve() -> int: total_books = 540 non_fiction_ratio = 5 total_parts = non_fiction_ratio+1 fiction_parts = 1/total_parts fiction_books = fiction_parts*total_books result = fiction_books return result
Student: Kyle has $4.98 in his pocket. He has some coins that are 5 cents and 10 cents coins. How many 5 cents coins does he have?
def solve() -> int: total_amount = 4.98 coin_5_cents = 0.05 coin_10_cents = 0.10 num_of_5_cents_coins = total_amount // coin_5_cents remaining_amount = total_amount % coin_5_cents num_of_10_cents_coins = remaining_amount // coin_10_cents total_num_of_coins = num_of_5_cents_coins + num_of_10_...
A fruit seller has 50 bananas. If each customer can buy only 4 bananas, how many customers can the seller serve?
def solve() -> int: no_of_bananas = 50 no_of_bananas_per_customer = 4 no_of_customers = no_of_bananas//no_of_bananas_per_customer result = no_of_customers return result
Vivian is buying a new phone for $600. The store charges 10% sales tax. How much will Vivian have to pay in total, including sales tax?
def solve() -> int: phone_price = 600 tax_rate = 0.1 total_amount = phone_price total_amount_with_tax = total_amount * (1 + tax_rate) result = total_amount_with_tax return result
A gallon of milk costs $3.50. If a family buys 3 gallons of milk, 2 loaves of bread for $2.00 each, and 1 dozen eggs for $1.50, what is their total cost?
def solve() -> int: milk_cost = 3.5 * 3 bread_cost = 2 * 2 eggs_cost = 1.5 total_cost = milk_cost + bread_cost + eggs_cost result = total_cost return result
If the ratio of boys to girls in a class is 2:3 and the class has 25 students, how many girls are in the class?
def solve() -> int: total_ratio = 2+3 girls_ratio = 3/total_ratio girls = girls_ratio * 25 result = girls return result
Student: There are 70 people in a movie theater. If each person's ticket is $9.99, how much money did the theater earn from tickets?
def solve() -> int: num_people = 70 ticket_price = 9.99 total_earnings = num_people * ticket_price result = total_earnings return result
Martha ran a race that was 7 miles long. She ran 5 miles of the race at a speed of 8 miles per hour and the rest of the race at a speed of 9 miles per hour. How long did it take Martha to run the entire race?
def solve() -> int: time_8 = 5 time_9 = 7 - time_8 time_taken_8 = time_8 / 8.0 time_taken_9 = time_9 / 9.0 result = time_taken_8 + time_taken_9 return result
Bill walks his dog 2 miles a day, 7 days a week. How many miles does Bill walk in a 5 week period?
def solve() -> int: total_miles = 0 miles_week = 2 * 7 total_miles = miles_week * 5 result = total_miles return result
Chad is building a new shed and he needs to buy enough panels for the walls. Each wall needs 25 panels and there are a total of 4 walls. How many panels will Chad need in total?
def solve() -> int: total_panels = 0 walls = 4 while walls > 0: total_panels += 25 walls -= 1 result = total_panels return result
Sarah saves $300 every month. She has saved for 5 months. If she spends $200 every month, how much money does she have left?
def solve() -> int: savings_per_month = 300 num_of_months = 5 expenditure_per_month = 200 total_savings = savings_per_month * num_of_months total_expenditure = expenditure_per_month * num_of_months result = total_savings - total_expenditure return result
Olivia buys three bags of chips and two bottles of soda for $14. If each bag of chips costs $2 and each bottle of soda costs $3, how much is one bag of chips?
def solve() -> int: total_price = 14 number_of_chips = 3 number_of_sodas = 2 price_per_chip = 2 price_per_soda = 3 total_price_chips = number_of_chips * price_per_chip total_price_sodas = number_of_sodas * price_per_soda price_per_bag = (total_price - total_price_sodas) / number_of_chips...
Student: A book has a total of 200 pages. If Daniel reads 20 pages/day, how many days will it take him to finish the book?
def solve() -> int: pages = 200 pages_per_day = 20 days = pages / pages_per_day result = days return result
At a karaoke night, 40% of 100 songs were sung by Emma, 1/4th were sung by John, 2/5th were sung by Ada, and 1/6th were sung by Michael. How many songs were sung in total?
def solve() -> int: emma_songs = 0.4 * 100 john_songs = 0.25 * 100 ada_songs = 0.4 * 100 michael_songs = 1/6 * 100 total_songs = emma_songs + john_songs + ada_songs + michael_songs result = total_songs return result
Tom has a rectangular garden that is 10 meters long and 6 meters wide. He wants to plant carrots in a square area that covers one-fourth of the garden. How long is the side of the square area?
def solve() -> int: garden_area = 10 * 6 square_area = garden_area / 4 side_length = square_area ** 0.5 result = side_length return result
Emily's water container weighs 2 liters. If she adds 50% of its weight, what is its new weight in liters? She can sell the container for $5 per liter. How much more is it worth after gaining the weight?
def solve() -> int: container_weight = 2 added_weight = container_weight * 0.5 new_weight = container_weight + added_weight worth_before = container_weight * 5 worth_after = new_weight * 5 difference = worth_after - worth_before result = difference return result
an can make 9 pies with 3 apples per pie. How many apples does he need to make 27 pies?
def solve() -> int: apples = 3 num_of_pies = 27 total_apples = apples * num_of_pies result = total_apples return result
Possible new questions are: Tammy had 54 stickers. She gave 9 stickers to her friend and used 2/9 of the remaining stickers to decorate her notebook. How many stickers does she have left?
def solve() -> int: stickers_after_giving = 54 - 9 stickers_used = 2/9 * stickers_after_giving stickers_left = stickers_after_giving - stickers_used result = stickers_left return result
A city has 3 lakes: Lake A, Lake B, and Lake C. Lake A contains 40% of the total fish population, and Lake B contains 25% of the total fish population. If Lake C has 150 fish, what is the total fish population?
def solve() -> int: lake_a_percentage = 0.4 lake_b_percentage = 0.25 lake_c_fish = 150 total_fish_population = lake_c_fish / (lake_a_percentage + lake_b_percentage) result = total_fish_population return result
Cindy has 20 stickers. She gave 4 stickers to her friend. She then got 8 more stickers. How many stickers does she have now?
def solve() -> int: stickers = 20 stickers -= 4 stickers += 8 result = stickers return result
arah gets paid $100 per day for the first 5 days she works, and after that, she gets paid $150 per day. If she works for 10 days in total, how much money does she earn?
def solve() -> int: days = 10 salary1 = min(days, 5) * 100 salary2 = max(days - 5, 0) * 150 total_salary = salary1 + salary2 result = total_salary return result
Kyle is organizing his DVD collection to donate to a local library. He has 30 horror movies, 20 comedies, and 25 dramas. His roommate wants to contribute by donating 10 movies, and Kyle decides to add twice as many movies as his roommate did. In the end, Kyle donated a total of 105 movies. How many of the donated movie...
def solve() -> int: horror_movies = 30 comedies = 20 dramas = 25 roommate_donation = 10 kyle_donation = 2 * roommate_donation total_donation = roommate_donation + kyle_donation kyle_movies = total_donation - roommate_donation result = kyle_movies return result
Student: Each pink book has 60 pages while each white book has 40 pages. James read 8 pink books and 4 white books. How many more pink pages did he read than white pages?
def solve() -> int: pink_pages = 60 white_pages = 40 num_pink_books = 8 num_white_books = 4 total_pink_pages = pink_pages * num_pink_books total_white_pages = white_pages * num_white_books difference = total_pink_pages - total_white_pages result = difference return result
A grocery store offers 6 tomatoes for $2, 3 cucumbers for $1.50, 8 bell peppers for $3, 4 garlic bulbs for $1.20, and 2 onions for $0.80. If a customer buys everything, how much does it cost all together?
def solve() -> int: tomatoes_price = 2/6 cucumbers_price = 1.5/3 bell_peppers_price = 3/8 garlic_bulbs_price = 1.2/4 onions_price = 0.8/2 total_cost = 6*tomatoes_price + 3*cucumbers_price + 8*bell_peppers_price + 4*garlic_bulbs_price + 2*onions_price result = round(total_cost, 2) ...
David has a garden with 30 tomato plants. Each plant produces 4 tomatoes per week. How many tomatoes will David have after 3 weeks?
def solve() -> int: plants = 30 tomatoes_per_plant_per_week = 4 weeks = 3 total_tomatoes = plants * tomatoes_per_plant_per_week * weeks result = total_tomatoes return result
Lisa is a wardrobe stylist who charges her clients based on the number of outfits she creates for them. On Monday, Wednesday, and Friday, she creates 15 outfits. On Tuesday, she creates 12 outfits. On Thursday, she creates 9 outfits. If each outfit costs $40, how much does Lisa earn in a week?
def solve() -> int: mon_wed_fri_outfits = 15 tue_outfits = 12 thu_outfits = 9 outfits_per_week = (mon_wed_fri_outfits * 3) + tue_outfits + thu_outfits total_earnings = outfits_per_week * 40 result = total_earnings return result
After shopping at a store, Stefanie bought 4 shirts, 3 shorts, and 6 pairs of socks. The shirts cost 4 times as much as the shorts, and for every 2 pairs of socks, she spent the same amount as for 1 short. How much did she pay for each item?
def solve() -> int: shorts_price = 1 socks_price = shorts_price * 1/2 shirts_price = shorts_price * 4 total_price = (4 * shirts_price) + (3 * shorts_price) + (6 * socks_price) result = "Shirts cost " + str(shirts_price) + ", Shorts cost " + str(shorts_price) + " and Socks cost " + str(sock...
Student: A charity organization is holding a benefit and will distribute $1000 amongst its 10 volunteers. The lead volunteers will receive twice as much as the remaining volunteers. The other 8 volunteers will share the remaining $400 equally. What will the lead volunteers receive in total?
def solve() -> int: amount = 1000 lead_amount = 2 * (amount - 400) / 2 remaining_amount = 400 / 8 result = lead_amount + remaining_amount return result
If Brad has 10 more than three times the number of pencils Pat has, and they have 72 pencils together, how many pencils does Pat have?
def solve() -> int: total_pencils = 72 Brad_pencils = total_pencils - 10 Pat_pencils = Brad_pencils / 3 result = Pat_pencils return result
A recipe calls for 2 cups of flour to make 8 cookies. How much flour is needed to make 20 cookies?
def solve() -> int: cookie_num_1 = 8 cookie_num_2 = 20 flour_1 = 2 flour_2 = (flour_1 / cookie_num_1) * cookie_num_2 result = flour_2 return result
There are 24 eggs in a basket. If 1/3 of them were broken and 4 were eaten, how many eggs are still in the basket?
def solve() -> int: remaining_eggs = 24 - 4 remaining_eggs -= (1/3)*remaining_eggs result = remaining_eggs return result
Q9: Alice has 16 pads of paper. She used 3 pads every day. How many days was Alice able to use the pads of paper?
def solve() -> int: total_pads = 16 pads_used = 3 days_paper_used = total_pads // pads_used result = days_paper_used return result
Student: Joe went to the electronics store and bought a new monitor, keyboard, and mouse. The keyboard was half the cost of the monitor, and the mouse cost $20. The total cost for all three items was $350. How much did Joe pay for the monitor?
def solve() -> int: monitor_cost = 0 keyboard_cost = 0 mouse_cost = 20 total_cost = 350 keyboard_cost = total_cost - mouse_cost monitor_cost = 2 * keyboard_cost result = monitor_cost return result
Leo has a budget of $120 to buy some books. He bought a science book that cost $28 and a history book that cost $35. Then, he bought two novels that cost $15 each. How much money did he spend in total and how much is left in his budget?
def solve() -> int: budget = 120 science = 28 history = 35 novel = 15 total_cost = science + history + 2 * novel remaining = budget - total_cost result = f'Leo spent ${total_cost} and has ${remaining} left in his budget.' return result
Student: Chris visited the local store and purchased 2 oranges that cost $3 each, 4 apples that cost $1 each, plus 3 bananas that cost $2 each. How much did Chris spend?
def solve() -> int: oranges = 2 orange_price = 3 apples = 4 apple_price = 1 bananas = 3 banana_price = 2 orange_cost = oranges * orange_price apple_cost = apples * apple_price banana_cost = bananas * banana_price total_cost = orange_cost + apple_cost + banana_cost result = to...
Student: A book costs $25 before tax. The tax rate is 6%. You have a coupon for 10% off the original price before tax. How much would you pay for the book?
def solve() -> int: book_price = 25 tax_rate = 0.06 coupon_rate = 0.10 discounted_price = book_price * (1 - coupon_rate) tax_amount = discounted_price * tax_rate final_price = discounted_price + tax_amount result = final_price return result
A car drives at a speed of 55 miles per hour. If the car starts at 8:00 AM and drives for 3 hours and 10 minutes, what time does it arrive at its destination?
def solve() -> int: speed = 55 time_hours = 3 + 10/60 start_time = 8 end_time_hours = start_time + time_hours result = end_time_hours return result
Student: Mary has 25 apples and wants to divide them equally among her 5 friends. How many apples will each friend get?
def solve() -> int: num_apples = 25 num_friends = 5 num_apples_per_friend = num_apples // num_friends remaining_apples = num_apples % num_friends result = num_apples_per_friend return result
Ben is 8 years old. If his uncle is 25 years older than him, how old will Ben be when his uncle is 50?
def solve() -> int: difference = 25 years = 50 - (8 + difference) result = 8 + years return result
Peter left for his summer road trip. After arriving at his first destination, he drove twice the distance to his second destination. The third point on his trip was just 20 miles away, which was divided in thirds of the total distance he traveled to that point. Finally, he drove 5 times the distance over the first two ...
def solve() -> int: distance_to_second_destination = 100 distance_to_third_destination = distance_to_second_destination * 2 total_distance_to_third_destination = distance_to_second_destination + distance_to_third_destination + 20 distance_to_final_destination = 5 * (distance_to_second_destination + dist...
haron goes to the convenience store 6 times a week. Every time she goes there, she buys 10 bottles of water. How many bottles of water does she buy each week?
def solve() -> int: total_bottles = 0 for i in range(6): total_bottles += 10 result = total_bottles return result
A teacher gives a test worth 100 points. If Sarah got a 93 on the test, what percentage of the total points did she get?
def solve() -> int: total_points = 100 sarah_points = 93 sarah_percentage = sarah_points / total_points * 100 result = sarah_percentage return result
Emma needs to make 24 cupcakes for a bake sale. She only has one package of cake mix which makes 12 cupcakes. How many packages of cake mix should Emma buy?
def solve() -> int: packages_needed = 0 while (packages_needed * 12) < 24: packages_needed += 1 result = packages_needed return result
A grocery store has 12 checkout lanes, and each lane can serve 1 customer per minute. If the store is open for 9 hours, and there are 500 customers, how long is the average wait time in line?
def solve() -> int: num_lanes = 12 serve_rate = 1 store_hours = 9 total_customers = 500 total_serve_time = total_customers / (num_lanes * serve_rate) total_wait_time = (store_hours * 60) - total_serve_time avg_wait_time = total_wait_time / total_customers result = avg_wait_tim...
Nick has saved $600 for a camera he wanted to buy, he still needed $1700, if he asked his two sisters and father for help and his father gave him 1/3 of what he lacked and each of his sister gave him half of what his father gave him, how much money did Nick need?
def solve() -> int: result = 0 lack = 1700 - 600 f = lack/3 s1 = f/2 s2 = s1 total = lack + f + s1 + s2 result = total - 600 return result
If 2 pizzas cost $16, how much will 4 pizzas cost?
def solve() -> int: num_pizzas_1 = 2 num_pizzas_2 = 4 cost_1 = 16 cost_per_pizza = cost_1 / num_pizzas_1 total_cost = cost_per_pizza * num_pizzas_2 result = total_cost return result
In a music competition, Mia and Ethan are on one team. The team's final score is obtained by adding the scores of the musicians of the same team. Mia scored 45 points while Ethan scored 3 times the score of Mia. What was their team's total score?
def solve() -> int: mia_score = 45 ethan_score = 3 * mia_score team_score = mia_score + ethan_score result = team_score return result
John drinks coffee. Every four cups of coffee he drinks, he needs to buy a new coffee mug. Every six cups of coffee, he gives away one cup to his colleague. Every two days, he buys a bag of coffee which contains 24 cups. If John had 10 mugs and has been drinking coffee for 10 days, how many coffee mugs does he have now...
def solve() -> int: cups_per_day = 4 days = 10 bags_of_coffee = days // 2 cups_of_coffee = bags_of_coffee * 24 new_mugs = cups_of_coffee // cups_per_day initial_mugs = 10 mugs_now = initial_mugs + new_mugs - (days // 6) result = mugs_now return...
A recipe calls for 4 cups of flour, but you only have 2 cups. You want to make half of the recipe, how much flour do you need in total?
def solve() -> int: recipe_flour = 4 available_flour = 2 half_recipe_flour = recipe_flour / 2 total_flour_needed = half_recipe_flour - available_flour result = total_flour_needed return result
Leo bought a book for $15 and a pen for $2. He paid with a $20 bill and received some change. He then gave $3 of his change to his brother. How much money did Leo have left?
def solve() -> int: total_cost = 15 + 2 change = 20 - total_cost money_left = change - 3 result = money_left return result
Student: Lily has 18 chocolates worth $1 each. She gives 4 of them to her friend Emma and receives 2 chocolates worth $2 each and a $1 coin in return. She then spends $3 on buying 6 chocolates worth $0.50 each from a shop. How much money does Lily have left after these transactions?
def solve() -> int: chocolates_lily = 18 price_lily = 1 chocolates_given = 4 chocolates_received = 2 coin_received = 1 spent = 3 chocolates_bought = 6 price_bought = 0.5 money_left = (chocolates_lily * price_lily) - (chocolates_given * price_lily) + (chocolates_received * price_lily)...
John has 5 times more pencils than pens. If he has 15 pens, how many pencils does John have?
def solve() -> int: num_pens = 15 num_pencils = num_pens * 5 result = num_pencils return result
A math test has 20 questions and a passing grade is 75%. How many questions does a student need to answer correctly to pass the test?
def solve() -> int: required_score = 20*0.75 result = required_score return result
Emma has 10 boxes of blueberries, each box containing 11 kgs. She divides the blueberries into 4 groups. What is the total weight, in kilograms, of the blueberries in each group?
def solve() -> int: total_kilograms = 10 * 11 weight_per_group = total_kilograms / 4 result = weight_per_group return result
A milkshake costs $4.45. If Alex has $20, how many milkshakes can Alex buy and how much money will be left with him?
def solve() -> int: milkshakes_count = 20//4.45 change = round(20 - (milkshakes_count*4.45), 2) result = (milkshakes_count, change) return result
A train travels a distance of 600 miles in 12 hours. If the train's speed is the same the entire way, how fast was the train traveling?
def solve() -> int: distance = 600 time = 12 speed = distance/time result = "The train was traveling at a speed of {:.2f} miles per hour.".format(speed) return result
Emily is cycling from her house to a friend's house. Her house is 8 miles away and she gets there in 40 minutes. The next day, she is cycling to another friend's house which is 15 miles away from her friend's house. If she cycles at the same speed, how long will the journey take?
def solve() -> int: distance_to_friend = 8 time_to_friend = 40 distance_to_second_friend = 15 time_to_second_friend = (distance_to_second_friend / distance_to_friend) * time_to_friend result = time_to_second_friend return result
If it takes 4 men 6 hours to paint a house, how many hours would it take 6 men to paint the same house?
def solve() -> int: men_1 = 4 hours_1 = 6 men_2 = 6 hours_2 = (men_1 * hours_1)/men_2 result = hours_2 return result
The bakery made 100 cupcakes for a party. If each guest ate 3 cupcakes, how many guests were at the party?
def solve() -> int: cupcakes = 100 cupcakes_per_guest = 3 guests = cupcakes / cupcakes_per_guest result = guests return result
Maria wants to start using her bike to commute to work. She buys a new bike for $500 and gets a $50 discount. It used to cost her $5 a day to take public transportation. She saves $3 a day by biking to work. How long until the new bike pays for itself?
def solve() -> int: bike_cost = 500 discount = 50 public_transportation_cost = 5 biking_savings = 3 effective_bike_cost = bike_cost - discount daily_savings = biking_savings - public_transportation_cost days_to_pay_off = effective_bike_cost / daily_savings result = days_to_pay_...
Possible math questions and programs: Jamal is sorting his books by genre. He has 32 books in total, of which 16 are fiction, 8 are non-fiction, and the rest are comics. Each shelf can hold 12 books. How many shelves does Jamal need?
def solve() -> int: fiction = 16 nonfiction = 8 comics = 32 - fiction - nonfiction fiction_shelves = fiction // 12 + (fiction % 12 > 0) nonfiction_shelves = nonfiction // 12 + (nonfiction % 12 > 0) comics_shelves = comics // 12 + (comics % 12 > 0) total_shelves = fiction_shelves +...
5. Scott is planning a picnic with his friends. He has to drive 20 minutes to the location and will need 10 minutes to set up the picnic blankets. How much time does he have to get there by if he wants to arrive at 3PM?
def solve() -> int: travel_time = 20 setup_time = 10 arrival_time = 3 available_time = 0 total_travel_time = travel_time + setup_time result = arrival_time - total_travel_time - available_time return result
A rectangle has a length that is 4 times its width. If the perimeter of the rectangle is 50, what is the length of the rectangle?
def solve() -> int: total_sides = 2*(4+1) perimeter = 50 width = perimeter / total_sides length = width * 4 result = length return result
Tony had 60 cookies in his jar at the start of the year. In June he bought 25 more cookies. In October he gave 10 of his cookies away, and ate 12 cookies himself. In December he gave another 20 cookies away. How many cookies does Tony have left in December?
def solve() -> int: n_cookies_beginning = 60 n_bought_june = 25 n_given_october = 10 n_eaten_october = 12 n_given_december = 20 n_cookies_end = n_cookies_beginning + n_bought_june - n_given_october - n_eaten_october - n_given_december result = n_cookies_end return result
A store sold $85 worth of goods on Monday. On Tuesday, the store sold twice as much as on Monday. If the average price of a good is $7, how many goods were sold in total?
def solve() -> int: goods_sold_monday = 85/7 goods_sold_tuesday = 2*goods_sold_monday total_goods_sold = goods_sold_monday + goods_sold_tuesday result = total_goods_sold return result
Maria needs 10 boxes of pencils. Katie needs 5 less boxes of pencils than Maria. How many boxes of pencils will they need together?
def solve() -> int: maria = 10 katie = maria - 5 total_boxes = maria + katie result = total_boxes return result
At a clothing store, Maria is awarded 30 points for every $7 she spends, and a bonus of 200 points if she shops for more than $100. Maria bought a dress for $40, a shirt for $25, and a pair of shoes for $60. How many points did she earn?
def solve() -> int: dress_price = 40 shirt_price = 25 shoes_price = 60 total_spent = dress_price + shirt_price + shoes_price points_per_dollar = 30 / 7 points_earned = total_spent * points_per_dollar if total_spent > 100: points_earned += 200 result = points_e...
Emily has 10 hamsters. 3 hamsters weigh 2 ounces each. 2 hamsters weigh 0.5 pounds each. The other 5 hamsters have a combined weight of 120 grams. What is the total weight of all of her hamsters in pounds?
def solve() -> int: weight_hamster1 = 2 / 16 weight_hamster2 = 2 / 16 weight_hamster3 = 2 / 16 weight_hamster4 = 0.5 weight_hamster5 = 0.5 weight_hamster6 = 120 / 1000 * 2.205 weight_hamster7 = 120 / 1000 * 2.205 weight_hamster8 = 120 / 1000 * 2.205 weight_hamster9 = 120 / 1000 * 2.2...
Rachel takes a taxi to an amusement park that is 10 miles away. If it takes her 20 minutes to arrive at the amusement park and the taxi charges $2.00 per mile, what was the total cost of her ride? Ethan baked muffins for his office team. Each batch contains 24 muffins. His team has 6 total members. He made two batches....
def solve() -> int: distance = 10 time = 20 cost_per_mile = 2.00 total_cost = distance * cost_per_mile result = total_cost batch_size = 24 team_size = 6 num_batches = 2 blueberries_per_muffin = 3 total_muffins = batch_size * num_batches muffins_per_person ...
Student: A birthday cake weighs 2 kg. During a party, 6 equally large pieces were cut from the cake. What is the weight of a single piece?
def solve() -> int: cake_weight = 2 pieces = 6 piece_weight = cake_weight / pieces result = piece_weight return result
Jack wants to go to the beach for some sun and relaxation. If he takes the coastal road, it will take him 4 hours to arrive; but if he takes the highway, it will only take him 1 and a half hours to get there. How much time will he save if he takes the highway to the beach and back to his home?
def solve() -> int: coastal_road_time = 4 highway_time = 1.5 total_time_coastal = coastal_road_time * 2 total_time_highway = highway_time * 2 time_saved = total_time_coastal - total_time_highway result = time_saved return result
haron has 8 pencils, Kim has 5 pencils, and Louis has 4 pencils. If Sharon gives 2 pencils to Kim and 1 pencil to Louis, how many pencils do they have together?
def solve() -> int: pencils_sharon = 8 pencils_kim = 5 pencils_louis = 4 sharon_give_kim = 2 sharon_give_louis = 1 pencils_sharon = pencils_sharon - sharon_give_kim - sharon_give_louis pencils_kim = pencils_kim + sharon_give_kim pencils_louis = pencils_louis + sharon_give_louis ...
The radius of a wheel is 30 cm. How far will the wheel travel in 10 turns?
def solve() -> int: radius = 30/100 circumference = 2 * 3.14 * radius distance = circumference * 10 result = distance return result
A car rental company offers cars on rent for $40 a day. The company plans to purchase five more cars, each for a cost of $20,000. A new customer demands ten cars for ten consecutive days, and the company wants to make a profit of 10%. What should be the rental price per day for each car?
def solve() -> int: def profit(rental_price): revenue = 10 * rental_price * 10 cost = 400 * 10 + 20 * 50000 return revenue - 1.1 * cost from scipy.optimize import minimize result = minimize(lambda x: -1 * profit(x), 0) result = round(result.x[0], 2) re...
A spa charges $50 for a facial. Kelly gets a facial and a manicure. The manicure costs $20. She also buys some skincare products which cost $30 each. She leaves a 10% tip on everything she orders. How much did she spend at the spa?
def solve() -> int: facial_cost = 50 manicure_cost = 20 skincare_product_cost = 30 tip_percentage = 0.1 total_cost = facial_cost + manicure_cost + (3 * skincare_product_cost) tip_amount = total_cost * tip_percentage total_cost_with_tip = total_cost + tip_amount result = total_c...