question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Jen is suing the restaurant she works at claiming she tripped on a broken tile and injured her knee. She's asking for damages for loss of a $60,000 annual salary for 25 years, $100,000 in medical bills, and punitive damages equal to triple the medical and salary damages. If she gets 60% of what she's asking for, how mu...
def solve() -> int: annual_salary = 60000 years = 25 medical_bills = 100000 salary_damages = annual_salary * years punitive_damages = 3 * (salary_damages + medical_bills) total_damages = salary_damages + medical_bills + punitive_damages amount_received = 0.6 * total_damages ...
A toy store is having a sale where all toys are 40% off. A toy originally costs 35 dollars. How much will it cost during the sale?
def solve() -> int: original_price = 35 discount = 0.4 discounted_price = original_price * (1 - discount) result = discounted_price return result
15% of the books in a library are fiction. 10% are non-fiction. The rest are reference books. If there are 5000 books in the library, how many more reference books are there than fiction books?
def solve() -> int: fiction = 15 * 5000 / 100 non_fiction = 10 * 5000 / 100 reference = 5000 - (fiction + non_fiction) difference = reference - fiction difference = round(difference) result = difference return result
Sarah has 36 marbles. If she gives away 1/4 of her marbles, how many marbles does she have left?
def solve() -> int: marbles = 36 given_away = marbles/4 remaining_marbles = marbles - given_away result = remaining_marbles return result
Rob has $2.05 in his pocket. He buys a snack that costs $1.50. How much money does he have left?
def solve() -> int: original_money = 2.05 snack_price = 1.50 remaining_money = original_money - snack_price result = remaining_money return result
Jonah runs for 3 hours and burns 110 calories in total. How many calories did he burn per hour?
def solve() -> int: time = 3 total_calories_burned = 110 calories_per_hour = total_calories_burned/time result = calories_per_hour return result
Amy has 11 more lamps than one-third as many lamps as Joe. If Amy has 33 lamps, how many lamps does Joe have?
def solve() -> int: Amy_num = 33 Third_amy = Amy_num/3 Joe_num = Third_amy + 11 result = Joe_num return result
In a bakery, the price of cookies is $5 per dozen and the minimum spend is $20 before tax. The cookies are taxed at $0.50 per dozen. If Bob paid $110 for cookies, by how many dozens has Bob's purchase exceeded the minimum spend?
def solve() -> int: cookie_cost = 5 tax_per_dozen = 0.50 total_cost = 110 minimum_spend = 20 cost_before_tax = total_cost - tax_per_dozen * (total_cost / (cookie_cost + tax_per_dozen)) dozens_purchased = cost_before_tax / cookie_cost min_dozens_required = minimum_spend / cookie_cost ...
A basketball team sold 30 water bottles for $4 each and 50 sandwiches for $2 each, and then they used the money to buy 3 basketballs that cost $50 each and 8 caps that cost $15 each. How much money did the team have left?
def solve() -> int: water_cost = 4 sandwich_cost = 2 ball_cost = 50 cap_cost = 15 revenue = water_cost * 30 + sandwich_cost * 50 expenditures = ball_cost * 3 + cap_cost * 8 result = revenue - expenditures return result
Sophia and Isabella collected 150 seashells in total. Isabella collected 1/3 of the seashells that Sophia collected. How many seashells did Isabella collect? Sophie always takes the same route when she runs errands. First, she walks 2 blocks to the grocery store. Then she walks 5 blocks to the bank. Finally, she walks ...
def solve() -> int: sophia_seashells = 150 * 2 / 3 isabella_seashells = 150 - sophia_seashells total_blocks = (2 + 5 + 9) * 2 result = isabella_seashells + total_blocks return result
Student: A company has a profit of $250,000 for the year. If the revenues for the year were $1,000,000, what is the profit margin for the company?
def solve() -> int: revenue = 1000000 profit = 250000 profit_margin = profit / revenue result = profit_margin return result
Student: A school is organizing a field trip. Two buses are needed to transport all the students. Each bus can hold 40 students. If there are 75 students in total, how many students will be on the second bus?
def solve() -> int: total_students = 75 bus_capacity = 40 first_bus = bus_capacity second_bus = total_students - first_bus result = second_bus return result
Student: Carol wants to tile a kitchen wall that is 5 feet by 16 feet. If each tile is 2.5 feet by 1.25 feet, how many tiles will Carol need?
def solve() -> int: wall_length = 5 wall_width = 16 tile_length = 2.5 tile_width = 1.25 wall_area = wall_length * wall_width tile_area = tile_length * tile_width num_tiles = wall_area / tile_area result = num_tiles return result
heena was planning a road trip and the cost of gasoline was $0.98 per liter. Sheena filled up 20 liters of gasoline. Write an expression to calculate the cost of the gasoline.
def solve() -> int: cost_per_liter = 0.98 num_liters = 20 total_cost = cost_per_liter * num_liters result = total_cost return result
A room is in the shape of a rectangle. If its perimeter is 36 meters and its length is twice its width, what is the area of the room?
def solve() -> int: perimeter = 36 width = perimeter / 6 length = 2 * width area = length * width result = area return result
At a school, out of 400 students, 5% were absent on a test day while 12% scored higher than previous tests. How many students scored the same and were present at school?
def solve() -> int: total_students = 400 absent_students = total_students * 0.05 present_students = total_students - absent_students higher_score_students = total_students * 0.12 same_score_students = present_students - higher_score_students result = same_score_students return resu...
John had 36 toy cars. If his sister gave him half of her collection, how many toy cars does John have now?
def solve() -> int: john_cars = 36 sister_cars = john_cars / 2 total_cars = john_cars + sister_cars result = total_cars return result
John is trying to save money to buy a new computer. He sets aside $150 each month from his salary. The computer he wants to buy costs $1200. In how many months will John be able to save enough money to buy the computer?
def solve() -> int: savings_per_month = 150 target_savings = 1200 num_months = target_savings // savings_per_month result = num_months return result
Possible additional questions and programs are: Alice loves to collect stamps. She has a budget of $200 per month to buy new stamps for her collection. The average price of a stamp is $0.25, but some rare stamps can cost up to $10 each. Alice wants to buy at least one rare stamp every month, and as many regular stamps ...
def solve() -> int: budget = 200 average_price = 0.25 rare_price = 10 leftover = budget - rare_price regular_stamps = int(leftover / average_price) total_regular_stamps = regular_stamps * 12 result = total_regular_stamps return result
Student: A pool is being filled with water. The pool has a length of 20 meters, a width of 10 meters, and a depth of 2 meters. Water is being supplied through a hose that fills 2 gallons in 5 seconds. How long will it take to fill the pool with water?
def solve() -> int: length = 20 width = 10 depth = 2 volume = length * width * depth gallons_per_cubic_meter = 264.172 gallons = volume * gallons_per_cubic_meter gallons_per_second = 2 / 5 seconds = gallons / gallons_per_second result = seconds return result
If John has $25 more than half as much money as Mike and Mike has $100, how much money does John have?
def solve() -> int: mike = 100 john = (mike / 2) + 25 result = john return result
Daniel had $36. He spent $14. How much money does he have left?
def solve() -> int: daniel_total = 36 daniel_spent = 14 daniel_left = daniel_total - daniel_spent result = daniel_left return result
Two construction workers are racing to complete a building project. The first worker takes an average of 5 hours to complete each step, while the second worker takes an average of 4 hours per step. After completing the first step, the second worker takes a 45-minute break. For how many minutes can he stay on break befo...
def solve() -> int: first_worker_time_per_step = 5 * 60 second_worker_time_per_step = 4 * 60 second_worker_break_time = 45 catch_up_time = (second_worker_time_per_step * first_worker_time_per_step) / (second_worker_time_per_step - first_worker_time_per_step) break_time = catch_up_time ...
If the legal age for drinking is 21 and Emma is currently 14 years old, how many more years will she have to wait to legally consume alcohol?
def solve() -> int: legal_age = 21 emma_age = 14 years_to_wait = legal_age - emma_age result = years_to_wait return result
A car traveled at a constant speed of 40 km/h for 2 hours, then at a constant speed of 60 km/h for 1.5 hours. What was the average speed of the car for the whole journey?
def solve() -> int: distance_at_40 = 40 * 2 distance_at_60 = 60 * 1.5 total_distance = distance_at_40 + distance_at_60 time_at_40 = 2 time_at_60 = 1.5 total_time = time_at_40 + time_at_60 average_speed = total_distance / total_time result = average_speed return result
Student: Linnette has three times as many lollipops than Alex. If Alex has 12 lollipops, how many lollipops does Linnette have?
def solve() -> int: alex = 12 linnette = 3 * alex result = linnette return result
2. Cole has 36 marbles in his collection. He then wins six more marbles from a game. His brother Max, who has 60% as many marbles as Cole, plays with him and loses four marbles to Cole. How many marbles do Cole and Max have together after the game?
def solve() -> int: cole = 36 max = round(cole * 0.6) cole = cole + 6 + 4 max = max - 4 total = cole + max result = total return result
If a tree is well-taken-care of, it can live 30 years longer than the average lifespan of a cat. If cats usually live 12 times longer than a particular kind of bird, and the bird lives an average of two years, how long can the tree live?
def solve() -> int: bird_lifespan = 2 cat_lifespan = 12 * bird_lifespan tree_lifespan = cat_lifespan + 30 result = tree_lifespan return result
Alex has 100 video game cartridges. He wants to pack them into boxes, each box can fit 25 cartridges. How many boxes will Alex need?
def solve() -> int: num_cartridges = 100 cartridges_per_box = 25 num_boxes = num_cartridges / cartridges_per_box result = round(num_boxes) return result
An online movie rental store charges a $2.00 monthly fee plus $3.00 per movie. If a customer rents 3 movies this month, how much do they pay in total?
def solve() -> int: monthly_fee = 2 movie_rental_fee = 3 number_of_movies = 3 total = monthly_fee + (movie_rental_fee * number_of_movies) result = total return result
If 10 carpenters can build a house in 30 days, how many days will it take for 8 carpenters to build the same house?
def solve() -> int: num_carpenters1 = 10 days1 = 30 num_carpenters2 = 8 days2 = (num_carpenters1 * days1) / num_carpenters2 result = days2 return result
The sum of two numbers is 70. One number is 10 more than the other. What are the two numbers?
def solve() -> int: total_sum = 70 difference = 10 smaller_number = (total_sum - difference) / 2 larger_number = smaller_number + difference result = (smaller_number, larger_number) return result
A book costs 20 dollars. If the sales tax is 10%, how much will the customer pay after including the tax?
def solve() -> int: book_price = 20 tax_rate = 0.1 total_price = book_price + (book_price * tax_rate) result = total_price return result
The Knicks had 82 games this season. They lost 35% of the games, tied 10 of them, and won the rest. How many games did they win?
def solve() -> int: total_games = 82 lost_games = total_games * 0.35 tied_games = 10 won_games = total_games - lost_games - tied_games result = won_games return result
Student: A phone plan costs $20 per month plus 10 cents for each minute of phone calls. If you talk for 100 minutes in a month, how much will your bill be?
def solve() -> int: monthly_cost = 20 call_rate = 0.1 call_minutes = 100 call_cost = call_rate * call_minutes bill = monthly_cost + call_cost result = bill return result
At a local grocery store, green apples are being sold at a weight of $1.5 per kg and red apples are being sold at a weight of $2.2 per kg. John wants to buy a total of 5kg of apples for $8.5. How many kg of each type of apples should he buy?
def solve() -> int: green_apple_weight_price = 1.5 red_apple_weight_price = 2.2 total_weight = 5 total_price = 8.5 green_apple_weight = (total_price - (red_apple_weight_price * (total_weight // 2))) / green_apple_weight_price red_apple_weight = (total_weight - green_apple_weight) result...
Tim wants to know the area of his rectangular backyard. The length of the yard is 20 feet and the width is 15 feet. What is the area of his backyard in square feet?
def solve() -> int: area_of_backyard = 20*15 result = area_of_backyard return result
Emily spent $25 at a bookstore and then decided to buy a new laptop that costs five times the amount she spent on books. She also upgraded the memory and added a new hard drive, each costing twice the price of the laptop. If Emily had $800 left after all her purchases, how much money did she have before going to the bo...
def solve() -> int: bookstore_spending = 25 laptop_cost = 5 * bookstore_spending memory_cost = 2 * laptop_cost hard_drive_cost = 2 * laptop_cost total_spending = bookstore_spending + laptop_cost + memory_cost + hard_drive_cost money_before = total_spending + 800 result = money_before ...
If 8 mice nibble 32 pieces of cheese in 40 minutes, how many pieces of cheese will 5 mice nibble in 25 minutes?
def solve() -> int: rate = 32 / (8 * 40) cheese = rate * 5 * 25 result = round(cheese) return result
A rectangle has a length of 5 cm and a width of 7 cm. What is the perimeter of the rectangle?
def solve() -> int: length = 5 width = 7 perimeter = 2 * (length + width) result = perimeter return result
A recipe calls for 2/3 cups of flour. If Sarah wants to triple the recipe, how much flour does she need?
def solve() -> int: flour_needed = 2/3 recipe_multiplier = 3 amount_of_flour_needed = flour_needed * recipe_multiplier result = amount_of_flour_needed return result
Student: Dan has two tanks of water; one has 3 gallons and one has 13 gallons. How many gallons of water does he have total?
def solve() -> int: tank1 = 3 tank2 = 13 total = tank1 + tank2 result = total return result
You're taking a road trip and expect to drive 1200 miles in total over the course of 4 days. If you rent a car from a company that charges $30 per day and an additional $0.25 per mile driven, how much will you have to pay for the entire trip?
def solve() -> int: rental_fee = 30 * 4 cost_per_mile = 0.25 total_miles = 1200 mileage_fee = cost_per_mile * total_miles total_cost = rental_fee + mileage_fee result = round(total_cost, 2) return result
James is planning a trip to the beach. He needs to rent beach chairs and umbrellas for himself and his friends. He has 3 friends, so he needs to rent 4 chairs and 2 umbrellas. The rental company charges $5 per chair and $7 per umbrella. How much will James pay to rent all the chairs and umbrellas?
def solve() -> int: num_friends = 3 num_chairs_per_person = 1 num_umbrellas_per_person = 0.67 cost_chair = 5.00 cost_umbrella = 7.00 total_cost = ((num_friends + 1) * num_chairs_per_person * cost_chair) + ((num_friends + 1) * num_umbrellas_per_person * cost_umbrella) result = total...
A pet store has 50 pets for sale. One-fifth of these pets are dogs and one-fourth of the birds can sing. How many pets can either sing or are dogs?
def solve() -> int: pets_for_sale = 50 dogs = pets_for_sale / 5 birds = pets_for_sale - dogs singing_birds = birds / 4 pets_can_sing_or_are_dogs = dogs + singing_birds result = pets_can_sing_or_are_dogs return result
A group of friends went out to eat and the bill was $120. If they want to split the bill evenly among them and also leave a 20% tip, how much will each person have to pay?
def solve() -> int: bill_total = 120 tip_percent = 0.2 total_with_tip = bill_total * (1 + tip_percent) num_people = 4 amount_per_person = total_with_tip / num_people result = amount_per_person return result
- A bag of candy contains 20 pieces of chocolate and 40 pieces of gummy. Cathy eats 2 pieces of chocolate and 4 pieces of gummy every 5 minutes. If she continues eating at that rate, how many minutes will it take for her to finish the bag of candy?
def solve() -> int: total = 20 + 40 eaten = (2 + 4) / 5 minutes = total / eaten result = minutes return result
-**Separate each question by a blank line** Possible math questions: Alex wants to save up $200 for a new bike. He already has $50 in his piggy bank and he earns $10 every week from doing chores. Assuming he saves all his earnings and does not spend any money, how many weeks will it take him to reach his goal?
def solve() -> int: goal = 200 current = 50 weekly = 10 weeks = 0 while current < goal: current = current + weekly weeks = weeks + 1 result = weeks return result
Noah and Liam begin a race with Noah leading by 150 meters. Liam picks up speed and overtakes Noah, leading by 300 meters. But Noah gains momentum and leads by 500 meters. If the race is 10 kilometers long, how many meters does Liam need to run to catch up to Noah? John and Michael are in a swimming competition. John s...
def solve() -> int: noah_lead = 150 liam_lead = 300 noah_lead = 500 race_distance = 10000 distance_to_catch_up = race_distance - noah_lead + liam_lead result = distance_to_catch_up return result
Student: Q2: A video game store sold 9 gaming consoles, 6 controllers, 5 headsets, and 7 online memberships in one month. The gaming consoles cost $250 each, controllers cost $40 each, headsets cost $30 each, and online memberships cost $5 each. How much money did the store earn this month?
def solve() -> int: gaming_consoles = 9 controllers = 6 headsets = 5 online_memberships = 7 gaming_console_price = 250 controller_price = 40 headset_price = 30 online_membership_price = 5 total_gaming_consoles_price = gaming_consoles * gaming_console_price total_controllers_price...
Student: A gym membership is $50 per month. If you sign up for a year, you get 3 months free. How much would you save with the deal?
def solve() -> int: monthly_fee = 50 months_in_year = 12 months_free = 3 total_cost = monthly_fee * (months_in_year - months_free) amount_saved = monthly_fee * months_free total_cost_with_deal = total_cost - amount_saved result = total_cost_with_deal return result
A school has 500 students, out of which 40% are in grade 6. If a grade 5 student has 10 pens, how many pens in total will all the grade 6 students have if there are 50 grade 5 students in the school?
def solve() -> int: grade_5_students = 50 grade_6_students = 500 * 0.4 total_pens_grade_6 = grade_6_students * 10 result = total_pens_grade_6 return result
Celia needs to buy enough trash bags to last for a year. If she uses 1 bag per day and a box of trash bags comes with 60 bags and costs $12, how many boxes will she need to buy?
def solve() -> int: bags_per_day = 1 bags_per_box = 60 cost_per_box = 12 bags_per_year = bags_per_day * 365 boxes_needed = bags_per_year / bags_per_box result = boxes_needed return result
A school library has 100 books. If 20 are textbooks and 50 are fiction books, how many non-fiction books does the library have?
def solve() -> int: total_books = 100 textbooks = 20 fiction = 50 non_fiction = total_books - (textbooks + fiction) result = non_fiction return result
If the price of milk is decreased by 15%, what's the new price if it original cost $4.50?
def solve() -> int: original_price = 4.50 price_decrease = 15 price_decrease_percentage = price_decrease / 100 new_price = original_price - (price_decrease_percentage * original_price) result = new_price return result
Alice drinks 4 times more juice than Bob drinks. If Bob drinks 300 ml of juice per day, how much juice does Alice drink in a week?
def solve() -> int: bob_juice = 300 alice_factor = 4 days = 7 alice_juice = bob_juice * alice_factor result = alice_juice * days return result
Student: A bakery sells cupcakes for $2 each and cookies for $1 each. On Monday, it sells 15 cupcakes and 20 cookies; on Tuesday, it sells 18 cupcakes and 16 cookies. How much does the bakery earn in total?
def solve() -> int: cupcakes_price = 2 cookies_price = 1 monday_cupcakes = 15 monday_cookies = 20 tuesday_cupcakes = 18 tuesday_cookies = 16 monday_earnings = cupcakes_price * monday_cupcakes + cookies_price * monday_cookies tuesday_earnings = cupcakes_price * tuesday_cupcakes + cookies_...
Hanna ran a total of 24 miles in 3 days. If she ran 6 miles on Monday and 8 miles on Tuesday, how many miles did she run on Wednesday?
def solve() -> int: miles_left = 24 - 6 - 8 result = miles_left return result
Jack has 9 houses, each house has 11 windows. How many windows are there in Jack's houses?
def solve() -> int: total_windows = 0 for house in range(9): total_windows += 11 result = total_windows return result
A water purifier jug costs $30 and can filter 50 liters of water. If Jane drinks 2 liters a day, how many days can she drink from one full jug?
def solve() -> int: cost_per_jug = 30 liters_per_jug = 50 liters_per_day = 2 days_per_jug = liters_per_jug/liters_per_day result = days_per_jug return result
Nick went to the swimming pool and bought 6 towels. Each towel costed $5. How much money did he spend?
def solve() -> int: total_cost = 5.0 * 6.0 result = total_cost return result
Erica has borrowed money from her coworker Andy on several occasions. Andy writes down all of Erica's debts in a notebook, the first time he lent her $150. A week later, Erica paid him back half of her debt. A few days later she asked him for $75 more. How much does Erica still owe Andy?
def solve() -> int: debt = 150 debt = debt / 2 debt = debt + 75 amount_owed = debt result = amount_owed return result
A restaurant manager is comparing the day’s sales to his daily average. He usually sells 200 dishes of pasta and 150 pizzas. Today, he sells 175 dishes of pasta and 160 pizzas. If dishes of pasta are sold for $12 each and pizzas are sold for $15 each, what is the difference, in dollars, between the restaurant manager’s...
def solve() -> int: pasta_daily_average = 200 pizza_daily_average = 150 pasta_today = 175 pizza_today = 160 pasta_price = 12 pizza_price = 15 pasta_total_today = pasta_today * pasta_price pizza_total_today = pizza_today * pizza_price total_today = pasta_total_today + pizza_total...
A software engineer earns $70,000 annually and is offered a new job with a 15% pay increase. What will be their new annual salary?
def solve() -> int: current_salary = 70000 increase_percentage = 15 new_salary = current_salary + (current_salary*(increase_percentage/100)) result = new_salary return result
6. 80 students attended the Economics class 4 days ago, and 10 more students joined the class today. If 70% of the total number of students present in the class two days ago had attended class today, how many students are there in the Economics class today?
def solve() -> int: num_from_prev_session = 80 num_present_today = num_from_prev_session*70/100 num_joined_today = 10 result = num_present_today + num_joined_today return result
Student: The area of a triangle is 187.5 sq. cm and the height is 25cm. What is the length of the base?
def solve() -> int: area = 187.5 height = 25 base = 2 * area / height result = base return result
A video game store has 5 of the video games that John wants. Each video game cost differently. The first game costs $20, the second game costs $40, the third game costs $35, the fourth game costs $25, and the fifth game costs $20. How much does it cost to buy all the video games that John wants?
def solve() -> int: price_of_first_game = 20 price_of_second_game = 40 price_of_third_game = 35 price_of_fourth_game = 25 price_of_fifth_game = 20 total_cost = price_of_first_game + price_of_second_game + price_of_third_game + price_of_fourth_game + price_of_fifth_game result = total_cost ...
A car travels 60 miles per hour. How long does it take to travel 150 miles?
def solve() -> int: distance = 150 speed = 60 time = distance/speed result = time return result
Student: A swimming pool is 25m long, 10m wide, and 3m deep. What is the volume of the swimming pool in cubic meters?
def solve() -> int: length = 25 width = 10 depth = 3 volume = length * width * depth result = volume return result
The cost of a dress is $50. If there is a 20% discount, what is the cost after the discount?
def solve() -> int: original_price = 50 discount = 0.2 new_price = original_price - (original_price * discount) result = new_price return result
If x=3 and y=4, what is the value of 2x + 3y - 7?
def solve() -> int: x = 3 y = 4 expression = 2*x + 3*y - 7 result = expression return result
If there are 7 pencils, each with 2 inches of lead, and 6 pens with no lead, and another 4 pens with 1 inch of lead each, how much lead is there in total?
def solve() -> int: pencils = 7 lead_per_pencil = 2 total_lead_in_pencils = pencils * lead_per_pencil pens_with_no_lead = 6 pens_with_lead = 4 lead_per_pen_with_lead = 1 total_lead_in_pens_with_lead = pens_with_lead * lead_per_pen_with_lead total_lead = total_lead_in_pencils + ...
George has 8 pens. One pen has 3 more refills than the another pen. Another two pens each have 2 fewer refills than the first pen. The last pen has three times as many refills as all the other pens combined. How many refills does George have in total?
def solve() -> int: pens = 8 refills_pen1 = pens refills_pen2 = refills_pen1 - 3 refills_pen3 = refills_pen1 - 2 refills_pen4 = (refills_pen1 + refills_pen2 + refills_pen3) * 3 total_refills = refills_pen1 + refills_pen2 + refills_pen3 + refills_pen4 result = total_refills retu...
A pizza has 8 slices. If you ate 3 slices, what percentage of the pizza did you eat?
def solve() -> int: total_slices = 8 slices_eaten = 3 percentage_eaten = (slices_eaten * 100)/total_slices result = percentage_eaten return result
Billy has $45 and wants to buy some toys. Each toy costs $2.75. How many toys can Billy purchase and how much money will he have left over?
def solve() -> int: budget = 45 cost = 2.75 max_toys = budget // cost money_left = budget - (max_toys * cost) result = max_toys, money_left return result
Sarah's son Henry is half her age, and Sarah is now 54. How old will Henry be when Sarah is 70?
def solve() -> int: sarah_age = 54 henry_age = sarah_age / 2 age_difference = 70 - sarah_age henry_future_age = henry_age + age_difference result = henry_future_age return result
Lisa buys a designer purse worth $2,000. Her best friend buys a purse that is four times more expensive and decides to sell Lisa's purse for half the initial cost. How much does Lisa's best friend lose in the end?
def solve() -> int: purse_cost = 2000 friend_purse_cost = purse_cost * 4 selling_price = purse_cost / 2 loss = friend_purse_cost - selling_price result = loss return result
Kevin and his brother Alex want to buy a new laptop worth $800. They are planning to raise money by delivering newspapers. They get paid $5 for every successful delivery. How many successful deliveries do they need to make to buy the laptop?
def solve() -> int: laptop_price = 800 delivery_payment = 5 deliveries_needed = laptop_price / delivery_payment result = deliveries_needed return result
A family goes through two loaves of bread each week. If each loaf costs $2.50, how much do they spend on bread in three months?
def solve() -> int: loaves_per_week = 2 cost_per_loaf = 2.5 weeks_in_three_months = 12 total_loaves = loaves_per_week * weeks_in_three_months total_cost = total_loaves * cost_per_loaf result = total_cost return result
A store is having a sale. The original price of a dress was $60, but now it is 20% off. How much would a customer have to pay for the dress?
def solve() -> int: original_price = 60 discount_percentage = 20 discounted_price = original_price * (1 - discount_percentage/100) result = discounted_price return result
Grace had 40 hamsters and her brother, Ethan, had 2 fewer hamsters than her. After a month, Grace lost half of her hamsters and Ethan had quadrupled his hamsters and gave half of them to Grace. How many hamsters did Grace end up with?
def solve() -> int: grace_hamsters = 40 ethan_hamsters = grace_hamsters - 2 grace_hamsters = grace_hamsters / 2 ethan_hamsters = ethan_hamsters * 4 grace_hamsters = grace_hamsters + ethan_hamsters / 2 result = grace_hamsters return result
A movie theater has 200 seats. If each ticket costs $15, how much money will they make if every seat is sold?
def solve() -> int: num_seats = 200 ticket_price = 15 total_revenue = num_seats * ticket_price result = total_revenue return result
A bike store has a 15% off sale on all bikes. A bike initially priced at $250 is now available at the discounted price. What is the discounted price of the bike?
def solve() -> int: initial_price = 250 discount = 0.15 discounted_price = initial_price * (1 - discount) result = discounted_price return result
Sarah has to bake 5 dozen cupcakes. She can bake 3 cupcakes for every 15 minutes. How long will it take for her to finish baking all the cupcakes?
def solve() -> int: num_cupcakes = 5 * 12 cupcakes_per_time = 3 time_per_batch = 15 total_time = (num_cupcakes // cupcakes_per_time) * time_per_batch result = f'{total_time} minutes' return result
William the elephant has 55 bananas. The other elephant, Lilo has eight times the amount of bananas as Benny. The final elephant, Benny has one ninth the amount of bananas as William. How many bananas are there?
def solve() -> int: william_bananas = 55 benny_bananas = william_bananas / 9 lilo_bananas = 8 * benny_bananas total_bananas = william_bananas + benny_bananas + lilo_bananas result = total_bananas return result
Liam burns 1200 calories in 45 minutes doing cardio and 800 calories in 60 minutes doing weights. If his average burn rate is 960 calories per hour, how many calories would he burn if he spent 30 minutes on the treadmill and 45 minutes lifting weights?
def solve() -> int: cardio_calories = 1200 cardio_time = 45 weights_calories = 800 weights_time = 60 average_burn_rate = 960 treadmill_time = 30 lifting_time = 45 cardio_rate = cardio_calories / cardio_time weights_rate = weights_calories / weights_time treadmill_c...
A company has to pay 15 workers. Each worker gets paid $18 per hour and they worked for a total of 35 hours. How much money does the company need to pay the workers in total?
def solve() -> int: num_workers = 15 pay_per_hour = 18 total_hours_worked = 35 total_pay = num_workers * pay_per_hour * total_hours_worked result = total_pay return result
If the circumference of a circle is 18π meters, what is the radius of the circle (in meters)?
def solve() -> int: circumference = 18 * 3.14 radius = circumference / (2 * 3.14) result = radius return result
David is mixing drinks for his party. He mixes 3/4 cup of tequila with 1/4 cup of lime juice in each drink. He uses a 2 cup measuring jug. What percentage of the jug is tequila? Samantha is baking cakes for a charity event. For every 10 cakes she bakes, she needs to buy a new bag of flour for $7. If she spends $42 on f...
def solve() -> int: tequila = 3/4 lime_juice = 1/4 total = tequila + lime_juice percentage = (tequila / total) * 100 flour_cost = 7 total_flour_cost = 42 flour_bags = total_flour_cost / flour_cost cakes_per_flour_bag = 10 total_cakes = flour_bags * cakes_per_flour_bag result...
fan fixed 80% of the problems on his board. Before, there was a total of 24 problems. How many are still left to fix?
def solve() -> int: total_problems = 24 percentage_fixed = 80 problems_fixed = (percentage_fixed * total_problems) / 100 problems_left = total_problems - problems_fixed result = int(problems_left) return result
A student bought 3 pencils, 2 erasers, and 5 notebooks. The notebooks cost $2 each and the other items are half as much than the notebooks. How much did the student spend in total?
def solve() -> int: pencils = 0 erasers = 0 notebooks = 0 while pencils * 0.5 + erasers * 0.5 + notebooks * 2!= 0: pencils = pencils + 1 erasers = erasers + 1 notebooks = notebooks...
John is 5 times as heavy as his cat while Mary is 4 times as heavy as John. If Mary is 240kg, what is the weight difference between John and his cat?
def solve() -> int: john_weight = 240 / 4 john_cat_weight = john_weight / 5 weight_difference = john_weight - john_cat_weight result = weight_difference return result
Samantha is planning a dinner party for her friends. She wants to make chicken fajitas as the main course. She goes to the market and buys 5 pounds of chicken, 2 red peppers, and 3 onions. If she needs 0.5 pounds of chicken, 1/3 of a pepper, and 1/6 of an onion per serving, and she is expecting 12 guests, how many serv...
def solve() -> int: chicken_weight = 5 red_pepper = 2 onion = 3 chicken_pp = 0.5 pepper_pp = 1/3 onion_pp = 1/6 guests = 12 servings_c = min(chicken_weight/chicken_pp, (red_pepper*3)/pepper_pp, (onion*6)/onion_pp) total_servings = servings_c * guests result = total_servings r...
The hotel ordered 60 new mattresses for its guests. However, only 45 mattresses were used. If each room has 2 mattresses, how many rooms are there in the hotel?
def solve() -> int: mattresses_ordered = 60 mattresses_used = 45 mattresses_per_room = 2 total_rooms = mattresses_used / mattresses_per_room result = total_rooms return result
Possible new questions and programs (some variables and numbers are randomly chosen): Sam and Lisa participated in a 12K bike race. Sam finished the race in 36 minutes, while Lisa took 10% longer than Sam. How much faster was Sam's average speed than Lisa's?
def solve() -> int: race_distance = 12000 sam_speed = race_distance / 36 lisa_time = 1.1 * 36 lisa_speed = race_distance / lisa_time speed_difference = sam_speed - lisa_speed speed_difference = speed_difference * 60 / 1000 result = round(speed_difference, 2) ...
Student: Tammy has some boxes of chocolates. If she bought a total of 346 and she had 67 boxes left in the end, how many boxes did she buy originally?
def solve() -> int: total_bought = 346 left_over = 67 original_bought = total_bought - left_over result = original_bought return result
There are 7,000 cookies in a jar. If three sevenths of the cookies are chocolate chip, and one fifth of the chocolate chip cookies have nuts, how many cookies have nuts?
def solve() -> int: chocolate_cookies = 7000 * 3 / 7 nut_cookies = chocolate_cookies * 1 / 5 result = round(nut_cookies) return result
1. Amy plants carrots in a one-hectare field, each carrot yield 10 every two months. If Amy has a coworker who owns a one-half hectare field, and each hectare can yield 12 carrots every two months, how much carrots can they harvest altogether after four months?
def solve() -> int: num_full_hectare_field = 1 num_half_hectare_field = 0.5 yield_full = 10 yield_half = 12 interval = 4 result_full_hectare_field = num_full_hectare_field * yield_full * (interval/2) result_half_hectare_field = num_half_hectare_field * yield_half * (interval/2) ...
Joe was going through his toy box. He had 3 times as many dinosaurs as he had robots and he had double the amount of figures as he had dinosaurs. He counted a total of 42 toys. How many toys of each type did Joe have?
def solve() -> int: total_toys = 42 dinosuars = total_toys / 6 robots = dinosuars / 3 figures = dinosuars * 2 result = dinosuars + robots + figures return result
If I have a rectangular room that is 12 feet by 14 feet and I want to paint all four walls, how many square feet of paint do I need?
def solve() -> int: length = 12 width = 14 height = 8 area_of_walls = 2 * height * (length + width) result = area_of_walls return result