question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Rose had to complete a report that was supposed to take her 14 days. If she took a break for 3 days and slept for 8 hours each day, how long did she spend working on the report?
def solve() -> int: days_to_complete_report = 14 break_days = 3 hours_slept_per_day = 8 total_hours_slept = break_days * hours_slept_per_day total_hours_worked = (days_to_complete_report - break_days) * 24 - total_hours_slept result = total_hours_worked return result
Jackie has 4 packages of crayons with 24 crayons in each package. How many crayons does she have in total?
def solve() -> int: crayons_in_package = 24 number_of_packages = 4 total_crayons = crayons_in_package * number_of_packages result = total_crayons return result
A pizza costs $15. If the cost is split equally among 3 people, how much will each person pay?
def solve() -> int: price_of_pizza = 15 num_of_people = 3 amount_per_person = price_of_pizza / num_of_people result = amount_per_person return result
Eric had 360 marbles and he took away 1/6 of them. What is the remaining number of marbles?
def solve() -> int: total_marbles = 360 fraction_taken = 1/6 remaining_marbles = total_marbles - (fraction_taken*total_marbles) result = remaining_marbles return result
Mark and Molly want to purchase a new carpet for their living room and agreed to share the cost. A square yard of carpet costs $70 and can cover up to 9 square feet. If their living room floor area is 162 square feet and they want to add an additional layer of padding, how much will each of them contribute to the cost ...
def solve() -> int: cost_per_square_yard = 70 square_feet_per_square_yard = 9 living_room_area = 162 total_area = living_room_area * 2 total_cost = (total_area / square_feet_per_square_yard) * cost_per_square_yard contribution_per_person = total_cost / 2 result = f'<<<{contr...
Student: John went to the grocery store to buy fruits for a fruit salad. He bought 4 apples at 50 cents each, 2 pears at 75 cents each, and 3 oranges at 25 cents each. If he gave the cashier $5, how much change did he receive?
def solve() -> int: apples = 4 apples_price = 0.5 pears = 2 pears_price = 0.75 oranges = 3 oranges_price = 0.25 cash = 5 total_price = apples * apples_price + pears * pears_price + oranges * oranges_price change = cash - total_price result = change return result
A company offers its employees a salary increase of 10%. If an employee currently earns $50,000, what will be their new salary?
def solve() -> int: current_salary = 50000 percent_increase = 0.1 salary_increase = current_salary * percent_increase new_salary = current_salary + salary_increase result = new_salary return result
Ali is purchasing 30 tablets for his store. Each tablet costs $9. If he also needs to buy 25 stickers for $0.50 each, how much money does he need to purchase all of the items?
def solve() -> int: price_tablet = 9 number_tablet = 30 price_sticker = 0.50 number_sticker = 25 total_cost = price_tablet*number_tablet + price_sticker*number_sticker result = total_cost return result
Ella, Tom and Jess are selling lemonade. Ella sells 30 cups of lemonade, Tom sells 24 and Jess sells 27. They decide to split the money they earn equally. Each cup of lemonade costs 50 cents. Ella gives 2 dollars to Tom and 1 dollar to Jess. Tom gives 3 dollars to Ella and 2 dollars to Jess. Jess gives 4 dollars to Ell...
def solve() -> int: ella = 30 * 0.5 tom = 24 * 0.5 jess = 27 * 0.5 total = ella + tom + jess average = total / 3 ella = ella - 2 - 1 + 3 + 4 tom = tom + 2 - 3 - 2 + 1 jess = jess + 1 - 4 + 2 - 1 result = ella - jess return result
Student: A bottle of water has a volume of 500 milliliters. If one serving size is 200 milliliters, how many servings are in the bottle?
def solve() -> int: bottle_volume = 500 serving_size = 200 num_servings = bottle_volume / serving_size result = num_servings return result
A baker uses 2 cups of sugar for every 3 cups of flour. If the baker needs 12 cups of flour, how many cups of sugar are needed?
def solve() -> int: flour = 12 flour_per_sugar = 3/2 sugar = (flour/flour_per_sugar) result = sugar return result
If 60% of students in a school are girls, and there are 900 students in the school, how many of them are boys?
def solve() -> int: girls = 0.6*900 boys = 900 - girls result = boys return result
A video game company has 10,000 players and is expecting a 25% growth rate after launching new features. How many players will be using the game after the growth period?
def solve() -> int: initial_players = 10000 growth_rate = 0.25 new_players = initial_players * growth_rate total_players = initial_players + new_players result = total_players return result
- Lisa arranged some books on 4 shelves. The first shelf had 8 books, the second shelf had 5 books more than the first, the third shelf had 3 books less than the second, and the fourth shelf had half as many books as the third. If the fifth shelf has 4 books more than the fourth, how many books did Lisa arrange in tota...
def solve() -> int: shelf1 = 8 shelf2 = shelf1 + 5 shelf3 = shelf2 - 3 shelf4 = shelf3 // 2 shelf5 = shelf4 + 4 total = shelf1 + shelf2 + shelf3 + shelf4 + shelf5 result = total return result
Student: A bakery sells cupcakes for $3 each. They have sold 400 cupcakes in a day. What is the total revenue generated from cupcake sales in a day?
def solve() -> int: cupcake_price = 3 num_cupcakes_sold = 400 total_revenue = cupcake_price * num_cupcakes_sold result = total_revenue return result
A store wants to make a profit of $100 selling 20 hats each at $25. How much should the store buy one hat at most?
def solve() -> int: num_hats = 20 selling_price = 25 profit = 100 cost_price = (profit + num_hats * selling_price) / num_hats result = cost_price return result
A train leaves a station traveling at a speed of 60 miles per hour. Another train leaves the same station 3 hours later traveling at a speed of 80 miles per hour. How long will it take for the second train to catch up to the first train?
def solve() -> int: initial_distance = 60 * 3 first_train_speed = 60 second_train_speed = 80 relative_velocity = second_train_speed - first_train_speed time_to_catch_up = initial_distance/relative_velocity result = time_to_catch_up return result
A bus travels at a speed of 60 km/h for 3 hours and then at a speed of 70 km/h for the next 4 hours. What is the bus's average speed?
def solve() -> int: total_distance = 60*3 + 70*4 total_time = 3 + 4 average_speed = total_distance/total_time result = average_speed return result
Oliver and Mia are playing tennis. Oliver can serve the ball as far as 22 meters and he does this 6 times. Mia can only serve the ball as far as 7 meters and she does this 9 times. Each time Oliver serves the ball, he retrieves it and serves it again. Mia leaves the ball where it lands every time she serves it. In tota...
def solve() -> int: oliver_serve_distance = 22 oliver_serve_times = 6 mia_serve_distance = 7 mia_serve_times = 9 oliver_total_distance = oliver_serve_distance * oliver_serve_times * 2 mia_total_distance = mia_serve_distance * mia_serve_times total_distance = oliver_total_distance +...
Jerry earned 15 more dollars than Tom. Tom earned 4 times as much money as Lisa. If Lisa earned 5 dollars, how much money did Jerry earn?
def solve() -> int: lisa = 5 tom = 4 * lisa jerry = tom + 15 result = jerry return result
Jack gets to pick which movies he and his family will watch on movie nights five times as often as any other family member. If the family watches a total of 20 movies per month, and each movie lasts for 2 hours, how many hours of movie time does Jack get to choose?
def solve() -> int: total_movies = 20 movie_duration = 2 jack_ratio = 5 jack_movies = total_movies / (jack_ratio + 1) jack_movie_time = jack_movies * movie_duration result = jack_movie_time return result
Some possible questions and programs are: Lisa has a sticker book with 36 pages. Each page has 9 stickers of different animals. She wants to give one sticker of each animal to her friend Amy. How many stickers does she need to give to Amy in total?
def solve() -> int: pages = 36 stickers_per_page = 9 total_stickers = pages * stickers_per_page different_animals = stickers_per_page stickers_to_amy = different_animals result = stickers_to_amy return result
Student: Sarah bought 5 cans of soup, each can containing 8 cup of soup. How many total cups of soup did Sarah buy?
def solve() -> int: cans = 5 cups_per_can = 8 total_cups = cans * cups_per_can result = total_cups return result
Each chef needs 5 pounds of potatoes to make a dish. Each customer orders 2 dishes. Each restaurant needs to serve 50 customers a day. How many pounds of potatoes get used every day if the restaurant has a capacity of serving 4 times its need?
def solve() -> int: chef_potatoes_needed = 5 customer_orders = 2 restaurant_capacity = 4 potatoes_used_per_customer = chef_potatoes_needed * customer_orders potatoes_used_per_day = potatoes_used_per_customer * restaurant_capacity result = potatoes_used_per_day return result
Zoe ate 6 more than two thirds the number of candies that Sam ate. If Sam ate 630 candies, how many more candies did Zoe eat?
def solve() -> int: zoe = 6 + (2/3) * 630 difference = zoe - 630 result = -36 return result
Student: If 3 apples and 3 oranges cost $3.60, and 4 apples and 5 oranges cost $6.55, how much does 1 apple and 1 orange cost?
def solve() -> int: apples = 3 oranges = 3 cost1 = 3.60 apples2 = 4 oranges2 = 5 cost2 = 6.55 total_cost = cost2 - (apples2 - apples) * (cost2 - cost1) / (apples2 - apples + oranges2 - oranges) cost_per_apple_and_orange = total_cost / (apples2 - apples + oranges2 - oranges) result = ...
If John has 25 five-dollar bills and 10 twenty-dollar bills, how many fifty-dollar bills can he make?
def solve() -> int: bill_total = (25*5) + (10*20) num_fifty_bills = bill_total // 50 result = num_fifty_bills return result
Mike can jump 3 times further than Lucy. If they each jump 12 feet, how far can Mike jump?
def solve() -> int: lucy_jump = 12 mike_jump = lucy_jump + lucy_jump*3 result = mike_jump result = 48 return result
If a phone company charges $0.10 per minute for the first 100 minutes and $0.05 per minute after that, how much will a customer pay for a 150-minute phone call?
def solve() -> int: first_100_minutes_cost = 0.10 after_100_minutes_cost = 0.05 total_minutes = 150 if total_minutes <= 100: total_cost = total_minutes * first_100_minutes_cost else: cost_of_first_100 = first_100_minutes_cost * 100 cost_of_after_100 = after_100_minutes_cost *...
Emma has $500. She spends 35% of it on a purse and saves the rest. The purse cost her $125. How much money did she save?
def solve() -> int: Total_money = 500 Percentage_spent = 35 Money_spent = (Percentage_spent/100) * Total_money Cost_of_purse = 125 Money_saved = Total_money - (Money_spent + Cost_of_purse) result = Money_saved return result
Student: A farmer has 260 acres of land. 75% of the land is used for growing crops, and the rest is for grazing livestock. How many acres are used for grazing livestock?
def solve() -> int: total_acres = 260 percent_crops = 0.75 acres_crops = total_acres * percent_crops acres_livestock = total_acres - acres_crops result = acres_livestock return result
Emily's fish tank has 2 goldfish and 5 guppies. Samuel's fish tank has 2 less than 3 times as many fish as Emily's tank. How many fish are in Samuel's tank?
def solve() -> int: emilys_goldfish = 2 emilys_guppies = 5 samuels_fish = 3 * (emilys_goldfish + emilys_guppies) - 2 result = samuels_fish return result
Possible new questions: Kevin and Maria want to make cookies for their class party next week. They have a recipe that makes 24 cookies and requires 2 cups of flour, 1 cup of sugar, and 0.5 cups of butter. They want to make enough cookies for 36 students, each getting 2 cookies. If they have 10 cups of flour, 6 cups of ...
def solve() -> int: total_cookies = 36 * 2 batches = (total_cookies + 23) // 24 flour_needed = 2 * batches sugar_needed = 1 * batches butter_needed = 0.5 * batches flour_left = 10 - flour_needed sugar_left = 6 - sugar_needed butter_left = 4 - butter_needed result...
A patient receives two injections every month. The first injection costs 45 euros while the second costs 80 euros. How much would the patient pay for 5 months worth of injections?
def solve() -> int: injection1 = 45 injection2 = 80 months = 5 totalCost1 = injection1 * months totalCost2 = injection2 * months totalCost = totalCost1 + totalCost2 result = totalCost return result
A recipe for pancakes calls for 2 cups of flour and makes 8 pancakes. If you want to make 24 pancakes, how many cups of flour do you need?
def solve() -> int: pancakes_per_recipe = 8 flour_per_recipe = 2 desired_pancakes = 24 flour_per_pancake = flour_per_recipe / pancakes_per_recipe flour_needed = desired_pancakes * flour_per_pancake result = flour_needed return result
A jar of mixed nuts is made of 20% almonds, 35% peanuts, and the remainder is other nuts. If the jar has 100 peanuts, how many nuts are in the jar?
def solve() -> int: total_nuts = 0 almonds = 0 peanuts = 100 other_nuts = 0 peanuts_percentage = 35 almonds_percentage = 20 other_nuts_percentage = 100 - peanuts_percentage - almonds_percentage total_nuts = peanuts / (peanuts_percentage / 100) almonds = total_nuts * (a...
Student: John wants to bake 5 cakes, and each cake requires 3 cups of flour. If he has only 15 cups of flour, how many more cups of flour does he need to buy?
def solve() -> int: num_cakes = 5 num_cups_per_cake = 3 num_cups_available = 15 num_cups_needed = num_cakes * num_cups_per_cake num_cups_to_buy = num_cups_needed - num_cups_available result = num_cups_to_buy return result
A rectangular yard has a length of 20 feet and a width of 15 feet. If you want to cover the yard with grass, and each square yard of grass costs $5, how much will it cost to cover the yard with grass?
def solve() -> int: length = 20 width = 15 area = length*width cost_per_square_yard = 5 total_cost = area*cost_per_square_yard result = total_cost return result
Student: A carnival game pays out prizes based on a player’s age. If the player is under 10 years old, the prize payout is $1.50. If the player is 10 years old or older, the prize payout is $3.00. If one-thousand players under the age of 10 played the game and 3,000 players aged 10 or older played the game, what is the...
def solve() -> int: under_10 = 1000 over_10 = 3000 prize_under_10 = 1.50 prize_over_10 = 3.00 total_prize_under_10 = under_10 * prize_under_10 total_prize_over_10 = over_10 * prize_over_10 result = total_prize_under_10 + total_prize_over_10 return result
Angela has a collection of 80 antique objects from different eras. During her trip to Egypt, she found 40 new antique objects on the first day and double that number on the second day. She didn't buy any new objects on the last day of her trip. What is the new total number of antique objects in Angela's collection?
def solve() -> int: antique_objects = 80 new_objects_first_day = 40 new_objects_second_day = 2 * new_objects_first_day new_total_objects = antique_objects + new_objects_first_day + new_objects_second_day result = new_total_objects return result
Mr. Smith is planting roses in his garden. He has 20% fewer roses than Mrs. Jones. If Mrs. Jones has 120 roses, how many roses does Mr. Smith have?
def solve() -> int: mrs_jones = 120 mr_smith = mrs_jones * 0.8 result = mr_smith return result
Bernie has $3500 in his wallet, and $2000 invested in a business. If the business's stock price rises 15% and then he sells all of his stocks, how much money will he have in his wallet?
def solve() -> int: my_wallet = 3500 investment = 2000 interest_rate = 0.15 interest = (interest_rate * investment) when_sold_investment = (investment + interest) result = (my_wallet + when_sold_investment) return result
1. Dana is a baker. She baked 12 cupcakes and 6 muffins on Monday. On Tuesday, she baked three times as many cupcakes as muffins. How many baked goods did Dana bake in total on Monday and Tuesday?
def solve() -> int: cupcakes_monday = 12 muffins_monday = 6 muffins_tuesday = 9 cupcakes_tuesday = 3 * muffins_tuesday total_baked_goods = cupcakes_monday + muffins_monday + cupcakes_tuesday + muffins_tuesday result = total_baked_goods return result
In Russia, they normally receive an average of 7 hours of sunlight a day. With 250 days left in the year, they've only received 800 hours of sunlight. How many hours of sunlight on average do they need to receive each day to finish the year with their normal average?
def solve() -> int: average_sunlight = 7 days_left = 250 current_sunlight = 800 total_sunlight_needed = (365 * average_sunlight) - current_sunlight sunlight_per_day_needed = total_sunlight_needed / days_left result = sunlight_per_day_needed return result
Olivia and her colleagues went to a conference. Olivia saw 75 people join them. At 2:00, 25 people left the conference. What's the total number of people at the conference if they all stayed until the end of the event?
def solve() -> int: olivia_colleagues = 75 people_left = 25 total_people = olivia_colleagues - people_left result = total_people return result
Emma wants to add a new deck to her backyard. She has to pay $450 for permits. She hires a construction crew which charges $200 per day and works for 6 days. She also pays an inspector who offers a 80% discount to ensure the deck meets all safety standards. What is the total cost?
def solve() -> int: permits_cost = 450 construction_cost_per_day = 200 construction_days = 6 inspector_discount = 0.8 construction_cost = construction_cost_per_day * construction_days inspector_cost = construction_cost * (1 - inspector_discount) total_cost = permits_cost + construc...
If a basket of fries has 20 fries and each fry contains 102 calories, and a bag of chips has 30 chips and each chip contains 78 calories, how many more calories does the basket of fries have?
def solve() -> int: fries_per_basket = 20 calories_per_fry = 102 chips_per_bag = 30 calories_per_chip = 78 total_calories_fries = fries_per_basket * calories_per_fry total_calories_chips = chips_per_bag * calories_per_chip calories_difference = total_calories_fries - total_calories...
They also make 800 cupcakes per day and sell them for $4 each. If they sold all their cakes and cupcakes in 5 days, how much money did they earn?
def solve() -> int: total_cakes = 500 * 5 total_cupcakes = 800 * 5 revenue_cakes = total_cakes * 12 revenue_cupcakes = total_cupcakes * 4 total_revenue = revenue_cakes + revenue_cupcakes result = total_revenue return result
Student: A pie shop made 100 pies. They sold 3/4th of the pies and threw away 6 pies because they were spoilt. How many pies were left with them in the end?
def solve() -> int: total_pies = 100 sold_pies = 3/4 * total_pies spoilt_pies = 6 pies_left = total_pies - sold_pies - spoilt_pies result = pies_left return result
Student: John went on a hiking trip. He walked for 2 hours at a speed of 4 km/h and then for another 3 hours at a speed of 5 km/h. How far in total did John hike?
def solve() -> int: time1 = 2 speed1 = 4 time2 = 3 speed2 = 5 distance1 = time1 * speed1 distance2 = time2 * speed2 total_distance = distance1 + distance2 result = total_distance return result
Cody collects stickers and he wants to trade them with his friends. He has 75 stickers in total, and he gives away 5 stickers for every 3 stickers he receives. He trades with 6 friends and receives a different number of stickers from each of them: 4, 6, 8, 7, 9, and 5. How many stickers does he have after trading with ...
def solve() -> int: stickers = 75 received = [4, 6, 8, 7, 9, 5] for r in received: given = r * 5/3 stickers = stickers - given + r stickers = int(round(stickers)) result = "He has " + str(stickers) + " stickers after trading with all his friends." return result
In a math competition, Sophia solved 4 more problems than Michael, and Michael solved half as many problems as James. If James solved 12 problems, how many problems did all three participants solve if Michael solved 3 problems?
def solve() -> int: james_problems = 12 michael_problems = 3 sophia_problems = michael_problems + 4 james_and_michael_problems = james_problems + michael_problems james_and_michael_and_sophia_problems = james_and_michael_problems + sophia_problems james_and_michael_and_sophia_problems += james_p...
Karen bought a bicycle for $200 and sold it for $250. If her profit was $30, how much did she spend on repair and maintenance?
def solve() -> int: cost_price = 200 selling_price = 250 profit = 30 repair_and_maintenance = (cost_price + profit) - selling_price result = repair_and_maintenance return result
50 identical apples were split into 10 baskets. Each basket held the same number of apples. How many apples were in each basket?
def solve() -> int: total_apples = 50 number_of_baskets = 10 apples_per_basket = total_apples / number_of_baskets result = apples_per_basket return result
Student: A new phone model costs $1000. It gradually decreases in price so that after 4 years, its value is only $500. Assuming the decrease occurs at a constant rate, what is the value of the phone after 2 years?
def solve() -> int: initial_price = 1000 final_price = 500 time_span = 4 rate = (final_price - initial_price) / time_span value = initial_price + rate * 2 result = value return result
Olivia is making a bracelet that needs to support 12 beads. Each bead weighs 0.5 ounces, and the bracelet itself weighs 3 ounces. If Olivia adds 4 more empty beads to the bracelet, how much weight will it need to hold up?
def solve() -> int: num_beads = 12 bead_weight = 0.5 bracelet_weight = 3 num_empty_beads = 4 total_weight = num_beads * bead_weight + bracelet_weight new_weight = (num_beads + num_empty_beads) * bead_weight + bracelet_weight result = new_weight - total_weight return result...
A recipe to make 12 cupcakes requires 2 cups of flour. How many cups of flour would be needed to make 30 cupcakes?
def solve() -> int: cups_per_cupcake = 2/12 cups_of_flour = 30 * cups_per_cupcake result = cups_of_flour return result
Andy has 4 bottles of soda with 16 ounces in each bottle. He gave Julia 4 more ounces than he gave to Ethan. If Andy gave 8 ounces to Ethan, how many ounces does he have left?
def solve() -> int: bottles_of_soda = 4 ounces_per_bottle = 16 ounces_given_to_ethan = 8 ounces_given_to_julia = ounces_given_to_ethan + 4 total_ounces_given = ounces_given_to_ethan + ounces_given_to_julia total_ounces = bottles_of_soda * ounces_per_bottle ounces_left = total_ounces - t...
There are two vessels A and B. Vessel A can contain 18 litres of pure milk and vessel B can contain 20 litres of pure water. In vessel A, there is initially 12 litres of pure milk and in vessel B, there is initially 16 litres of pure water. 6 litres of the mixture from vessel A is taken out and poured into vessel B. Si...
def solve() -> int: milk_in_A = 12 - (6/18)*12 + (9/29)*16 water_in_B = 16 + (6/18)*0 - (9/29)*16 result = milk_in_A/water_in_B return result
Haley went to the store and spent $25 on a t-shirt and a pair of shorts. The t-shirt costs $15. How much was the pair of shorts?
def solve() -> int: total_spent = 25 tshirt_cost = 15 shorts_cost = total_spent - tshirt_cost result = shorts_cost return result
A rectangular pool has a length of 8 m and a width of 5 m. How much water is needed to fill the pool if the depth is 2 m?
def solve() -> int: length = 8 width = 5 depth = 2 water_needed = length * width * depth result = water_needed return result
A bookshelf has 5 shelves, each with 10 books. If 20 books are removed from the bookshelf, how many books are left?
def solve() -> int: books_per_shelf = 10 shelves = 5 total_books = books_per_shelf * shelves books_removed = 20 books_remaining = total_books - books_removed result = books_remaining return result
Ethan's music player can hold up to 100 songs. If he already has 45 on his playlist, how many more songs can he add?
def solve() -> int: max_songs = 100 current_songs = 45 remaining_songs = max_songs - current_songs result = remaining_songs return result
In a bakery, 50% of the pie crusts are gluten-free and there are 75 gluten-containing pie crusts. How many gluten-free pie crusts are there in the bakery?
def solve() -> int: total_pie_crusts = 100 gluten_free_pie_crusts = (total_pie_crusts - 75) * 0.5 result = gluten_free_pie_crusts return result
- Bob buys a pack of 50 pencils, each costing 10 cents. He uses 12 pencils and loses 8 pencils. He then sells the remaining pencils for 15 cents each. How much profit or loss did he make?
def solve() -> int: cost = 50 * 0.1 left = 50 - 12 - 8 earn = left * 0.15 difference = earn - cost result = difference return result
Paige has purchased 6 boxes of chocolates and shared them with her friends. If she has given away 1/2 of them, how many boxes does she have left?
def solve() -> int: chocolates = 6 total = chocolates given_away = 1/2 * total remaining_chocolates = total - given_away result = round(remaining_chocolates) return result
Liam is pouring sand into a sandbox at a rate of 2 cups every 30 seconds. How many more cups of sand does he need to pour into the sandbox to fill it up if he has been pouring sand for 10 minutes?
def solve() -> int: cups_per_second = 2/30 cups_per_minute = cups_per_second * 60 total_cups = cups_per_minute * 10 remaining_cups = 100 - total_cups result = remaining_cups return result
Olivia is observing how many passengers get off at each bus stop. She has counted 89 passengers today. There were 23 people at the first stop, 15 people at the second stop, and the rest got off at the third stop. If the first stop had 1 person per bus, and the second stop had 3 people per bus, how many buses did Olivia...
def solve() -> int: total_passengers = 89 first_stop = 23 second_stop = 15 passengers_third_stop = total_passengers - first_stop - second_stop buses_seen = first_stop + (second_stop // 3) + passengers_third_stop result = buses_seen return result
A school has 600 students. If the school has 22 classes with equal number of students, how many students are in each class?
def solve() -> int: num_students = 600 num_classes = 22 students_per_class = num_students / num_classes result = students_per_class return result
Amanda earned $500. She donated 40% of it to charity. Elizabeth spent $180 more than half of Amanda's remaining money. How much did Elizabeth spend?
def solve() -> int: amanda_money = 500 donated_money = amanda_money * 0.4 remaining_money = amanda_money - donated_money elizabeth_spent = (remaining_money / 2) + 180 result = elizabeth_spent return result
Result: 15.0 A store is having a sale where everything is 10% off. If a shirt originally costs $25, how much will it cost during the sale?
def solve() -> int: shirt_cost = 25 discount_rate = 0.10 discount_amount = shirt_cost * discount_rate final_cost = shirt_cost - discount_amount result = final_cost return result
Sam and Alex went to a donut shop. Sam ordered four donuts, and Alex ordered half as much donuts as Sam did. If they order another set of donuts, how many donuts will Alex have eaten in all?
def solve() -> int: sam_donuts = 4 alex_donuts = sam_donuts / 2 total_donuts = sam_donuts + alex_donuts result = total_donuts return result
During November, the baker sold 175 cakes at $28 and 150 pies at $12. How much did the baker earn?
def solve() -> int: cakes_sold = 175 cakes_price = 28 pies_sold = 150 pies_price = 12 cake_earnings = cakes_sold * cakes_price pie_earnings = pies_sold * pies_price total_earnings = cake_earnings + pie_earnings result = total_earnings return result
Ben and Sam share a pizza that is cut into 8 equal slices. Ben eats 3 slices and Sam eats 2 slices. Then they order another pizza of the same size and cut it into 12 equal slices. Ben eats 4 slices and Sam eats 5 slices. How many slices of pizza do Ben and Sam eat in total?
def solve() -> int: first_pizza = 8 ben_first = 3 sam_first = 2 second_pizza = 12 ben_second = 4 sam_second = 5 total_slices = ben_first + sam_first + ben_second + sam_second result = total_slices return result
Rory has 28 books. He gave 7 books to his friend. How many books does Rory have left?
def solve() -> int: number_books_rory_has = 28 number_books_rory_gave_away = 7 result = number_books_rory_has - number_books_rory_gave_away return result
Dylan has a part-time job that pays him $10 per hour. He worked 24 hours last month and saved $100 from his earnings. This month he intends to work only 16 hours but wants to save twice as much money as last month. How much will he need to save per hour to achieve his goal?
def solve() -> int: hourly_rate = 10 hours_last_month = 24 savings_last_month = 100 hours_this_month = 16 savings_this_month = 2 * savings_last_month savings_per_hour = savings_this_month / hours_this_month result = savings_per_hour return result
Jenny received $500 from her parents to buy books for school. She bought one book for $50 and two notebooks for $10 each. Then, she bought three pens for $4 each. How much money does Jenny have left?
def solve() -> int: starting_amount = 500 book_cost = 50 notebook_cost = 10 * 2 pen_cost = 4 * 3 result = starting_amount - book_cost - notebook_cost - pen_cost return result
Lisa works as a tutor and charges $25 an hour for regular sessions and $30 an hour for extra sessions. She has 12 regular sessions and 4 extra sessions in a week. She also spends $10 on gas and $5 on snacks each day. How much money does she make in a week?
def solve() -> int: total_money = 0 total_money += 12 * 25 total_money += 4 * 30 total_money -= 5 * (10 + 5) result = total_money return result
If a car uses 15 gallons of gas to drive 300 miles, and a truck uses twice as much gas per mile as the car, how many gallons of gas does it take for the truck to travel 450 miles? Samantha just started college at 18 years old while her sister is 24. How old will Samantha be when her sister is twice as old as Samantha c...
def solve() -> int: car_gas = 15 car_distance = 300 car_gas_per_mile = car_gas / car_distance truck_gas_per_mile = car_gas_per_mile * 2 truck_distance = 450 truck_gas = truck_gas_per_mile * truck_distance result = truck_gas return result
A theme park conducted a survey amongst its visitors about their satisfaction with the rides. 25% of the respondents rated Excellent; 55% rated Very Satisfactory; 80% of the remaining respondents rated Satisfactory and the rest rated Needs Improvement. If 500 visitors answered the survey, how many of them rated Needs I...
def solve() -> int: total_visitors = 500 excellent = total_visitors * 0.25 very_satisfactory = total_visitors * 0.55 remaining = total_visitors - excellent - very_satisfactory satisfactory = remaining * 0.8 needs_improvement = remaining - satisfactory result = needs_improvement ...
ome possible new questions are: Oscar is baking apple pies for his friends. He needs 8 apples for each pie, and he has 12 bags of apples. Each bag contains 6 apples, but 10% of them are rotten and cannot be used. How many apples does Oscar need to buy to make 15 pies?
def solve() -> int: total_apples = 12 * 6 rotten_apples = total_apples * 0.1 good_apples = total_apples - rotten_apples apples_needed = 15 * 8 apples_to_buy = apples_needed - good_apples result = int(apples_to_buy + 0.5) return result
Possible new questions and programs: Bella has 24 stickers. She used a quarter of the stickers to decorate her notebook, and she gave away two thirds of the remaining stickers to her friends. How many stickers does she have left?
def solve() -> int: stickers = 24 used = stickers // 4 given = (stickers - used) * 2 // 3 left = stickers - used - given result = left return result
A car traveled a distance of 180 kilometers in 3 hours and 20 minutes. What was the average speed of the car in kilometers per hour?
def solve() -> int: distance = 180 time_in_hours = 3 + 20/60 average_speed = distance/time_in_hours result = average_speed return result
Tom hit 2 golf balls in the first minute, but missed 7 balls in the next 10 minutes while practicing, still with 9 balls left. How many balls did he hit in total after finishing practicing?
def solve() -> int: balls_hit_first_minute = 2 balls_left_after_first_minute = 9 balls_missed_in_next_10_minutes = 7 total_balls_hit = balls_hit_first_minute + (balls_left_after_first_minute + balls_missed_in_next_10_minutes) result = total_balls_hit return result
4. Kevin skates in the morning 4 days a week, and 2 days in the evening. He skates in the morning 2 hours and for 1 hour in the evening. How many hours does he skate in a month?
def solve() -> int: total_hours = 0 for week in range(1, 5): for morning in range(1, 5): total_hours += 2 for evening in range(1, 3): total_hours += 1 result = total_hours return result
Mia had 28 pencils. She bought 8 more pencils and received 6 pencils as a reward from her teacher. Mia gave 5 pencils to her brother and 2 pencils to her cousin. How many pencils does Mia have left?
def solve() -> int: pencils = 28 bought_pencils = 8 reward_pencils = 6 given_to_brother = 5 given_to_cousin = 2 total_pencils = pencils + bought_pencils + reward_pencils remaining_pencils = total_pencils - given_to_brother - given_to_cousin result = remaining_pencils return...
A coffee shop has 3 sizes of coffee: small for $2, medium for $3, and large for $4. If Bob bought 2 small coffees, 3 medium coffees, and 1 large coffee, what was his total cost?
def solve() -> int: num_small = 2 num_medium = 3 num_large = 1 small_cost = num_small*2 medium_cost = num_medium*3 large_cost = num_large*4 total_cost = small_cost + medium_cost + large_cost result = total_cost return result
Student: The peaches cost $12 per box plus $3.25 shipping fee. How much is 8 boxes of peaches plus shipping cost?
def solve() -> int: peach_cost = 12 shipping_fee = 3.25 num_boxes = 8 total_peach_cost = peach_cost * num_boxes total_shipping_cost = shipping_fee * num_boxes total_cost = total_peach_cost + total_shipping_cost result = total_cost return result
On Monday, Mike has 100 stickers. On Tuesday, he gives 1/4 of his current amount away and trades his remaining stickers for toys. He receives 3 toys for every 5 stickers. How many toys does he receive?
def solve() -> int: stickers = 100 stickers = stickers / 4 * 3 toys = stickers / 5 * 3 result = toys return result
If there are 5 packs of gum, each with 7 pieces of gum inside, how many pieces of gum are there altogether?
def solve() -> int: packs_of_gum = 5 pieces_of_gum_per_pack = 7 total_pieces_of_gum = packs_of_gum * pieces_of_gum_per_pack result = total_pieces_of_gum return result
A book has 300 pages. If Karen reads 50 pages per day, how many days will it take her to finish the book?
def solve() -> int: num_pages = 300 pages_per_day = 50 num_days = num_pages / pages_per_day result = num_days return result
Jane went shopping and spent $40 on 8 items. If all the items cost the same amount, how much did each item cost?
def solve() -> int: items = 8 total_cost = 40 cost_per_item = total_cost / items result = cost_per_item return result
Peter bought a box of 12 donuts to share with his friends. If there are 6 of his friends, how many donuts can each person have?
def solve() -> int: num_donuts = 12 num_friends = 6 donuts_per_person = num_donuts / num_friends result = donuts_per_person return result
If a recipe calls for 4 cups of flour and one cup has 128 tablespoons, how many tablespoons of flour are needed?
def solve() -> int: cups = 4 tablespoons_per_cup = 128 total = cups * tablespoons_per_cup result = total return result
Kyle is stacking blocks in a pyramid shape. The bottom row has 10 blocks, and each higher row has one less block than the row below it. How many blocks does he use in total to make the pyramid?
def solve() -> int: blocks = 0 row = 10 while row > 0: blocks = blocks + row row = row - 1 result = blocks return result
Ms. Nina runs a bakery that sells cakes, pies and cookies. She makes 3 times as many cookies as pies, and 4 times as many pies as cakes. If she made 20 cakes and sold each item for $10, how much money did she make in a day?
def solve() -> int: cakes = 20 pies = 4 * cakes cookies = 3 * pies total_items = cakes + pies + cookies total_money = total_items * 10 result = total_money return result
Every week, Olivia bakes cookies for her family. Last week, she baked 20 cookies. For the next three days, she baked a total of 12 cookies. On Friday, she baked 50 cookies but gave 15 to her friend. How many cookies does Olivia have after Friday?
def solve() -> int: cookies_last_week = 20 cookies_next_three_days = 12 cookies_friday = 50 cookies_given_friday = 15 total_cookies_baked = cookies_last_week + cookies_next_three_days + cookies_friday - cookies_given_friday result = total_cookies_baked return re...
Ava and Lily are baking cookies. Ava can bake a tray of cookies in 10 minutes, while Lily bakes half a tray in 5 minutes before running out of ingredients. If Lily had baked at the same pace, what would have been the average time needed for the two to bake a full tray of cookies?
def solve() -> int: ava_time = 10 lily_time = 5 lily_cookies = 0.5 lily_cookies_per_minute = lily_cookies / lily_time ava_cookies_per_minute = 1 / ava_time total_cookies_per_minute = lily_cookies_per_minute + ava_cookies_per_minute average_time = 1 / total_cookies_per_minute ...
Jenny bought 8 packs of gum, each pack contains 12 gums and each gum is sold for $0.25. If she only chewed 3/4 of the total gum she bought and threw away the rest, how much did Jenny spend on the gums?
def solve() -> int: packs_of_gum = 8 gums_per_pack = 12 price_per_gum = 0.25 total_gums = packs_of_gum * gums_per_pack chewed_gums = total_gums * (3/4) cost = chewed_gums * price_per_gum result = cost return result
John took out $15000 in student loans from his bank at an interest rate of 5% per annum. The loans accumulate interest daily. If John paid $1000 per month, how many months will it take him to pay off the loan, assuming no additional interest is incurred?
def solve() -> int: days_in_year = 365 interest_rate = 0.05 loan_amount = 15000 daily_interest_rate = interest_rate / days_in_year remaining_amount = loan_amount months = 0 while remaining_amount > 0: remaining_amount += remaining_amount * daily_interest_rate remaining_amount...