question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A box of chocolates contains 24 pieces. If you eat 1/3 of the box, how many chocolates are left?
def solve() -> int: box_size = 24 eaten = box_size / 3 left = box_size - eaten result = left return result
Leo is saving money for a new bike that costs $300. He earns $10 for each hour of chores he does and $15 for each hour of tutoring he does. He spends $5 every week on snacks and $20 every month on books. How many hours of chores and tutoring does he need to do in two months to buy the bike?
def solve() -> int: bike = 300 chores = 10 tutoring = 15 snacks = 5 books = 20 expenses = snacks * 8 + books * 2 net = bike - expenses hours_per_week = net / (chores + tutoring) / 8 hours_chores = hours_per_week * chores hours_tutoring = hours_per_week * tutoring ...
If a car travels 100 miles in 2 hours and 30 minutes, what is its average speed in miles per hour?
def solve() -> int: time = 2.5 distance = 100 speed = distance/time result = speed return result
Mark has $1.60 in nickels and dimes. He has twice as many dimes as nickels. How many of each coin does Mark have?
def solve() -> int: total = 160 dimes = 0 while total >= 10: dimes += 1 total -= 10 nickels = dimes * 2 result = (nickels, dimes) return result
Student: Anna read a total of 30 books in a year. She read 6 more books than Dave and 12 less books than Charles. How many books did Charles read that year?
def solve() -> int: anna = 30 dave = anna - 6 charles = anna + 12 result = charles return result
Nadar's car can drive 50 miles for every 2 gallons of gas. How many gallons of gas does Nadar's car need to drive 420 miles?
def solve() -> int: distance_driven = 420 miles_per_gallon = 50 / 2 total_gallons_needed = distance_driven / miles_per_gallon result = total_gallons_needed return result
Student: In 11 years, Wendy will be four times as old as George is now. Claire is currently 6 years younger than three times of George's current age. Claire is currently 4 years older than Nick is now. If Nick is currently 8 years old, how old will Wendy be in 11 years?
def solve() -> int: wendy_age = 0 george_age = 0 claire_age = 0 nick_age = 8 george_age = nick_age + 4 claire_age = 3 * george_age - 6 wendy_age = george_age + 11 * 4 result = wendy_age return result
A store sold 240 t-shirts yesterday. If 75% of the t-shirts were sold at the original price of $15 and the remaining t-shirts were sold at a discounted price of $12, what is the total revenue of the store yesterday?
def solve() -> int: total_tshirts = 240 original_price_tshirts = total_tshirts * 0.75 discounted_price_tshirts = total_tshirts - original_price_tshirts original_price_revenue = original_price_tshirts * 15 discounted_price_revenue = discounted_price_tshirts * 12 total_revenue = original_price_rev...
Lucio works as a waiter and he earns $8 per hour plus 10% of the total bill as tips. He works 6 hours on weekdays and 8 hours on weekends. On average, he serves $300 worth of food per hour on weekdays and $400 worth of food per hour on weekends. How much does he earn in a week?
def solve() -> int: hourly_wage = 8 tip_rate = 0.1 weekday_hours = 6 weekend_hours = 8 weekday_bill = 300 weekend_bill = 400 weekday_earnings = weekday_hours * (hourly_wage + tip_rate * weekday_bill) weekend_earnings = weekend_hours * (hourly_wage + tip_rate * weekend_bill) ...
If there are 12 people in a room and each person has 4 apples, how many apples are in the room total?
def solve() -> int: people = 12 apples_per_person = 4 result = people * apples_per_person return result
A bag of flour weighs 2.5 kilograms. If you use 700 grams of flour to bake a cake, how much flour is left in the bag?
def solve() -> int: remaining_flour = 2.5 - 0.7 result = remaining_flour return result
Ms. Jackson cleaned 4 rooms yesterday. Today, she cleaned one more than yesterday. How many rooms did Ms. Jackson clean today?
def solve() -> int: yesterday_rooms = 4 today_rooms = yesterday_rooms + 1 result = today_rooms return result
John collects 10 seashells on the beach. If he divides them equally between his 2 cousins, how many seashells will each cousin get?
def solve() -> int: seashells = 10 cousins = 2 seashells_per_cousin = seashells / cousins result = seashells_per_cousin return result
Charlotte wants to buy a dress that costs 4 shillings and has 7 farthings. She has 11 shillings, how much change should she get?
def solve() -> int: total_cost = 4 cost_in_farthings = 7 money_available = 11 cost_in_shillings = total_cost + (cost_in_farthings/6) amount_to_change = money_available - cost_in_shillings result = amount_to_change return result
Josie's tuition for one semester is $2,850. She pays 75% at the start of the semester and the remaining 25% at the end. How much would she need for the end of the semester?
def solve() -> int: initial_tuition = 2850 insurance = 0.75 remaining_tuition = initial_tuition * (1-insurance) result = remaining_tuition return result
Katie has a garden with an area of 50 square meters. She can plant 5 flowers per square meter. How many flowers can she plant in total in the garden?
def solve() -> int: area_of_garden = 50 flowers_per_square_meter = 5 amount_of_flowers = area_of_garden * flowers_per_square_meter result = amount_of_flowers return result
3 components of a rectangle are given; the length, width and area. Find the fourth missing component.
def solve() -> int: length = 0 width = 0 area = 0 perimeter = 2*(length + width) result = perimeter return result
Anthony has 24 sports hats and 35 t-shirts. He sells 12 hats and 4 t-shirts. Afterwards, he buys 7 hats and 10 t-shirts. How many of each does he have now?
def solve() -> int: tot_hats = 24 tot_tshirts = 35 sold_hats = 12 sold_tshirts = 4 bought_hats = 7 bought_tshirts = 10 hats = tot_hats - sold_hats + bought_hats tshirts = tot_tshirts - sold_tshirts + bought_tshirts result =...
Allen can make a batch of 36 cookies in 5 minutes. How many batches can he make in an hour assuming he works nonstop without breaks?
def solve() -> int: cookies_per_min = 36/5 minutes_in_hr = 60 batches_per_min = cookies_per_min/36 batches_in_hr = batches_per_min * minutes_in_hr result = batches_in_hr return result
Maria runs a bakery. She sold 68 cakes on Monday, 53 cakes on Tuesday, and 73 cakes on Wednesday. What is the average number of cakes sold per day?
def solve() -> int: total_cakes = 68 + 53 + 73 num_of_days = 3 avg_cakes_sold_per_day = total_cakes / num_of_days result = avg_cakes_sold_per_day return result
If there are 120 socks and they need to be divided among 10 people, how many socks will each person get?
def solve() -> int: socks = 120 people = 10 socks_per_person = socks / people result = socks_per_person return result
Tyler is saving his money to buy a video game that costs $60. His weekly allowance is $10. He can also earn $20 by washing cars for his neighbors. If he has already saved up $25, how much longer does he need to save to afford the video game?
def solve() -> int: game_cost = 60 allowance = 10 car_washing_pay = 20 saved_up = 25 money_needed = game_cost - saved_up extra_money_per_week = allowance + car_washing_pay weeks_needed = money_needed // extra_money_per_week + 1 result = weeks_needed return result
Gillian and Lillian both work at a library and each earn $15 per hour. Gillian worked 15 hours fewer than Lillian in a particular month. Calculate the difference in their incomes that month.
def solve() -> int: Gillian_income = 15 * 15 Lillian_income = (15 * 15) + (15 * 15) diff_income = Lillian_income - Gillian_income result = diff_income return result
Lily and her friend are having a balloon race. The winner is whoever keeps their balloon in the air for the longest time. Lily's balloon stays up for 30 seconds, while her friend's balloon stays up for 35 seconds. How much longer does the winner's balloon stay afloat?
def solve() -> int: lily_balloon_time = 30 friend_balloon_time = 35 winner_time_difference = friend_balloon_time - lily_balloon_time result = winner_time_difference return result
Student: A bakery sells 120 cupcakes each day of the week. On the weekends they sell twice as many. How many cupcakes do they sell in a week?
def solve() -> int: weekday_cupcakes = 120 weekend_cupcakes = 2 * weekday_cupcakes monday_cupcakes = weekday_cupcakes tuesday_cupcakes = weekday_cupcakes wednesday_cupcakes = weekday_cupcakes thursday_cupcakes = weekday_cupcakes friday_cupcakes = weekday_cupcakes saturday_cupcakes = week...
Michael's running time in the last marathon was not his personal best. To motivate him, Michael's coach promised him $9 for every mile he runs under 6 minutes and $18 for every mile he runs under 5 minutesThe combined weight of three sacks of potatoes owned by Alice, Bob, and Charlie is 36 kg. If Alice's sack weighs ha...
def solve() -> int: alice_sack_weight = 4 bob_charlie_sack_weight = 2 * alice_sack_weight combined_weight = alice_sack_weight + bob_charlie_sack_weight charlie_sack_weight = combined_weight - alice_sack_weight result = charlie_sack_weight return result
Student: The perimeter of a square is 36 centimeters. What is the length of one side of the square?
def solve() -> int: perimeter = 36 side_length = perimeter / 4 result = side_length return result
Parker wants to buy a scooter that costs $400. So far, they have saved $120. If they save $20 a week, how many weeks will it take Parker to save enough money for the scooter?
def solve() -> int: cost_of_scooter = 400 initial_savings = 120 weekly_savings = 20 savings_needed = cost_of_scooter - initial_savings weeks_to_save = savings_needed / weekly_savings result = weeks_to_save return result
Possible questions and programs are: There were 560 students in the school choir. Of those, 60% were girls. Of the girls, one fifth sang soprano. How many of the girl students sang a different voice part?
def solve() -> int: girls = 0.6 * 560 soprano = 0.2 * girls different = girls - soprano result = different return result
A student's goal is to read 800 pages in a month. On the first day, he reads 50 pages, and on the second day, he reads half this amount. How many more pages does he need to read to reach his goal?
def solve() -> int: goal = 800 first_day = 50 second_day = first_day / 2 total_pages_read = first_day + second_day pages_remaining = goal - total_pages_read result = pages_remaining return result
At the fair, there were 36 cotton candy sticks. Julie and Bob each wanted to get the same amount of cotton candy. If Julie gets 3/4 of the cotton candy, how many sticks of cotton candy will Bob get?
def solve() -> int: sticks = 36 julie_candy = 3/4 bob_candy = ( sticks ) - ( julie_candy*sticks ) result = bob_candy return result
In a competition, athletes receive 5 points for every successful attempt. After completing 10 rounds, the winner gets 30 bonus points. A day later, the organizers find out that there was some cheating. If the winner initially had 100 points, how many does he have now?
def solve() -> int: rounds = 10 points_per_round = 5 bonus_points = 30 initial_points = 100 total_points = rounds * points_per_round + bonus_points result = initial_points + total_points return result
Alex bought 3 markers. The first cost $2.50, the second cost $1.50 and the third cost $7.00. What was the average cost of each marker?
def solve() -> int: marker1 = 2.50 marker2 = 1.50 marker3 = 7.00 total = marker1 + marker2 + marker3 average = total / 3 result = average return result
A fruit market sells apples for $0.50 each and oranges for $0.80 each. If a customer buys 5 apples and 3 oranges, how much do they have to pay?
def solve() -> int: total_cost = 5 * 0.50 + 3 * 0.80 result = total_cost return result
Student: Kevin wants to buy posters for himself and his 13 friends. Each poster costs $13 and Kevin earns $5 an hour. How many hours will Kevin need to work to afford the posters?
def solve() -> int: cost_per_poster = 13 kevins_hourly_wage = 5 number_of_posters = 14 total_cost = cost_per_poster * number_of_posters hours_needed = total_cost / kevins_hourly_wage result = hours_needed return result
If the area of a rectangle is 24 square meters and the length of the rectangle is twice its width, what is the length of the rectangle?
def solve() -> int: area = 24 width = 3 length = 2 * width result = length return result
Tom has 22 balloons for his birthday party. He gave away 4 balloons each to his guests, until he only had 2 balloons left. How many guests attended Tom's party?
def solve() -> int: balloons = 22 balloons_left = 2 balloons_given = balloons - balloons_left guests = balloons_given // 4 result = guests return result
A book has 300 pages. If you want to read 40% of the book. How many pages will you read?
def solve() -> int: total_pages = 300 percentage_of_book_to_read = 0.4 pages_to_read = total_pages * percentage_of_book_to_read result = pages_to_read return result
A student is going on a road trip and needs to refill the gas tank. The gas tank can hold 12 gallons of gas and the gas station charges $3 per gallon. If the student has $40, how many gallons of gas can the student buy?
def solve() -> int: gas_capacity = 12 gas_price = 3 total_money = 40 gallons_available = total_money // gas_price gallons_to_buy = min(gallons_available, gas_capacity) result = gallons_to_buy return result
Olivia and her friend Ethan decided to start a shoe collection. Olivia has 35 shoes, 3/7 of which are boots. Ethan has two-fifths as many boots as Olivia and 8 more sneakers than Olivia. How many shoes in total do the two have?
def solve() -> int: olivia_shoes = 35 ethan_boots = (2/5) * (3/7) * olivia_shoes ethan_sneakers = olivia_shoes + 8 total_shoes = olivia_shoes + ethan_boots + ethan_sneakers result = total_shoes return result
A bookshelf has a height of 60 inches and 4 shelves. If each shelf has the same height, what is the height of each shelf?
def solve() -> int: shelf_height = 60 / 4 result = round(shelf_height,2) return result
In a certain park, Julia's binoculars can see up to a distance of 200 meters. Brian's binoculars can see up to four times farther than Julia's. Emma's binoculars can see up to a distance that is 1000 meters less than twice as far as Brian's binoculars. If Julia and Emma are standing next to each other and using their b...
def solve() -> int: julia_distance = 200 brian_distance = 4 * julia_distance emma_distance = 2 * brian_distance - 1000 difference = emma_distance - julia_distance result = difference return result
A car travels 180 miles on 9 gallons of gas. If the car's gas tank can hold 15 gallons of gas, how far can the car travel on one tank of gas?
def solve() -> int: miles_per_gallon = 180 / 9 distance_on_full_tank = miles_per_gallon * 15 result = distance_on_full_tank return result
Alice has 20 apples and she gives 3 apples to each of her friends. She has 5 friends in total. How many apples does Alice have left and what is the average number of apples per person (including Alice and her friends)?
def solve() -> int: apples = 20 friends = 5 given = 3 alice = apples - friends * given average = apples / (friends + 1) result = alice + average return result
A room is 16 feet long, 12 feet wide, and 8 feet high. What is the volume of the room in cubic feet?
def solve() -> int: length = 16 width = 12 height = 8 volume = length * width * height result = volume return result
Lily is baking a cake that requires 3 eggs, 2 cups of flour, 1 cup of sugar, and 0.5 cups of butter. She has 10 eggs, 8 cups of flour, 6 cups of sugar, and 2 cups of butter. How many cakes can she bake with the ingredients that she has?
def solve() -> int: cakes_with_eggs = int(10 / 3) cakes_with_flour = int(8 / 2) cakes_with_sugar = int(6 / 1) cakes_with_butter = int(2 / 0.5) cakes_with_ingredients = min(cakes_with_eggs, cakes_with_flour, cakes_with_sugar, cakes_with_butter) result = cakes_with_ingredients return result
Maria is three times older than Teresa. In 2 years, Maria will be twice as old as Teresa. How old is Teresa now?
def solve() -> int: teresa_age = 2 result = teresa_age return result
Lisa went to the pet store to buy food for her dogs. She bought a 50-pound bag of dog food for $30, 10 cans of dog snacks for $2 each, and a bag of dog treats, which was four times more expensive than one can of dog snack. How much did Lisa pay for her dog food shopping?
def solve() -> int: dog_food_weight = 50 dog_food_price = 30 dog_snack_quantity = 10 dog_snack_price = 2 dog_treat_price = 4 * dog_snack_price total_dog_food_cost = dog_food_price + (dog_snack_quantity * dog_snack_price) + dog_treat_price result = total_dog_food_cost retur...
Student: Millie went shopping and bought one book for $15, four coloring books at $2 each, and three coloring pens at $3 each. How much did Millie spend in total?
def solve() -> int: book_price = 15 coloring_book_price = 2 coloring_pen_price = 3 total_cost = book_price + (4 * coloring_book_price) + (3 * coloring_pen_price) result = total_cost return result
Lisa has $75 in her wallet. She spent $20 on food and then spent another 40% of her remaining money on a new dress. How much money does she have left?
def solve() -> int: wallet = 75 food = 20 leftover = wallet - food dress = leftover * 0.4 balance = leftover - dress result = balance return result
Tom reads 6 45-page chapters and one 20-page appendix. How many pages did he read in total?
def solve() -> int: num_chapters = 6 chapter_pages = 45 appendix_pages = 20 total_chapter_pages = num_chapters * chapter_pages total_pages = total_chapter_pages + appendix_pages result = total_pages return result
Monica is buying ingredients to make spaghetti sauce. She needs 2 cans of tomatoes, 1/2 lb of ground beef, 1 green bell pepper, and 3 cloves of garlic. If a can of tomatoes has 14 oz, how many ounces of ingredients does Monica need in total?
def solve() -> int: tomatoes_oz = 2 * 14 beef_oz = 0.5 * 16 pepper_oz = 1 * 6.4 garlic_oz = 3 * 0.25 total_oz = tomatoes_oz + beef_oz + pepper_oz + garlic_oz result = f'Monica needs {total_oz} ounces of ingredients in total' result = total_oz return result
If the perimeter of a square is 20 cm, what is the length of one side?
def solve() -> int: side_length = 20 / 4 result = side_length return result
Pamela needs to buy a lot of furniture to redecorate her room. She decides she wants to buy 3 chairs, 2 couches, and 1 table. The chairs are $50 each, the couches are $250 each, and the table is $500. How much money does Pamela need in total?
def solve() -> int: price_chair = 50 price_couch = 250 price_table = 500 num_chairs = 3 num_couches = 2 num_tables = 1 total = (price_chair * num_chairs) + (price_couch * num_couches) + (price_table * num_tables) result = total return result
Student: Eric has 5 books and 4 notebooks. He gives away 2 of each. How many items does he have left?
def solve() -> int: books = 5 notebooks = 4 books_given = 2 notebooks_given = 2 books_left = books - books_given notebooks_left = notebooks - notebooks_given total_items_left = books_left + notebooks_left result = total_items_left return result
Nancy was making dinner and bought 3.5kg of potatoes. She already used 500g and needs to figure out how many kg remains.
def solve() -> int: total = 3.5 consumed = 0.5 remaining = total - consumed result = remaining return result
Lisa collects stamps. She has 80 stamps in her album. She buys 12 more stamps and gives 6 stamps to her friend. How many stamps does she have left in her album?
def solve() -> int: stamps_after_buying = 80 + 12 stamps_after_giving = stamps_after_buying - 6 result = stamps_after_giving return result
A painter has 36 liters of paint. On Monday, he uses 4 liters of paint to paint a wall. On Tuesday, he uses a quarter of the paint he used on Monday to paint a door. On Wednesday, he buys 8 liters of paint to finish his job. How many liters of paint does the painter have left at the end of Wednesday?
def solve() -> int: paint = 36 paint_used_monday = 4 paint_left_monday = paint - paint_used_monday paint_used_tuesday = paint_used_monday / 4 paint_left_tuesday = paint_left_monday - paint_used_tuesday paint_bought_wednesday = 8 paint_left_end_wednesday = paint_left_tuesday + paint_bought_we...
The recipe for a cake requires 2 cups of flour, 1 cup of sugar, 1/2 cup of butter, and 3 eggs. If Mrs. Johnson wants to make 2 cakes, how much of each ingredient will she need?
def solve() -> int: flour = 2 sugar = 1 butter = 0.5 eggs = 3 num_cakes = 2 total_flour = flour * num_cakes total_sugar = sugar * num_cakes total_butter = butter * num_cakes total_eggs = eggs * num_cakes result = (total_flour, total_sugar, total_butter, total_eggs) return res...
Maria has a collection of 90 stamps. She is giving away 2/5 of the stamps to her friend Andres. Then she loses 1/3 of the remaining stamps. How many stamps does she have left?
def solve() -> int: stamps = 90 given_away = stamps * 2 / 5 remaining = stamps - given_away lost = remaining / 3 result = remaining - lost return result
Monica is throwing a dinner party for 10 people. She plans on cooking chicken at $4.00 per pound and vegetables at $2.00 per pound. If she wants to cook 3 pounds of chicken and 5 pounds of vegetables, what will be the total cost of her groceries?
def solve() -> int: chicken_cost = 4 * 3 vegetable_cost = 2 * 5 total_cost = chicken_cost + vegetable_cost result = total_cost return result
Susan has 500 dollars and wants to buy a new phone for 350 dollars. She decides to save 25% of the remaining money to buy a phone case. How much money will she have left after buying the phone and the case?
def solve() -> int: amount_of_phone_purchase = 350 remaining_money = 500 - amount_of_phone_purchase amount_of_money_saved_for_case = 0.25 * remaining_money money_left_after_case_purchase = remaining_money - amount_of_money_saved_for_case result = money_left_after_case_purchase return result
A company produces 2000 toys every month. They increase their production by 10% each month for 4 months, but then they have to reduce it by 20% due to lack of storage space. How many toys will be produced in total after 6 months?
def solve() -> int: monthly_production = 2000 growth_rate = 0.1 decline_rate = 0.2 growth_period = 4 time_in_months = 6 total_production = 0 for i in range(growth_period): total_production += monthly_production*(1 + growth_rate)**i total_production += monthly_production*(1 + grow...
Possible questions and programs are: Lisa is making bracelets with beads. She needs 8 beads for each bracelet, and she has 5 different colors of beads. She wants to make as many bracelets as possible with each color. How many bracelets can she make in total if she has 240 beads?
def solve() -> int: beads_per_color = 240 // 5 bracelets_per_color = beads_per_color // 8 total_bracelets = bracelets_per_color * 5 result = total_bracelets return result
Paul is responsible for running the grocery store for his family. After taking inventory, he noticed that he had $24 worth of apples, $18 worth of bananas, and $32 worth of oranges. If an apple costs $0.75, a banana costs $0.60, and an orange costs $1.20, how many of each type of fruit did Paul have?
def solve() -> int: total_apples = 24 total_bananas = 18 total_oranges = 32 cost_apple = 0.75 cost_banana = 0.60 cost_orange = 1.20 num_apples = total_apples / cost_apple num_bananas = total_bananas / cost_banana num_oranges = total_oranges / cost_orange result = (...
You have a rectangular garden that measures 6 feet by 8 feet. If you want to add a flower bed that is 2 feet wide along the perimeter of the garden, how much area will the flower bed cover?
def solve() -> int: width = 6 length = 8 flower_bed_width = 2 flower_bed_area = (width+(2*flower_bed_width)) * (length+(2*flower_bed_width)) - (width*length) result = flower_bed_area return result
If Ann has 20 stamps and trades all of them for matches, how many matchbooks does she get?
def solve() -> int: number_of_stamps = 20 matches_in_matchbook = 24 matches_in_stamp = 12 total_matches = number_of_stamps * matches_in_stamp number_of_matchbooks = total_matches / matches_in_matchbook result = number_of_matchbooks return result
Karen worked from the 2nd to the 7th for 9 hours a day, but didn't work on the 5th. How many hours did Karen work in total?
def solve() -> int: second_day = 9 third_day = 9 fourth_day = 9 fifth_day = 0 sixth_day = 9 seventh_day = 9 total_hours_worked = second_day + third_day + fourth_day + fifth_day + sixth_day + seventh_day result = total_hours_worked return result
Student: Bob is renting a car for a road trip. The rental company charges $20 per day plus $0.25 per mile. Bob also needs to pay for gas, which costs $2.50 per gallon. The car has a fuel efficiency of 30 miles per gallon. Bob plans to drive 200 miles per day for five days. How much will Bob spend for the car rental and...
def solve() -> int: daily_rental_fee = 20 mile_fee = 0.25 gas_price = 2.50 fuel_efficiency = 30 miles_per_day = 200 days = 5 total_rental_fee = daily_rental_fee * days total_gas_fee = (miles_per_day * days) / fuel_efficiency * gas_price total_fee = total_rental_fee + total_gas_fee ...
John has 200 books. He gave 25% of them to his friend and the rest to the library. How many books did he give to the library?
def solve() -> int: books = 200 given_to_friend = books * 25/100 books -= given_to_friend result = books return result
Jane has $50 and she earns $10 every week. If she spends $8 every week for lunch, how much money will she have after 6 weeks?
def solve() -> int: week_income = 10 week_spending = 8 total_weeks = 6 initial_savings = 50 total_income = week_income * total_weeks total_spending = week_spending * total_weeks final_savings = initial_savings + total_income - total_spending result = final_savings return result
A car traveled 300 miles in 5 hours. If the speed decreases by 10 mph, how long would it take for the car to travel the same distance?
def solve() -> int: distance = 300 time = 5 speed_initial = distance / time speed_final = speed_initial - 10 time_final = distance / speed_final result = time_final return result
A student scored 80, 85, 90, and 95 on four tests. What is the average score?
def solve() -> int: test_scores = [80, 85, 90, 95] total_score = sum(test_scores) num_tests = len(test_scores) average_score = total_score / num_tests result = average_score return result
A car rental company charges $40 per day for the first 5 days. They offer 20% off for any additional day. How much does it cost to rent a car for 8 days?
def solve() -> int: base_price = 40 num_days = 8 if num_days <= 5: cost = base_price * num_days else: cost = base_price * 5 + (num_days-5) * 0.8 * base_price result = cost return result
John buys 200 shares of stock A for $5 each and 300 shares of stock B for $7 each. He sells all of his shares for a profit of $500. What was his selling price per share?
def solve() -> int: cost = 200*5 + 300*7 profit_per_share = 500 / (200+300) selling_price_per_share = cost / (200+300) + profit_per_share result = selling_price_per_share return result
A car travels 58 miles per hour and needs to travel 283 miles to reach its destination. How long will it take for the car to arrive at its destination?
def solve() -> int: time_to_travel = 283 / 58 result = time_to_travel return result
Isabel got 168 birthday cards. She gave away two-sevenths to her cousins. Her cousins then gave her 20 cards. If Isabel has 140 cards left, how many cards did she give away?
def solve() -> int: total_cards = 168 given_away = total_cards * (2/7) cousins_returned = 20 remaining_cards = 140 cards_given_away = given_away - cousins_returned - remaining_cards result = cards_given_away return result
It takes Joe 20 minutes to drive to work if he drives at 30 mph. How long will it take Joe to drive to work if he drives at 40 mph?
def solve() -> int: speed_1 = 30 time_1 = 20 speed_2 = 40 time_2 = time_1 * (speed_1/speed_2) result = 15 return result
A backyard farmer has a rectangular garden that measures 12 meters by 15 meters. They want to fence the entire garden perimeter with chicken wire. How many meters of chicken wire will they need?
def solve() -> int: width = 12 length = 15 perimeter = 2 * (width + length) result = perimeter return result
There are two containers A and B. Container A has 5 liters of water and container B has 8 liters of water. Three liters of water were poured from container B into container A. Then, 2 liters of water were poured from container A into container B. What is the ratio of the number of liters of water in container A to that...
def solve() -> int: a = 5+2-3 b = 8-3+2 result = a/b return result
Ms. Johnson has 60 pencils and gives each of her 18 students 2 pencils each. How many pencils does she have left?
def solve() -> int: n_students = 18 n_pencils_per_student = 2 n_pencils = n_students * n_pencils_per_student n_pencils_left = 60 - n_pencils result = n_pencils_left return result
Rachel has tricked her brother into cleaning her 50-foot long boat. Her brother, Jake, cleaned 15 feet of the boat. Rachel cleaned one-third of what was left after Jake's cleaning. How much of the boat still needs to be cleaned?
def solve() -> int: total_length = 50 jake_cleaned = 15 remaining_length = total_length - jake_cleaned rachel_cleaned = remaining_length / 3 still_to_clean = remaining_length - rachel_cleaned result = still_to_clean return result
A train travels at 60 mph and has to travel 240 miles. How long will it take the train to reach its destination?
def solve() -> int: distance = 240 speed = 60 time = distance / speed result = time return result
Zeno's family needs to buy a 2-liter bottle of soda to provide enough drinks for 12 people. How many liters of soda does each person get?
def solve() -> int: total_liter = 2 people = 12 per_person = total_liter / people result = per_person return result
Peter bought 10 packs of pencils, each containing 12 pencils. He used 15 pencils himself. If he gave 4 pencils to each of his 23 classmates, how many pencils are left in the packs?
def solve() -> int: packs = 10 pencils_in_pack = 12 total_pencils = packs * pencils_in_pack pencils_used = 15 pencils_given_away = 4 * 23 pencils_left = total_pencils - pencils_used - pencils_given_away result = pencils_left return result
Tanya owns a jewelry store and charges $45 for a necklace, $18 for a pair of earrings, and $32 for a bracelet. Over the weekend, she sold 9 necklaces, 13 earrings, and 8 bracelets. How much money did Tanya make in total?
def solve() -> int: total_necklaces = 9 * 45 total_earrings = 13 * 18 total_bracelets = 8 * 32 result = total_necklaces + total_earrings + total_bracelets return result
Student: A toy shop sells toy cars that come in boxes of 6. They plan on ordering 250 boxes for the holiday season. How many toy cars will the shop have?
def solve() -> int: num_boxes = 250 cars_per_box = 6 total_cars = num_boxes * cars_per_box result = total_cars return result
Aaron had $800. He spent a quarter of it at a bookstore. Brenda spent $100 less than four times Aaron's total. What is the total that Brenda spent at the bookstore?
def solve() -> int: aaron = 800 bookstore = 0.25 brenda = 4 difference = 100 aaron_after = aaron * (1 - bookstore) brenda_total = brenda * aaron_after - difference result = brenda_total return result
Student: An ice cream truck sells ice cream cones for 3 dollars each. If you have 15 dollars, how many ice cream cones can you buy?
def solve() -> int: price_per_cone = 3 total_money = 15 num_cones = total_money // price_per_cone result = num_cones return result
Student: A store sells apples for $0.50 and bananas for $0.70. If a customer purchases 10 fruits for $5.50, how many apples did they purchase?
def solve() -> int: apple_price = 0.50 banana_price = 0.70 total_price = 5.50 total_fruits = 10 total_price_apples = apple_price * total_fruits total_price_bananas = banana_price * total_fruits num_apples = (total_price - total_price_bananas) / apple_price result = num_apples return...
Nick is hired to paint a room that is 5m long, 3m wide, and 3m high. the paint costs $8 per m² and Nick charges $30 per hour. How much does the painting job cost?
def solve() -> int: area = 5 * 3 * 3 hours_worked = area / 1.5 rate_paid = 30 cost_paint = area * 8 total_cost = (hours_worked * rate_paid) + cost_paint result = total_cost return result
John wants to make sandwiches for his family's picnic. He plans on buying bread loaves that come in 1.5 pound sizes. He wants everyone to have half a pound of bread for their sandwich. If John invites 9 people, how many loaves of bread should he buy?
def solve() -> int: num_people = 9 bread_per_sandwich = 0.5 bread_per_loaf = 1.5 total_bread_needed = num_people * bread_per_sandwich loaves_needed = total_bread_needed / bread_per_loaf result = round(loaves_needed + 0.5) return result
In 7 years, Tom will be 5 times as old as Sarah. If Tom is currently 35 years old, how old is Sarah now?
def solve() -> int: tom_current_age = 35 tom_future_age = tom_current_age + 7 sarah_future_age = tom_future_age / 5 sarah_current_age = sarah_future_age - 7 result = sarah_current_age return result
In a class of 40 students, 25 like reading, 20 like writing, and 10 like both. What percentage of the class likes only reading or only writing?
def solve() -> int: num_likes_reading = 25 num_likes_writing = 20 num_likes_both = 10 num_likes_only_reading_or_writing = (num_likes_reading - num_likes_both) + (num_likes_writing - num_likes_both) percentage_likes_only_reading_or_writing = num_likes_only_reading_or_writing/40*100 result = perce...
Madison spent all her coupons at the grocery store. She spent one-fourth of them on a loaf of bread. She spent 3 coupons on a carton of eggs and 5 coupons on a jar of peanut butter. How many coupons did Madison spend in total? Samantha's three cats are triplets. They are 6 years old today. Two years from now, the sum o...
def solve() -> int: total_coupons = 0 bread_coupons = total_coupons / 4 eggs_coupons = 3 peanut_butter_coupons = 5 total_coupons = bread_coupons + eggs_coupons + peanut_butter_coupons cat_age = 6 samantha_age = (cat_age + 2) * 3 - 2 result = total_coupons, samantha_age ...
The temperature was 32°F at noon. If it decreased by 10 degrees by evening, what was the temperature by then?
def solve() -> int: initial_temperature = 32 decrease_in_temperature = 10 final_temperature = initial_temperature - decrease_in_temperature result = final_temperature return result
A recipe for chocolate cookies requires 200 g of flour, 100 g of sugar, 50 g of cocoa powder, and 100 g of butter. How many cookies can you make with 1 kg of flour, 500 g of sugar, 250 g of cocoa powder, and 500 g of butter, if each cookie weighs 25 g?
def solve() -> int: flour_per_cookie = 200 sugar_per_cookie = 100 cocoa_per_cookie = 50 butter_per_cookie = 100 cookie_weight = 25 flour_available = 1000 sugar_available = 500 cocoa_available = 250 butter_available = 500 cookies_with_flour = flour_available // flour...
Lily has $35 saved in her piggy bank. If she has 50 quarters and 25 dimes in her piggy bank, how much would she have in total?
def solve() -> int: quarters = 50 dimes = 25 total_quarters = quarters * 0.25 total_dimes = dimes * 0.1 total_money = total_quarters + total_dimes + 35 result = total_money return result
Possible math questions and programs are: If I share 3 apples with my sister, I will have twice as many apples as her, but my cousin will have five times as many as I do. The total number of apples we have together is 45. How many apples do I have?
def solve() -> int: x = 55.5 / 7 result = x - 1.5 return result
Anna and Bob play a game and each throw a six-sided dice. What is the probability that the sum of their two dice is 8?
def solve() -> int: prob = 0 for i in range(3,7): prob = prob + ((1/6) * (1/6)) result = 0.25 return result