question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Jared had 75 Lego pieces. He gave 20 to his neighbor and kept 10 for himself. How many Lego pieces does Jared have left?
def solve() -> int: jared_pieces = 0 jared_pieces = jared_pieces + 75 given_neighbor = 20 jared_pieces = jared_pieces - given_neighbor kept_pieces = 10 jared_pieces = jared_pieces - kept_pieces result = jared_pieces return result
Greg planted 10 sunflowers, and Helen planted 4 more sunflowers than Greg. After a month, Greg's sunflowers grew by 50% and Helen's sunflowers grew by 20%. How many sunflowers did they have in total?
def solve() -> int: greg = 10 helen = greg + 4 greg = greg + (greg / 2) helen = helen + (helen / 5) result = greg + helen return result
arah drove 120 miles in 3 hours. If she continues driving at the same speed, how long would it take her to drive 300 miles?
def solve() -> int: average_speed = 120/3 drive_time = 300/average_speed result = drive_time return result
Sarah divided an amount of $240 among her three siblings in the ratio of 4:3:5 respectively. If the youngest received $60, how much money did the eldest receive? John wants to make a quilt that measures 80 inches by 60 inches. He also needs to make 10 pillowcases that are 9 by 12 inches. How many square inches of fabri...
def solve() -> int: total_amount = 240 youngest_share = 60 total_ratio = 4 + 3 + 5 oldest_share = (5/total_ratio) * (total_amount - youngest_share) result = oldest_share quilt_area = 80 * 60 pillowcase_area = 10 * 9 * 12 total_area = quilt_area + pillowcase_area result = total_a...
A pizza has a diameter of 18 inches and costs $8. If you want to order a larger pizza with a diameter of 24 inches, it will cost $12. How much does each inch of pizza cost?
def solve() -> int: small_price = 8 small_diameter = 18 small_area = (small_diameter/2) ** 2 * 3.14 small_ppi = small_price / small_area large_price = 12 large_diameter = 24 large_area = (large_diameter/2) ** 2 * 3.14 large_ppi = large_price / large_area result = (small_ppi...
Rachel works at a restaurant and earns $10 per hour plus tips. This week she worked 30 hours and earned $200 in total tips. Her tax rate is 20% and she spends $50 on groceries each week. How much money does Rachel have left after paying tax and groceries?
def solve() -> int: hourly_rate = 10 hours_worked = 30 total_tips = 200 tax_rate = 0.2 groceries_cost = 50 total_income = (hourly_rate * hours_worked) + total_tips tax_amount = total_income * tax_rate net_income = total_income - tax_amount remaining_income = net_income - groceries_co...
Student: If a loaf of bread costs $2.50 and a jar of peanut butter costs $1.75, how much would it cost to buy 5 loaves of bread and 4 jars of peanut butter?
def solve() -> int: bread_cost = 2.50 peanut_butter_cost = 1.75 num_bread = 5 num_peanut_butter = 4 total_cost = (bread_cost * num_bread) + (peanut_butter_cost * num_peanut_butter) result = total_cost return result
Adam read a book with one-fifth of the number of pages in Harry's book and 400 pages added. How many pages are in Adam's book?
def solve() -> int: total_pages_harry = 400/2 mult_total_harry = 1/5 * total_pages_harry add_pages = 400 total_pages_adam = mult_total_harry + add_pages result = total_pages_adam return result
arah is currently 25 years old. She is 3 years younger than her friend Jennifer who is twice as old as her brother Jack. If Jack is 17 years old, how old is Jennifer?
def solve() -> int: sarah = 25 jack = 17 jennifer = 2 * jack + 3 - sarah result = jennifer return result
Jack has 16 toy soldiers, and his friend Mark has 4 more. If their neighbor has eight times the total number of toy soldiers Jack and Mark have, what's 50% of their neighbor's toy soldiers?
def solve() -> int: jack = 16 mark = jack + 4 total = jack + mark neighbor = 8 * total result = neighbor * 0.5 return result
A company has 120 employees, out of which 30% work in the marketing department. If the marketing department has 15 female employees, how many male employees does the company have?
def solve() -> int: total_employees = 120 marketing_percentage = 0.3 marketing_employees = total_employees * marketing_percentage female_employees = 15 male_employees = marketing_employees - female_employees result = male_employees return result
A hardware store sells pliers at $8 each and screwdrivers at $6 each. Mark buys 1 pair of pliers and 3 screwdrivers. How much does he spend in all?
def solve() -> int: price_pliers = 8 price_screwdriver = 6 qty_pliers = 1 qty_screwdriver = 3 total_cost = price_pliers * qty_pliers + price_screwdriver * qty_screwdriver result = total_cost return result
In a race, a runner must finish 5 laps and score an average of at least 8 minutes per lap to qualify for the finals. The runner completed 4 laps with an average of 7.5 minutes. What is the maximum time the runner can take on the 5th lap to make it to the finals?
def solve() -> int: total_laps = 5 required_avg_time = 8 completed_laps = 4 completed_avg_time = 7.5 total_time_completed_laps = completed_laps * completed_avg_time total_time_required = total_laps * required_avg_time max_time_5th_lap = total_time_required - total_time_complet...
Student: Cindy is painting a mural on a wall. She knows that the wall is 10 meters long and 4 meters high. She also knows that she can paint 1 square meter in 15 minutes. How long will it take her to paint the whole wall if she does not take any breaks?
def solve() -> int: wall_length = 10 wall_height = 4 time_per_sqm = 15 area = wall_length * wall_height time_total = area * time_per_sqm result = time_total return result
Frank is in the final semester of his college and has completed 10 exams with an average score of 78%. His final exam is worth the same as all the previous exams. What’s the minimum score he needs in the final exam to have an overall average score of 80% for all his exams?
def solve() -> int: num_exams = 10 average_score = 78 final_exam_weight = 1 total_weight = num_exams + final_exam_weight desired_average = 80 required_score = (desired_average * total_weight) - (average_score * num_exams) result = required_score / final_exam_weight re...
A fitness center can hold 100 people in a yoga class. They fill to 75% capacity. Each class costs $15. They have 5 classes in a day. What is the total revenue earned from the yoga classes?
def solve() -> int: capacity = 100 fill_percentage = 0.75 class_cost = 15 num_classes = 5 filled_capacity = capacity * fill_percentage total_revenue = filled_capacity * class_cost * num_classes result = total_revenue return result
Student: Ben received $120 for his birthday and spent 2/3 of it on new sneakers. How much did the sneakers cost?
def solve() -> int: birthday_money = 120 fraction_spent = 2/3 sneakers_cost = birthday_money * fraction_spent result = sneakers_cost return result
Jack is preparing lunch for 8 people. He has 24 apples and he wants to chop them into equal portions so that each person gets 3 apples. How many portions did he make?
def solve() -> int: apples = 24 person = 8 eachperson = apples // person portions = eachperson // 3 result = portions return result
A dance class has 15 children. If each child needs 3 pairs of shoes per year and each pair of shoes costs $35, how much will it cost to buy shoes for all the children for one year?
def solve() -> int: children = 15 shoes_per_child = 3 cost_per_shoe = 35 total_shoes_needed = children * shoes_per_child total_cost = total_shoes_needed * cost_per_shoe result = total_cost return result
A farmer has two fields, one is three times as big as the other. If the area of the smaller field is 4 hectares, what is the area of the bigger field?
def solve() -> int: smaller_field_area = 4 bigger_field_area = smaller_field_area * 3 result = bigger_field_area return result
Julian drank a total of 87 cups of water over the course of 4 days. He drank 24 cups on Monday, 22 on Tuesday, 19 cups on Wednesday, and 22 cups on Thursday. What is the average number of cups of water Julian drank per day?
def solve() -> int: monday = 24 tuesday = 22 wednesday = 19 thursday = 22 total_cups = monday + tuesday + wednesday + thursday result = total_cups / 4 return result
A wire is cut into three pieces with lengths of x, y, and z. If the lengths of these pieces are in the ratio 2:3:4 and the total length of the wire is 63 inches, what is the length of the second piece (y)?
def solve() -> int: total_length = 63 r1 = 2 r2 = 3 r3 = 4 total_ratio = r1 + r2 + r3 y_part_ratio = r2 / total_ratio y_length = total_length * y_part_ratio result = y_length return result
Brian mixes 6 drinks in an hour. The first mix contains 2 shots of rum, the second mix contains 3 shots of tequila, the third mix contains 1 shot of vodka and 1 shot of gin, and the fourthAnna is a marathon runner trying to finish a 10K race. The race has 4 laps and Anna can run one lap in 5 minutes. The race has a tim...
def solve() -> int: laps = 4 lap_time = 5 race_time_limit = 40 time_spent = 18 total_race_time = laps * lap_time remaining_time = race_time_limit - time_spent time_per_lap = total_race_time / laps time_left_after_3_laps = remaining_time - (time_per_lap * 3) result = time_le...
Student: Question 10. If Rachel has a total of 3 bags of chips and 6 bottles of soda, how many sandwiches does she have if she has a total of 15 pieces of snacks?
def solve() -> int: bags_of_chips = 3 bottles_of_soda = 6 total_snacks = 15 sandwiches = total_snacks - (bags_of_chips + bottles_of_soda) result = sandwiches return result
A bookstore ordered 80 books for a new release. 1/4 of them were hardcovers and the rest were softcovers. How many softcovers were ordered?
def solve() -> int: total_books = 80 hardcovers = total_books * 1/4 softcovers = total_books - hardcovers result = softcovers return result
Bob works as a barber and he also sells handmade combs on the Internet. Bob charges $25 for a haircut and makes $8/profit on each comb he sells. If he does 15 haircuts and sells 20 combs, how much money does he make?
def solve() -> int: haircut_fee = 25 comb_profit = 8 haircuts = 15 combs_sold = 20 result = (haircut_fee * haircuts) + (comb_profit * combs_sold) return result
John is baking. He needs an equal quantity of flour, sugar, and butter. He has 5 cups of flour and 7 cups of sugar. 1 cup of butter is equal to 1 cup of flour. How many cups of butter does John need?
def solve() -> int: flour = 5 sugar = 7 butter = flour result = butter return result
A plane can fly at a rate of 400 miles per hour. A helicopter can fly at a rate of 300 miles per hour. In hours, how much longer will the helicopter take if it needs to travel 1200 miles?
def solve() -> int: plane_speed = 400 helicopter_speed = 300 distance = 1200 plane_time = distance / plane_speed helicopter_time = distance / helicopter_speed time_difference = plane_time - helicopter_time result = time_difference return result
If a jacket is originally $80 and is on sale for 20% off, what is the sale price of the jacket?
def solve() -> int: original_price = 80 discount = 0.2 sale_price = original_price - (original_price * discount) result = sale_price return result
Mia has 24 candies. She wants to share them equally with 4 friends. How many candies does each person get?
def solve() -> int: candies = 24 friends = 4 candies_per_person = candies // friends result = candies_per_person return result
A pizza has 12 slices. If 5 people are sharing the pizza and each person wants 2 slices, how many slices will be left over?
def solve() -> int: pizza_slices = 12 people_sharing = 5 slices_per_person = 2 total_slices_needed = people_sharing * slices_per_person slices_left_over = pizza_slices - total_slices_needed result = slices_left_over return result
Emma has decided to buy 20 tickets to the amusement park. She wants to bring herself and 9 friends. How many tickets will be left over?
def solve() -> int: emma_tickets = 20 emma_friends = 9 total_people = emma_friends + 1 total_tickets = total_people tickets_left = emma_tickets - total_tickets result = tickets_left return result
Student: Laura wants to buy 4 packs of pencils. Each pack costs $5 but they have a buy-one-get-one-free promotion. How much will Laura pay for the pencils?
def solve() -> int: packs = 4 price_per_pack = 5 total_price = (packs // 2) * price_per_pack + (packs % 2) * price_per_pack result = total_price return result
James can throw a baseball while running at a speed of 12 meters per second. The baseball flies at a speed of 40 meters per second. If he throws the baseball while running in the same direction, how much faster, in meters per second, is the baseball moving than if he throws the baseball in the opposite direction?
def solve() -> int: james_speed = 12 baseball_speed = 40 relative_speed_same_direction = baseball_speed - james_speed relative_speed_opposite_direction = baseball_speed + james_speed faster_speed = relative_speed_same_direction - relative_speed_opposite_direction result = faster_s...
A car travels 60 miles in 2 hours. What is its average speed in miles per hour?
def solve() -> int: distance_traveled = 60 time_taken = 2 average_speed = distance_traveled / time_taken result = average_speed return result
Student: A group of 108 swimmers stayed overnight at a resort. The next morning, for 8 hours straight, since 45 of these swimmers left the resort at a rate of 27 swimmers per hour, while 33 new swimmers arrived at that same resort at a rate of 18 swimmers per hour. How many swimmers remained in the resort after the swi...
def solve() -> int: total_swimmers = 108 left_swimmers = 45 left_rate = 27 new_swimmers = 33 new_rate = 18 time = 8 net_rate = new_rate - left_rate net_change = net_rate * time result = total_swimmers - left_swimmers + new_swimmers + net_change return result
Anna, Thomas, and Rachel grew 80 sunflowers. If Thomas and Rachel grew an equal number of sunflowers and Anna grew 20, how many sunflowers did Rachel grow?
def solve() -> int: anna_sunflowers = 20 total_sunflowers = 80 thomas_sunflowers = (total_sunflowers - anna_sunflowers) / 2 rachel_sunflowers = thomas_sunflowers result = rachel_sunflowers return result
Amanda got a deal on a camera for $120 from a local store, but her friend Sarah wanted the same camera. Unfortunately, the store sold out of the camera, and Sarah had to buy it online for twice the store price. Plus, she had to pay $10 as shipping fees. How much did Sarah spend to get the camera?
def solve() -> int: store_price = 120 online_price = store_price * 2 + 10 result = online_price return result
10. The living room measures 15 feet on each side. How many tiles are need to cover the living room? Assume that each tile is 6 inches by 6 inches.
def solve() -> int: length_of_room = 15 side_length_of_tile = 6/12 area_of_room = length_of_room * length_of_room area_of_tile = side_length_of_tile * side_length_of_tile total_tiles = area_of_room / area_of_tile result = total_tiles return result
Emily's graduation party was one week after she completed her final exams. Her thirteen friends decided to contribute an equal amount of money to buy her a graduation cake. Emily added $45 to the contribution, making the total contribution five times as much as Emily contributed. Calculate the total amount of money tha...
def solve() -> int: num_friends = 13 emily_contribution = 45 total_contribution = emily_contribution * 5 friends_contribution = (total_contribution - emily_contribution) / num_friends hours_worked = [8, 6, 12] hourly_rate = 15 total_payment = sum(hours_worked) * hourly_rate * 3 ...
There were 20 pencils and 15 pens in a box. If Alice takes 4 pencils and 3 pens from the box, what percentage of the pencils in the box would be blue if 25% of the initial pencils were blue?
def solve() -> int: initial_pencils = 20 initial_pens = 15 final_pencils = initial_pencils - 4 final_pens = initial_pens - 3 initial_blue_pencils = initial_pencils * 0.25 final_blue_pencils = initial_blue_pencils percentage_blue_pencils = (final_blue_pencils / final_pencils) * 100 ...
Student: A box of crayons has 24 crayons, but 3 are broken. If Tony taakes 8 crayons, how many will be left?
def solve() -> int: total_crayons = 24 broken_crayons = 3 taken_crayons = 8 crayons_left = total_crayons - broken_crayons - taken_crayons result = crayons_left return result
A zoo enclosure is 1/9th the size of a wildlife sanctuary. The area of the wildlife sanctuary is 1000 square feet. The value of a square foot of land in the zoo enclosure is 2 times that of a square foot of land in the wildlife sanctuary. If the value of the wildlife sanctuary is 24,000 dollars, what is the total value...
def solve() -> int: wildlife_sanctuary_area = 1000 zoo_enclosure_area = wildlife_sanctuary_area / 9 wildlife_sanctuary_value_per_sqft = 24000 / wildlife_sanctuary_area zoo_enclosure_value_per_sqft = wildlife_sanctuary_value_per_sqft * 2 zoo_enclosure_value = zoo_enclosure_value_per_sqft * zoo_enclos...
Student: The perimeter of a square is 16. What is the area of the square?
def solve() -> int: perimeter = 16 side_length = perimeter / 4 area = side_length ** 2 result = area return result
There are 15 students waiting for lunch and twice as many students waiting for recess. If each student waits 5 minutes for lunch and 30 seconds for recess, how many seconds shorter is the shorter wait?
def solve() -> int: lunch_wait = 15 * 5 recess_wait = (15 * 2) * 0.5 shorter_wait = recess_wait - lunch_wait result = shorter_wait return result
A company sells 500 sweaters per month at $25 each and 400 sweaters per month at $30 each. What's their total monthly revenue?
def solve() -> int: sweaters_sold_A = 500 sweaters_sold_B = 400 price_A = 25 price_B = 30 revenue_A = sweaters_sold_A * price_A revenue_B = sweaters_sold_B * price_B total_revenue = revenue_A + revenue_B result = total_revenue return result
Student: If a rectangular garden is 4 m wide and 9 m long, what is the area of the garden?
def solve() -> int: width = 4 length = 9 area = width * length result = area return result
A family budgeted $250 for groceries for the week. If they spend $35 on Monday and $57 on Tuesday, how much money do they have left for the remaining days?
def solve() -> int: budget = 250 spent_monday = 35 spent_tuesday = 57 total_spent = spent_monday + spent_tuesday remaining_budget = budget - total_spent result = remaining_budget return result
Student: For her science project, Amanda wants to measure the speed of her rollercoaster. The wheel spins 6 times in 10 seconds. What is the angular velocity in radians per second?
def solve() -> int: revolutions = 6 time = 10 angular_velocity = revolutions / time angular_velocity_radians = angular_velocity * 2 * 3.14 result = angular_velocity_radians return result
Student: If a recipe calls for 2/3 cup of flour and you only have a 1/4 cup measuring cup, how many scoops of flour do you need to get 2/3 of a cup?
def solve() -> int: recipe_flour = 2/3 measuring_cup = 1/4 scoops_needed = recipe_flour / measuring_cup result = scoops_needed return result
A car rental company charges a flat fee of $25 per day, and an additional $0.15 per mile for the first 500 miles driven, and $0.25 per mile thereafter. If John rented a car for 7 days and drove 850 miles, how much did he pay?
def solve() -> int: days = 7 base_fee = 25 miles = 850 if miles <= 500: additional_cost = miles * 0.15 else: additional_cost = 500 * 0.15 + (miles-500) * 0.25 total_cost = base_fee * days + additional_cost result = total_cost return result
Mrs. Tina owns a textile company that produces 1000 yards of cloth every day. The expenses for maintenance and purchase of threads is $4000 per month. If she sells a yard of cloth at $5.50, compute her total income in October.
def solve() -> int: yards_per_day = 1000 expenses_per_month = 4000 price_per_yard = 5.50 total_yards_in_october = yards_per_day * 31 total_income_in_october = total_yards_in_october * price_per_yard net_income_in_october = total_income_in_october - expenses_per_month resu...
A man runs at a speed of 5 miles per hour. How far will he run in 2.5 hours?
def solve() -> int: speed = 5 time = 2.5 distance = speed*time result = distance return result
Tom works at a call center and he gets paid $10 for every hour he works. If he worked a total of 35 hours over 5 days, how much money did he make?
def solve() -> int: hours_per_day = 7 days = 5 hourly_rate = 10 total_hours = hours_per_day * days total_income = total_hours * hourly_rate result = total_income return result
arah has a total of 18 rabbits. She sold 12 rabbits for $1.50 each, and used the other 6 to make a stew. How much did she make from selling the 12 rabbits?
def solve() -> int: rabbits_sold = 12 price_per_rabbit = 1.50 total_earned = (rabbits_sold * price_per_rabbit) result = total_earned return result
Ann has 5 red pencils, 6 green pencils, and 9 blue pencils. If Ann takes out two pencils at random, what is the probability both of them are red?
def solve() -> int: total_pencils = 5 + 6 + 9 probability_first_red = 5/total_pencils probability_second_red = 4/(total_pencils-1) probability_both_red = probability_first_red * probability_second_red result = probability_both_red return result
A staircase has 18 steps. If each step is 6 inches high, how many feet tall is the staircase?
def solve() -> int: step_height_inches = 6 number_of_steps = 18 height_inches = step_height_inches * number_of_steps height_feet = height_inches / 12 result = height_feet return result
Emma wants to bake 20 cookies by Sunday. She baked 6 cookies on Friday and 8 cookies on Saturday. How many cookies does she have to bake on Sunday to meet her goal?
def solve() -> int: goal = 20 baked_friday = 6 baked_saturday = 8 baked_so_far = baked_friday + baked_saturday baked_sunday = goal - baked_so_far result = baked_sunday return result
A store sells shirts for $25 each. If you buy 3 shirts, you get a 10% discount. What is the total cost for 3 shirts?
def solve() -> int: normal_price = 25 * 3 discounted_price = normal_price * 0.9 result = discounted_price return result
A grocery store was having a sale and offered 5% off all items. The total bill was $154.97 with the discount. How much was the full price without the discount?
def solve() -> int: total_bill = 154.97 discount_factor = 0.05 discount = total_bill * discount_factor full_price = total_bill + discount result = full_price return result
A cinema sells popcorn and soda. It has a rule that for every bag of popcorn you buy, you must buy 2 drinks which cost 1/4 the price of the popcorn. If they sold 50 bags of popcorn and earned $200, how much do the drinks cost?
def solve() -> int: popcorn_price = 200/50 drink_price = popcorn_price/4 total_drinks = 2*50 total_cost_drinks = total_drinks * drink_price result = total_cost_drinks return result
Possible new questions and programs are: Laura has eight chickens and three times as many ducks in her backyard. She also has four fewer rabbits than the total number of chickens and ducks. How many animals does she have in her backyard?
def solve() -> int: ducks = 3 * 8 rabbits = ducks + 8 - 4 total = ducks + 8 + rabbits result = total return result
Lily planted 8 flowers in the first day. She then planted 2 more flowers than the previous day in the second day, and 2 more flowers than the previous day in the third day. How many flowers did Lily plant in total?
def solve() -> int: flowers_1 = 8 flowers_2 = flowers_1 + 2 flowers_3 = flowers_2 + 2 total_flowers = flowers_1 + flowers_2 + flowers_3 result = total_flowers return result
1. Sam earned a total of $204 from working at his neighbor's garage. He put half of his earnings in his savings and spent the rest for new school supplies. If he purchased a new calculator for $56, how much money does he have left?
def solve() -> int: earnings = 204 share_savings = earnings / 2 left = earnings - share_savings calc_cost = 56 after_calc = left - calc_cost result = after_calc return result
The ages of Lisa and Jack are in the ratio 3:5. After 8 years, the sum of their ages will be 56. What was Lisa's age when Jack was born?
def solve() -> int: Lisa_age_ratio = 3 Jack_age_ratio = 5 sum_of_ages_after_8_years = 56 total_ratio = Lisa_age_ratio + Jack_age_ratio difference_ratio = Jack_age_ratio - Lisa_age_ratio jacks_age_after_8_years = (sum_of_ages_after_8_years - Lisa_age_ratio*8) / difference_ratio lisas_age_befo...
Miguel invests $10000 into a savings account with an annual interest rate of 9%. How much money will be in the account after 10 years if the interest is compounded twice a year?
def solve() -> int: balance = 0 monthly_deposit = 10000 year = 10 interest_rate = 0.09 for four_months in range(1,year*2+1): balance += monthly_deposit + ( interest_rate / 12 * balance) result = balance return result
In a zoo, there are a total of 450 animals. If the number of elephants is three times the number of giraffes, how many giraffes are there in the zoo?
def solve() -> int: total_animals = 450 elephants = total_animals // 4 giraffes = elephants // 3 result = giraffes return result
Kevin has 30 cookies. Each cookie is sold for $2. He decides to sell 20 cookies. How much money did Kevin make from selling the cookies?
def solve() -> int: number_of_cookies = 30 number_of_sold_cookies = 20 price_of_one_cookie = 2 total_amount_earned = number_of_sold_cookies * price_of_one_cookie result = total_amount_earned return result
Maria has triple the amount of money Jack has. If together they have $150, how much money does each of them have?
def solve() -> int: money_jack = 150/4 money_maria = money_jack * 3 result = money_jack + money_maria return result
Tom has $5000 in a savings account that earns 4% interest per year. If he does not deposit or withdraw any money, how much will he have in the account after 5 years?
def solve() -> int: principal = 5000 interest_rate = 0.04 num_years = 5 balance = principal * (1 + interest_rate) ** num_years result = balance return result
Anna can knit a scarf in 4 hours. If she spends 2 hours knitting every day, how many days will it take her to complete 2 scarfs?
def solve() -> int: time_per_scarf = 4 daily_time = 2 total_scarfs = 2 total_time = (time_per_scarf * total_scarfs) / daily_time result = total_time return result
Max is on a diet and his goal is to eat 2000 calories this week. He ate 500 calories on Monday and 800 calories on Tuesday. How many calories does Max have to eat on Wednesday to meet his goal?
def solve() -> int: calories_needed = 0 calories_Monday = 500 calories_Tuesday = 800 total_calories = calories_Monday + calories_Tuesday calories_needed = 2000 - total_calories result = calories_needed return result
A book has 200 pages. If you read 25 pages per day, how many days will it take you to finish the book?
def solve() -> int: num_pages = 200 pages_per_day = 25 days_to_finish = num_pages/pages_per_day result = days_to_finish return result
A farmer wants to plant a rectangular field with a length of 80 meters and a width of 60 meters. The seed supplier recommends 5 kg of seed per 100 square meters. How many bags of 25 kg of seeds should the farmer order to have enough for the field?
def solve() -> int: length = 80 width = 60 area = length*width seed_per_square_meter = 5/100 total_seed_required = area*seed_per_square_meter bags_of_seed = total_seed_required/25 result = bags_of_seed return result
A pizza parlor sells pizzas for $12 each, but their cost to make each pizza is $5. How much profit does the parlor make from selling 50 pizzas?
def solve() -> int: cost_per_pizza = 5 price_per_pizza = 12 total_pizzas = 50 total_cost = cost_per_pizza * total_pizzas total_revenue = price_per_pizza * total_pizzas profit = total_revenue - total_cost result = profit return result
76 students were enrolled in the course at the start of the semester. The school then allowed each of the 76 students to enroll in one additional course. How many students are enrolled in the class now?
def solve() -> int: num_courses = 76 num_students = 76 new_num_courses = num_courses + num_students result = new_num_courses return result
Noah aims to consume 1500 calories or lesser every day. He had 300 calories for breakfast, 500 calories for lunch, and 550 calories for dinner. How much fewer calories can he consume to meet his goal?
def solve() -> int: breakfast = 300 lunch = 500 dinner = 550 daily_goal = 1500 total_calories = breakfast + lunch + dinner calories_left = daily_goal - total_calories result = calories_left return result
Kelly owns a flower shop with florists. 9 florists made 540 bouquets in 6 days. Kelly brought in 3 more florists. How many bouquets will all florists make in 9 days?
def solve() -> int: florists_initial = 9 bouquets_initial = 540 days_initial = 6 florists_added = 3 days_added = 9 bouquets_per_florist_per_day = bouquets_initial / (florists_initial * days_initial) total_florists = florists_initial + florists_added total_days = days_initial + ...
A construction worker can lay down 7 bricks on a wall per minute. How many bricks will he lay in 5 hours?
def solve() -> int: bricks_per_minute = 7 hours = 5 minutes = hours * 60 bricks = minutes * bricks_per_minute result = bricks return result
A candy jar has 100 pieces of candy. If 20% of the candy is taken out, how many pieces of candy are left in the jar?
def solve() -> int: total_candy = 100 percent_taken = 20 candy_taken = total_candy * (percent_taken / 100) remaining_candy = total_candy - candy_taken result = remaining_candy return result
There are 64 students in a class. They have to form groups of 4 for a project. How many groups can they form? How many students will be left without a group?
def solve() -> int: num_groups = 64 // 4 leftover_students = 64 % 4 result = (num_groups, leftover_students) return result
Tim has 10 pencils. Emily has 8 times as many pencils as Tim, but 9 fewer pencils than Andrew. How many pencils do they have altogether? Emma wants to buy her favorite cereal. At the grocery store, a 12-ounce box costs $2. At Costco, she can buy a 24-ounce box for $5. How much money does she save by buying in bulk?
def solve() -> int: tim_pencils = 10 emily_pencils = 8 * tim_pencils andrew_pencils = emily_pencils + 9 total_pencils = tim_pencils + emily_pencils + andrew_pencils emma_costco_price = 5 / 24 emma_grocery_price = 2 / 12 emma_savings = emma_grocery_price - emma_costco_price ...
Q5: Tom and Jerry went to the music store. Tom bought 2 guitars at $200 each, and Jerry bought 3 ukuleles at $120 each. How much do they spend in total?
def solve() -> int: guitar_num = 2 guitar_price = 200 ukulele_num = 3 ukulele_price = 120 tom_cost = guitar_num * guitar_price jerry_cost = ukulele_num * ukulele_price total_cost = tom_cost + jerry_cost result = total_cost return result
The length of a rectangle is twice the length of a smaller rectangle. The width of the larger rectangle is equal to the width of the smaller rectangle. If the area of the larger rectangle is 400, find the perimeter of the smaller rectangle.
def solve() -> int: area = 400 a = 1 b = 0 c = -400 width = (-b+(b**2-4*a*c)**0.5)/(2*a) length = 2*width perimeter = 2*(length+width) result = perimeter return result
Jamie is planning to go on a trip and needs to buy a new backpack that costs $80. He currently has $35 and can save $5 every day. In how many days will he have enough money to buy the backpack?
def solve() -> int: days = 0 savings = 35 while savings < 80: savings += 5 days += 1 result = days return result
A group of 5 students solved 805 math problems. John solved 64 more problems than Maya. Maya solved 29 less problems than Kevin. How many problems did John solve?
def solve() -> int: maya_problems = 0 kevin_problems = 0 john_problems = 0 kevin_problems = 805 maya_problems = kevin_problems - 29 john_problems = maya_problems + 64 result = john_problems return result
Dave is painting his living room wall. The wall has an area of 15 square meters, and he can paint 1 square meter in 10 minutes. He has 3 liters of paint, and each liter of paint can cover 5 square meters of wall. How much time will he spend painting the wall?
def solve() -> int: paint_needed = 15 / 5 paint_left = 3 - paint_needed area_left = paint_left * 5 time_spent = (15 - area_left) * 10 result = time_spent return result
After getting a 45% discount on a bike, Peter paid $135. How much money did Peter need to pay before the discounts?
def solve() -> int: discount = 0.45 discounted_price = 135 original_price = discounted_price / (1- discount) result = original_price return result
Maria and Juan went to the supermarket to buy groceries. Maria bought $60 worth of groceries, and Juan bought $90. They were told they could get a discount of 8% on Maria's purchase and 6% on Juan's. What is the total amount they will have to pay?
def solve() -> int: maria_purchase = 60 juan_purchase = 90 maria_discount = maria_purchase * 0.08 juan_discount = juan_purchase * 0.06 maria_total = maria_purchase - maria_discount juan_total = juan_purchase - juan_discount total_amount = maria_total + juan_total resu...
In a department store, there are eighteen employees. If four more employees are hired, the number of employees in the store will be five times the number of employees in the stockroom. How many employees are in the stockroom?
def solve() -> int: employees_dept_store = 18 employees_to_be_hired = 4 total_employees = employees_dept_store + employees_to_be_hired employees_stockroom = (total_employees - employees_dept_store) / 4 result = employees_stockroom return result
Ethan had 2 fewer comic books than graphic novels. He had 15 graphic novels and each comic book was worth $2.50. If Ethan sold all his books, how much money did he make in total?
def solve() -> int: graphic_novels = 15 comic_books = graphic_novels - 2 price_per_comic_book = 2.50 total_money = comic_books * price_per_comic_book result = total_money + (graphic_novels * price_per_comic_book) return result
A recipe calls for 3/4 cup of flour. If you want to make 2 batches of the recipe, how many cups of flour will you need in total?
def solve() -> int: cups_per_batch = 3/4 batches = 2 total_cups = cups_per_batch * batches result = total_cups return result
Lucas has 35 apples and 15 oranges. If he eats 10 apples and 2 oranges, how many fruits are left to be consumed?
def solve() -> int: apples = 35 oranges = 15 apples_eaten = 10 oranges_eaten = 2 apples_left = apples - apples_eaten oranges_left = oranges - oranges_eaten fruits_left = apples_left + oranges_left result = fruits_left return result
Sarah drives 12 miles to the mall. From the mall, she drives 16 miles to the cinema. From the cinema, she drives 14 miles straight to her house. How many additional miles did Sarah drive round trip to the mall, compared to a round trip without stopping at the mall?
def solve() -> int: miles_to_mall = 12 miles_to_cinema = 16 miles_to_house = 14 round_trip_no_mall = 2 * miles_to_cinema + 2 * miles_to_house round_trip_with_mall = 2 * miles_to_mall + 2 * miles_to_cinema + miles_to_house additional_miles = round_trip_with_mall - round_trip_no_mal...
George and Henry are shopping for a new laptop at the electronics store. The laptop costs $770 after a 10% discount. How much did the laptop originally cost before the discount?
def solve() -> int: discount = 0.1 costAfterDiscount = 770 costBeforeDiscount = costAfterDiscount/(1 - discount) result = costBeforeDiscount return result
A box of cereal contains 480 grams. If you eat a serving of the cereal which is 40 grams, how many servings are in the box?
def solve() -> int: box_weight = 480 serving_weight = 40 servings = box_weight/serving_weight result = servings return result
Sam had 25 pencils. He lost 5 pencils and gave 2 pencils to his friend. Then he found 4 pencils in his backpack and bought another 6 pencils in the store. How many pencils does Sam have in the end?
def solve() -> int: pencils = 25 pencils = pencils - 5 - 2 pencils = pencils + 4 + 6 result = pencils return result
A rectangular field has a width that is 16 feet less than twice the length, and the perimeter is 100 feet. What are the dimensions of the field?
def solve() -> int: perimeter = 100 width = (perimeter - 32) / 2 length = perimeter / 2 - width result = (length, width) return result
Student: A cup of coffee costs $2.50. If you buy 3 cups of coffee, you get a 10% discount. How much will you pay for 3 cups of coffee with the discount?
def solve() -> int: price_per_cup = 2.50 num_cups = 3 total_cost_without_discount = price_per_cup * num_cups discount_amount = total_cost_without_discount * 0.1 total_cost_with_discount = total_cost_without_discount - discount_amount result = total_cost_with_discount return result
A hand sanitizer costs $2 each, and a face mask costs $3 each. Albert bought 8 hand sanitizers and 5 face masks. How much did he spend altogether?
def solve() -> int: sanitizer = 8 sanitizer_cost = 2 sanitizer_total_cost = sanitizer * sanitizer_cost mask = 5 mask_cost = 3 mask_total_cost = mask * mask_cost total_cost = sanitizer_total_cost + mask_total_cost result = total_cost return result