question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Marianna has 7 friends. Each of them brought her an apple. How many apples did she receive in total?
def solve() -> int: apples = 7 friends = 7 total = apples * friends result = total return result
If there are 15 cars and 6 bikes in a garage, and the cars have 2 more wheels than the bikes, while the bikes have 4 more pedals than the cars, how many wheels and pedals are there altogether?
def solve() -> int: cars = 15 bikes = 6 car_wheels = 2 + 2 bike_wheels = 2 car_pedals = 2 bike_pedals = 4 + 2 total_wheels = cars * car_wheels + bikes * bike_wheels total_pedals = cars * car_pedals + bikes * bike_pedals result = total_wheels + total_pedals return result...
Robert went to the fruit market and bought several baskets of apples. He gave away three baskets to his colleagues and then gave away one-fifth of the remaining baskets to his neighbors. If Robert has 10 baskets of apples left, how many baskets did he purchase originally?
def solve() -> int: baskets_purchased = 10 + 3 baskets_purchased *= 5 result = baskets_purchased return result
Student: A couple wants to save $20,000 for their wedding in 2 years. If they can save only $700 per month, how much more do they need to save to reach their goal?
def solve() -> int: goal = 20000 time = 2 monthly_saving = 700 total_saving = monthly_saving * 12 * time difference = goal - total_saving result = difference return result
Emma wants to buy some books from an online store. The store offers a 20% discount on orders of $100 or more, and a $10 coupon for orders of $50 or more. The shipping fee is $5 for orders of less than $25, and free for orders of $25 or more. Emma wants to buy 5 books that cost $12, $15, $18, $20, and $25. How much does...
def solve() -> int: subtotal = 12 + 15 + 18 + 20 + 25 discount = subtotal * 0.2 coupon = 10 savings = 0 if subtotal >= 100: savings = savings + discount if subtotal >= 50: savings = savings + coupon total_after_savings = subtotal - savings shipping_...
Alice and her three friends went to a pizza place. They ordered two large pizzas and four drinks. The pizzas cost $15 each and the drinks cost $2 each. They decided to split the bill evenly among themselves. How much did each of them pay?
def solve() -> int: pizza = 15 drink = 2 total = 2 * pizza + 4 * drink amount = total / 4 result = amount return result
Maria buys 15 pizzas. She eats 2 pizzas per day. Every 3 days, she invites her friends to eat a pizza with her. How many days will the pizzas last?
def solve() -> int: days = int((15-15/3)/(2+1/3)) result = f'<<<{days}>>>' result = days return result
-Use fake names, prices, and numbers for the new questions. Possible math questions are: Owen's family wanted to buy tickets for a musical show. The regular price for an adult ticket was $38 and the regular price for a child ticket was $20. However, if the family bought 4 or more tickets, they could get a 15% discount ...
def solve() -> int: adult_price = 38 child_price = 20 total_regular_price = 2 * adult_price + 3 * child_price discount_rate = 0.15 total_discounted_price = total_regular_price * (1 - discount_rate) money_saved = total_regular_price - total_discounted_price result = money_saved return res...
Tom can paint a wall with an area of 400 square meters in 3 hours. After he injured his right hand, his painting speed decreased by 30%. How much time will Tom take to paint a 700-square-meter wall now?
def solve() -> int: area_1 = 400 time_1 = 3 area_2 = 700 speed_ratio = 0.7 speed_1 = area_1 / time_1 speed_2 = speed_1 * speed_ratio time_2 = area_2 / speed_2 result = time_2 return result
Student: A can of soup weighs 15 ounces, and a bag of carrots weighs 8 ounces. If Leo buys 7 cans of soup and 5 times as many bags of carrots, how many pounds does he have to carry?
def solve() -> int: can_of_soup_weight = 15 bag_of_carrots_weight = 8 num_cans_of_soup = 7 num_bags_of_carrots = 5 * num_cans_of_soup can_of_soup_weight_in_pounds = can_of_soup_weight / 16 bag_of_carrots_weight_in_pounds = bag_of_carrots_weight / 16 total_weight_in_pounds = num_cans_of_sou...
The ratio of boys to girls in a class is 2:5. If there are 35 students in the class, how many are boys?
def solve() -> int: class_size = 35 boys_ratio = 2 girls_ratio = 5 total_ratio = boys_ratio + girls_ratio num_of_boys = (boys_ratio/total_ratio) * class_size result = num_of_boys return result
A water tank can be filled by one pipe in 4 hours, and the same pipe can also empty the filled tank in 6 hours. What is the time taken to fill the tank with both the pipes working simultaneously?
def solve() -> int: hours_fill = 4 hours_empty = 6 time_to_fill = (hours_fill * hours_empty) / (hours_fill + hours_empty) result = time_to_fill return result
If the train leaves the station with 2 cows, 4 goats, and 3 horses, and each station allows the train to offload 2 cows, 1 goat, and 2 horses, how many stations will the train have to travel through until it has no animals left on board?
def solve() -> int: nCows = 2 nGoats = 4 nHorses = 3 counter = 0 while (nCows > 0) or (nGoats > 0) or (nHorses > 0): nCows -= 2 nGoats -= 1 nHorses -= 2 if nCows < 0: nCows = 0 if nGoats < 0: nGoats = 0 if nHorses < 0: ...
A candy store sells 300 chocolates each day. The total number of chocolates sold in a month is the same as the number of pages that Emily reads in a month. What is the total number of pages that Emily reads in a month?
def solve() -> int: chocolates_per_day = 300 days_in_month = 30 chocolates_per_month = chocolates_per_day * days_in_month pages_read_per_month = chocolates_per_month result = pages_read_per_month return result
Kelly had 24 pencils which is 8 more than what Ryan had. If Kelly gave Ryan half of her pencils, how many pencils do they have in total now?
def solve() -> int: kelly = 24 ryan = kelly - 8 kelly = kelly // 2 ryan = ryan + kelly total = kelly + ryan result = total return result
A pizza has a diameter of 16 inches. What is the circumference of the pizza?
def solve() -> int: pi = 3.14 circumference = pi * 16 result = circumference return result
A rectangular garden is 8 meters longer than its width. If the perimeter is 64 meters, what are the dimensions of the garden?
def solve() -> int: width = (64 - 8) / 2 length = width + 8 result = f'<<<The dimensions of the garden are {width} meters by {length} meters.>>>' return result
Student: Jack has a rectangular garden that measures 10 meters by 6 meters. He wants to plant flowers along the edges of the garden, leaving 1 meter of space between the flowers and the fence. He can plant one flower every 0.2 meters. How many flowers does he need to buy?
def solve() -> int: length = 10 width = 6 space = 1 flower_distance = 0.2 total_length = 2 * (length + width) total_length_with_space = total_length - (2 * space) total_flowers = total_length_with_space / flower_distance total_flowers = round(total_flowers) result = total_flowers ...
A rectangular box measures 8 inches by 6 inches by 4 inches. What is the volume in cubic feet?
def solve() -> int: volume_inches = 8 * 6 * 4 volume_feet = volume_inches / 12**3 result = round(volume_feet, 3) return result
For his son's birthday, Henry bought 4 packs of candy costing $5.25 each and 2 packs of potato chips for $3.00 each. How much did he spend in total?
def solve() -> int: price_candy = 5.25 price_potato_chips = 3 total_price_candy = 4 * price_candy total_price_potato_chips = 2 * price_potato_chips total_cost = total_price_candy + total_price_potato_chips result = total_cost return result
If the number of chairs in a room was originally three times the number of tables before 25 new chairs were added and now there are twice as many chairs as tables, how many tables were in the room to begin with if there are 50 chairs now?
def solve() -> int: chairs_now = 50 tables = (chairs_now - 25) / 2 chairs_original = 3 * tables result = tables return result
Bethany sets aside $75 per week in her Christmas savings account. She had $2,500 in her account on January 1. At the end of the year, she receives a holiday bonus that is worth 50% more than her account balance. What is the total amount of money in her Christmas savings account after receiving the bonus?
def solve() -> int: weekly_savings = 75 initial_balance = 2500 total_savings = weekly_savings * 52 final_balance = initial_balance + total_savings bonus = final_balance * 1.5 total_amount = final_balance + bonus result = total_amount return result
A cell phone plan costs $30 per month plus $0.02 per text message. If a person sends 150 text messages per month, what is the total cost of the plan?
def solve() -> int: texts_per_month = 150 cost_of_texts = 0.02 * texts_per_month monthly_cost = 30 total_cost = monthly_cost + cost_of_texts result = total_cost return result
Olivia is knitting a scarf. It takes her 20 minutes to cast on the stitches, and 2/5 of that time to begin the pattern. It takes her 30 minutes to finish the pattern, three times as long to weave in the ends, and 1/6th the combined finishing and weaving time to block the scarf. How many minutes does Olivia spend on the...
def solve() -> int: cast_on_time = 20 begin_pattern_time = (2/5) * cast_on_time finish_pattern_time = 30 weave_in_ends_time = 3 * finish_pattern_time block_scarf_time = (1/6) * (finish_pattern_time + weave_in_ends_time) total_time = cast_on_time + begin_pattern_time + finish_pattern_time + ...
Kevin has a pyramid with base edge length of 14cm and a height of 11cm. What is the volume of the pyramid?
def solve() -> int: base_edge = 14 height = 11 volume = (base_edge * base_edge * height) / 3 result = volume return result
A train travels at a speed of 60 mph. If the distance between two cities is 140 miles, how long will the journey take?
def solve() -> int: distance = 140 speed = 60 time_taken = distance / speed result = time_taken return result
A furniture store offers a 20% discount on all furniture items. If a sofa costs $500 before the discount, what is the final cost of the sofa?
def solve() -> int: original_price = 500 discount_rate = 0.2 discount_amount = original_price * discount_rate final_price = original_price - discount_amount result = final_price return result
A box of wine bottles is 2 feet high, 3 feet wide, and 4 feet long. How many bottles of wine can fit in this box if each bottle has a volume of 200 cubic inches?
def solve() -> int: height = 24 width = 36 length = 48 bottle_volume = 200 box_volume = height * width * length num_bottles = box_volume // bottle_volume result = num_bottles return result
The perimeter of a rectangle is 64 cm. If the length of the rectangle is 8 cm, what is the width?
def solve() -> int: peri = 64 length = 8 result = peri - length*2 return result
Leo has 21 coins in his piggy bank. His sister, Mia, has three times as many coins as Leo. How many coins do Leo and Mia have together?
def solve() -> int: leo_coins = 21 mia_coins = leo_coins * 3 total_coins = leo_coins + mia_coins result = total_coins return result
Brian buys 3 packs of gum at $1.50 each and 2 packs of candy at $2.00 each. If he pays with a $10 bill, how much change will he get back?
def solve() -> int: num_gum_packs = 3 gum_pack_price = 1.5 num_candy_packs = 2 candy_pack_price = 2 amount_paid = 10 total_cost = num_gum_packs * gum_pack_price + num_candy_packs * candy_pack_price change = amount_paid - total_cost result = change return result
One pack of crayons costs $1.50 each, and one coloring book costs $3 each. Rachel buys four packs of crayons and two coloring books. How much does Rachel spend altogether?
def solve() -> int: num_crayon_packs = 4 crayon_pack_cost = 1.5 num_coloring_books = 2 coloring_book_cost = 3 total_cost = (num_crayon_packs * crayon_pack_cost) + (num_coloring_books * coloring_book_cost) result = total_cost return result
Different shapes of candy were bought at the store. The number of circles are 94. The number of squares is 1/2 the number of circles. How many squares were bought?
def solve() -> int: answer = 94 answer *= 0.5 result = answer return result
John has three times the number of pencils as Mark. Mark has 5 pencils less than double the number of pencils that Jane has. If Jane has 12 pencils, how many pencils does John have?
def solve() -> int: jane_pencils = 12 mark_pencils = (2*jane_pencils) - 5 john_pencils = 3*mark_pencils result = john_pencils return result
Student: Dylan has 4 times as many cards as Stella. Together they have 260 cards. How many cards does Dylan have?
def solve() -> int: total_cards = 260 stella_cards = total_cards / 5 dylan_cards = 4 * stella_cards result = dylan_cards return result
Student: On a day trip, Ricky drove for 8 hours at an average speed of 55 miles per hour. Vikram drove for 9 hours at 50 miles per hour. How much faster was Ricky driving than Vikram?
def solve() -> int: ricky_speed = 55 ricky_time = 8 vikram_speed = 50 vikram_time = 9 ricky_distance = ricky_speed * ricky_time vikram_distance = vikram_speed * vikram_time difference = ricky_distance - vikram_distance result = difference return result
An art store is offering a 25% discount on all purchases. If a customer buys a painting worth $500, how much money will he save?
def solve() -> int: discounted_price = 500 * 0.75 money_saved = 500 - discounted_price result = round(money_saved, 2) return result
Last season, Alexia scored 30 points in basketball, but this season she can only score one-third the number of points as last season. If Alexia wants to score twice the number of points next season, and the cost of playing one game is $5, how much would Alexia spend on the games?
def solve() -> int: last_season_points = 30 this_season_points = last_season_points / 3 next_season_points = this_season_points * 2 cost_per_game = 5 total_cost = next_season_points * cost_per_game result = total_cost return result
Henry collects 150 cards from his favorite game. He trades 30 cards with his brother for some rare ones. He then sells half of the cards he has left to a store for some money. How many cards does Henry have left?
def solve() -> int: cards_after_trade = 150 - 30 cards_sold = cards_after_trade / 2 cards_left = cards_after_trade - cards_sold result = cards_left return result
Student: If 8 workers can complete a project in 12 days, how many days would it take for 12 workers to complete the same project?
def solve() -> int: workers = 12 days = 12 days_for_12_workers = days * (workers/8) result = days_for_12_workers return result
ophia is studying for a science quiz. She can study 4 pages in 20 minutes and 3 pages in 15 minutes. If the quiz is 20 pages long, how long will it take her to finish studying?
def solve() -> int: pages_per_min1 = 4/20 pages_per_min2 = 3/15 total_pages = 20 time = (total_pages - 3)/pages_per_min1 + 3/pages_per_min2 result = time return result
A car travels 80 km in 2 hours. What is its speed in km per hour?
def solve() -> int: distance_travelled = 80 time_taken = 2 speed = distance_travelled / time_taken result = speed return result
Mark has 500 dollars and he wants to buy a new bike that costs 150 dollars. How many dollars will he have left after buying the bike?
def solve() -> int: mark_money = 500 bike_cost = 150 left_money = mark_money - bike_cost result = left_money return result
Fred bought a dozen donuts that cost $9. If he ate 3 donuts, how much did he spend on the donuts he ate?
def solve() -> int: num_donuts_total = 12 price_total = 9 num_eaten = 3 price_eaten = price_total / num_donuts_total * num_eaten result = price_eaten return result
If 40% of Jasmine's salary is $200, what is her salary?
def solve() -> int: percent = 0.4 amount = 200 salary = amount / percent result = salary return result
A cafeteria uses 4 bags of flour to prepare 50 loaves of bread. If they need to prepare 200 loaves of bread, how many bags of flour will they need?
def solve() -> int: flour_for_50_loaves = 4 flour_for_1_loaf = flour_for_50_loaves / 50 flour_for_200_loaves = flour_for_1_loaf * 200 result = flour_for_200_loaves return result
If the equation of a parabola is y = 2x^2 + 3x - 4, what are the values of x when y = 0?
def solve() -> int: a = 2 b = 3 c = -4 x1 = (-b + (b**2 - 4*a*c)**(1/2))/(2*a) x2 = (-b - (b**2 - 4*a*c)**(1/2))/(2*a) result = (x1,x2) return result
Student: Logan travels to work on his bike every day for 5 miles. Calculate the total distance he would have travelled to work in 47 weeks.
def solve() -> int: distance_per_day = 5 number_of_weeks = 47 total_distance = distance_per_day * number_of_weeks * 7 result = total_distance return result
Evan is planning to purchase a new video game console for $450. He already saved $125 and plans to sell his car for $350 to raise the rest of the money. How much money will Evan have left after purchasing the console?
def solve() -> int: console = 450 saved = 125 car_selling = 350 total_amount = saved + car_selling remaining_cost = console - total_amount result = remaining_cost return result
A ladder is 25 feet long and leans against a wall with the top of the ladder being 15 feet high. How far is the bottom of the ladder from the wall?
def solve() -> int: distance_from_wall = ((25 ** 2) - (15 ** 2)) ** 0.5 result = distance_from_wall return result
Violet went to the store and bought 10 postcards and 12 note cards. Each postcard cost $0.20 and each note card cost $0.30. How much money did she spend?
def solve() -> int: postcards = 10 note_cards = 12 cost_postcard = 0.20 cost_note_card = 0.30 total_cost = postcards*cost_postcard + note_cards*cost_note_card result = 3.40 return result
Student: Emilia went out for lunch with some friends. She bought a wrap for $7.50, a salad for $9.75, and a smoothie for $3. How much money did Emilia spend in total?
def solve() -> int: wrap = 7.50 salad = 9.75 smoothie = 3 total = wrap + salad + smoothie result = total return result
Amy and Ryan painted pictures for their art class. Amy painted 7 pictures and Ryan painted 3 more pictures than Amy. Each picture used 15 milliliters of paint. How much paint did they use altogether?
def solve() -> int: amy = 7 ryan = amy + 3 paint = 15 used = (amy + ryan) * paint result = used return result
A company made a profit of $250,000 last year. If the company had expenses of $150,000, how much did the company earn in revenue?
def solve() -> int: profit = 250000 expenses = 150000 revenue = profit + expenses result = revenue return result
Ethan and Chloe played a card game where points were awarded for winning a round. If Ethan had scored 1000 points and Chloe 1/3 times as many points as Ethan, what is Chloe's current score?
def solve() -> int: ethan_score = 1000 chloe_score = ethan_score * (1/3) result = chloe_score return result
A truck needs to drive from Town C to Town D, 428 miles away. It can go at a rate of 48 miles per hour for six hours, after which it needs to take a break. After the break, it can drive at 32 miles per hour for 8 hours. How much time will it take for the truck to reach Town D?
def solve() -> int: distance = 428 speed1 = 48 time1 = 6 speed2 = 32 time2 = 8 distance1 = speed1 * time1 distance2 = speed2 * time2 total_distance = distance1 + distance2 total_time = time1 + time2 speed = total_distance/total_time result = speed ...
If the diagonals of a rhombus are 20 inches and 16 inches, what is the perimeter of the rhombus in inches?
def solve() -> int: diagonal_1 = 20 diagonal_2 = 16 side_length = ((diagonal_1/2) ** 2 + (diagonal_2/2) ** 2) ** 0.5 perimeter = 4 * side_length result = perimeter return result
Jeff has $200; Sarah has $95; and Tina has $70. Jeff owes Sarah $35. Sarah owes Tina $10. Tina owes Jeff $20. When all debts are paid, how much will Tina and Jeff have together in dollars?
def solve() -> int: jeff_money = 200 sarah_money = 95 tina_money = 70 jeff_owes_sarah = 35 sarah_owes_tina = 10 tina_owes_jeff = 20 jeff_money -= jeff_owes_sarah sarah_money += jeff_owes_sarah sarah_money -= sarah_owes_tina tina_money += sarah_owes_tina ti...
Student: On the sidewalk, Larry made 10 chalk drawings. His sister, Mitchelle, made 2/5 as many drawings as Larry. How many more chalk drawings did Larry make than Mitchelle?
def solve() -> int: larry_drawings = 10 mitchelle_drawings = 2/5 * larry_drawings difference = larry_drawings - mitchelle_drawings result = difference return result
If Liam bought 2 books and 3 notebooks for $18, and each notebook costs $1 less than each book, how much did one book cost?
def solve() -> int: book_price = 0 notebook_price = 0 book_quantity = 2 notebook_quantity = 3 total_cost = 18 book_price = (total_cost - (notebook_quantity * (book_price - 1))) / book_quantity book_price = (total_cost - (notebook_quantity * (book_price - 1))) / book_quantity ...
Mary is painting a wall. The wall is 12 feet long, 8 feet high, and 0.5 feet thick. She needs to apply two coats of paint, and each gallon of paint can cover 350 square feet. If she buys a 5-gallon can of paint, how many square feet will be left unpainted after she finishes the job?
def solve() -> int: surface_area = 2 * (12*8) + 2 * (0.5 * 8) + 2 * (0.5 * 12) total_area = surface_area * 2 paint_needed = total_area * 2 / 350 leftover = (5 * 350) - paint_needed result = leftover return result
A family's monthly expenses for rent, groceries and utilities are $600, $400 and $200, respectively. If they want to save $500 every month, what should be their combined monthly income?
def solve() -> int: savings = 500 rent = 600 groceries = 400 utilities = 200 total_monthly_expenses = rent + groceries + utilities monthly_income = savings + total_monthly_expenses result = monthly_income return result
A rectangular field measures 100m by 80m and has a circular pond with a diameter of 20m in the middle. What is the total area of the land? Assume that the pond takes up the entire center of the field and does not overlap with any part of the edges.
def solve() -> int: length = 100 width = 80 pond_radius = 20 / 2 rectangular_area = length * width pond_area = 3.14 * (pond_radius ** 2) total_area = rectangular_area - pond_area result = total_area return result
Possible questions and programs: Lena wants to buy a new bicycle that costs $180. She has saved $75 from her allowance and plans to earn the rest by doing chores for her neighbors. She can get $5 for washing a car, $3 for mowing a lawn, and $2 for walking a dog. How many cars, lawns, and dogs does she need to wash, mow...
def solve() -> int: money_needed = 180 - 75 cars = 0 lawns = 0 dogs = 0 found = False while cars <= money_needed // 5: while lawns <= money_needed // 3: while dogs <= money_needed // 2: money_earned = cars * 5 + lawns * 3 + dogs * 2 if money_earned =...
The legal age to enter a casino is 21 years old in some states. If Danielle is half the age of her mother, who is 42 years old, in how many years will Danielle be allowed to enter a casino?
def solve() -> int: mother_age = 42 danielle_age = mother_age / 2 legal_age = 21 years_to_enter_casino = legal_age - danielle_age result = years_to_enter_casino return result
Sara is making a bracelet with beads. She needs 15 beads of each color: red, blue, and yellow. She has 8 red beads, 10 blue beads, and 12 yellow beads. She buys more beads for $0.10 each. How much does she spend on buying more beads?
def solve() -> int: red = 8 blue = 10 yellow = 12 target = 15 price = 0.1 red_needed = target - red blue_needed = target - blue yellow_needed = target - yellow total_needed = red_needed + blue_needed + yellow_needed money_spent = total_needed * price result = money_spent ...
Rita is baking cookies for a party. She has 10 cups of flour and needs 2.5 cups of flour for each batch of cookies. She also has 8 eggs and needs 2 eggs for each batch of cookies. How many batches of cookies can Rita bake with what she has?
def solve() -> int: batches_by_flour = 10 / 2.5 batches_by_eggs = 8 / 2 batches = min(batches_by_flour, batches_by_eggs) result = batches return result
Question5: Annie needs to buy a mattress for her bed that is 1.5m by 2m. The mattress costs $40 per square meter. She needs to hire a professional to move the bed, the professional charges $50 for transportation. How much will the mattress and transportation cost her?
def solve() -> int: total_cost=0 size_of_mattress=1.5*2 cost_per_sqm=40 transport_cost=50 hours_of_work=1 cost_of_mattress=size_of_mattress*cost_per_sqm total_cost = cost_of_mattress + transport_cost * hours_of_work result = total_cost return result
A bus travels at a speed of 55 miles per hour. How far will it go in 3 hours?
def solve() -> int: speed = 55 time = 3 distance = speed*time result = distance return result
A company's revenue increased by 15% from year 1 to year 2, and then decreased by 10% from year 2 to year 3. If the revenue for year 1 was $100,000, what was the revenue for year 3?
def solve() -> int: revenue_year1 = 100000 increase = 0.15 decrease = 0.1 revenue_year2 = revenue_year1*(1+increase) revenue_year3 = revenue_year2*(1-decrease) result = round(revenue_year3, 2) return result
A park covers 100 meters by 100 meters. If it costs $20 per square meter to plant grass, how much does it cost to plant grass in the park?
def solve() -> int: width = 100 length = 100 cost_per_square_meter = 20 total_cost = width * length * cost_per_square_meter result = total_cost return result
Marco is buying flowers for his girlfriend. The florist charges $10 for a single rose or $25 for a bouquet of 3 roses. Each rose also has a delivery fee of $2. If Marco wants to send 9 roses to his girlfriend, how much money does he save by buying the bouquets instead of the single roses?
def solve() -> int: cost_by_one = (10 + 2) * 9 cost_by_bouquet = (25 + 2) * 3 difference = cost_by_one - cost_by_bouquet result = difference return result
In a school cafeteria, 3/5 of the students eat pizza and 1/4 of the students eat salad. If there are 500 students and all of them eat either pizza or salad or both, what percent of the students eat both pizza and salad?
def solve() -> int: total_students = 500 num_pizza = total_students * 3/5 num_salad = total_students * 1/4 num_both = num_pizza + num_salad - total_students percent_both = (num_both / total_students) * 100 result = percent_both return result
Student: A restaurant has 8 tables, each of which can seat up to 4 customers. The restaurant currently has 15 customers. If the restaurant wants to be able to seat 32 customers, how many more tables will they need, and how much will it cost to buy them? The supplier charges $100 per table.
def solve() -> int: tables = 8 capacity = 4 customers = 15 target = 32 price = 100 seats = tables * capacity needed_seats = target - customers needed_tables = (needed_seats + capacity - 1) // capacity cost = needed_tables * price result = (needed_tables, cost) retu...
Nathan and Chloe are solving math problems. If Nathan solved 20 problems and Chloe solved 3/5 times as many problems as Nathan, how many problems did Chloe solve?
def solve() -> int: nathan_problems = 20 chloe_problems = (3/5) * nathan_problems result = chloe_problems return result
6. Meghan is twice as old as Zara now. Six years ago, Meghan was four times as old as Zara. How old are Meghan and Zara now?
def solve() -> int: age_difference = 6 meghan_age_six_years_ago = 8 zara_age_six_years_ago = meghan_age_six_years_ago/4 meghan_current_age = meghan_age_six_years_ago + age_difference zara_current_age = zara_age_six_years_ago + age_difference result = "Meghan is " + str(meghan_current_age) + " an...
A farmer sells eggs for $4 per dozen and milk for $3 per gallon. If he sells 20 dozen eggs and 15 gallons of milk in a week, how much does he earn in total?
def solve() -> int: egg_price = 4 milk_price = 3 total_income = egg_price * 20 + milk_price * 15 result = total_income return result
Student: Lily has $30. She spends $5 on a hairbrush, saves $10 from her allowance, and gives $2 to charity. How much money does Lily have left?
def solve() -> int: money = 30 money -= 5 money += 10 money -= 2 result = money return result
Lily sells lemonade for 2 dollars per cup. She buys a gallon of lemon juice for 6 dollars and a bag of sugar for 3 dollars. She can make 16 cups of lemonade from one gallon of lemon juice and 2 cups of sugar. Today, Lily sells 12 cups of lemonade and spills 4 cups of lemonade. How much money does Lily lose from the spi...
def solve() -> int: price = 2 juice_cost = 6 sugar_cost = 3 juice_cup = 16 sugar_cup = 2 sold = 12 spilled = 4 juice_cost_per_cup = juice_cost / juice_cup sugar_cost_per_cup = sugar_cost / sugar_cup ingredient_cost_per_cup = juice_cost_per_cup + sugar_cost_per_cup ...
The cost of transporting 75 barrels of oil, each weighing 200 kgs, is $7500. What's the cost of transporting twice as many barrels of water, each weighing 2/5 times as many kgs?
def solve() -> int: oil_barrels = 75 oil_weight = 200 oil_cost = 7500 water_barrels = 2 * oil_barrels water_weight = (2/5) * oil_weight water_cost = (water_barrels * water_weight * oil_cost) / (oil_barrels * oil_weight) result = water_cost * water_barrels return result
At the arcade, you have $25 to spend. You spend $5 on skee-ball, $3 on a candy bar, and 1/3 of what's left on a game of air hockey. How much money do you have left?
def solve() -> int: skee_ball_price = 5 candy_price = 3 air_hockey_fraction = 1/3 total_money = 25 result = total_money return result
Alice bought 150 feet of a ribbon and divided it equally into 3 parts. She used only 1 part of the ribbon. What amount of ribbon did she not use?
def solve() -> int: ribbon_length = 150 parts = 3 used_parts = 1 part_length = ribbon_length / parts unused_length = part_length * (parts - used_parts) result = unused_length return result
John is taking a programming course that lasts for 12 weeks. The course consists of 1 five-hour class and 2 four-hour classes each week. In addition, John must spend 6 hours each week working on assignments. How many hours will he spend on this course?
def solve() -> int: weeks = 12 five_hour_class = 1 four_hour_class = 2 assignment_hours = 6 class_hours_per_week = five_hour_class * 5 + four_hour_class * 4 total_hours_per_week = class_hours_per_week + assignment_hours total_hours = total_hours_per_week * weeks result = total_...
Jenny buys 3 donuts a day. She buys a glazed donut for $1.25 every morning and a chocolate donut for $1.50 in the afternoon. How much money will Jenny spend on donuts in a week if there are 6 days?
def solve() -> int: donuts_per_day = 3 glazed_cost = 1.25 chocolate_cost = 1.50 days_in_week = 6 glazed_total = donuts_per_day * glazed_cost * days_in_week chocolate_total = donuts_per_day * chocolate_cost * days_in_week total_cost = glazed_total + chocolate_tot...
In a local library, there were 50,000 books in 2010. In 2020, there were 70,000 books. What is the average number of books added each year?
def solve() -> int: books_in_2010 = 50000 books_in_2020 = 70000 years = 2020 - 2010 books_added = books_in_2020 - books_in_2010 average_books_added_per_year = books_added / years result = average_books_added_per_year return result
Mark has 6 fish tanks. The first three tanks need 12 gallons of water each and the other three need 4 fewer gallons of water each than the first three tanks. If Mark needs to change the water in the tanks every two weeks, how many gallons of water will he need in 8 weeks?
def solve() -> int: tank1 = 12 tank2 = 12 tank3 = 12 tank4 = tank1 - 4 tank5 = tank2 - 4 tank6 = tank3 - 4 total_gallons = (tank1 + tank2 + tank3 + tank4 + tank5 + tank6) * 2 water_needed = total_gallons * 4 result = water_needed return result
Student: Alex has 80 marbles. He gave half of his marbles to his sister and then gave 12 marbles to his friend. He then took the remaining marbles and divided them into 5 equal groups. How many marbles are in each group?
def solve() -> int: marbles = 80 marbles_sister = marbles / 2 marbles_friend = 12 marbles_remaining = marbles - marbles_sister - marbles_friend marbles_each_group = marbles_remaining / 5 result = marbles_each_group return result
In a school, 70% of the students are boys. If there are 900 students in the school, how many girls are there?
def solve() -> int: total = 900 boys_percentage = 70 boys_count = total * boys_percentage / 100 girls_count = total - boys_count result = f'There are {girls_count} girls in the school' result = girls_count return result
A restaurant has 3 different sized pizza options: small, medium, and large. They also have 5 different toppings to choose from. If a customer can only choose 1 size and 2 toppings, how many different order combinations are possible?
def solve() -> int: pizza_sizes = 3 topping_options = 5 order_combinations = pizza_sizes * (topping_options * (topping_options - 1)) result = order_combinations return result
Ron and Harry are tennis players. Ron has five times as many wins as Harry. If they have 55 wins combined, how many wins does Ron have?
def solve() -> int: harry_wins = 1 ron_wins = 5 * harry_wins total_wins = harry_wins + ron_wins ron_wins = total_wins / 2 result = ron_wins return result
A rectangular swimming pool is 20 meters long and 12 meters wide. If the pool is filled with water up to a height of 2 meters, what is the volume of water in the pool?
def solve() -> int: length = 20 width = 12 height = 2 volume = length * width * height result = volume return result
What is 35% of 80?
def solve() -> int: percentage = 35 number = 80 result = number * (percentage/100) return result
A company produces 2000 widgets. If they want to pack the widgets in boxes of 50, how many boxes will they need?
def solve() -> int: total_widgets = 2000 widgets_per_box = 50 boxes_needed = total_widgets/widgets_per_box result = boxes_needed return result
Student: A flower shop has 8 lilies and 10 tulips. What is the ratio of lilies to tulips?
def solve() -> int: lilies = 8 tulips = 10 ratio = lilies / tulips result = ratio return result
David sold 29.5 items in a day. He made $114.90 in total. What is the total cost of each item he sold?
def solve() -> int: no_of_items = 29.5 total_amount = 114.90 cost_per_item = total_amount/no_of_items result = cost_per_item return result
How many cubes with a side length of 4 cm will fit inside a box with a volume of 64 cm³?
def solve() -> int: v = 64 l = 4 result = v/(l**3) return result
Isabel has a set of hair accessories including 20 hair clips, 15 hair bands and 10 hair ties. She sold 5 hair clips for $0.8 each and 10 hair bands for $0.5 each. What price should she set for each hair tie to earn a total of $20 from the whole sale?
def solve() -> int: hair_clips = 20 hair_bands = 15 hair_ties = 10 sold_clips = 5 price_clips = 0.8 total_clips = sold_clips * price_clips sold_bands = 10 price_bands = 0.5 total_bands = sold_bands * price_bands total_earned = total_clips + total_bands + 20 pri...
John's vehicle gets 20 miles per gallon (MPG). If he drives 120 miles, how many gallons of fuel does he use?
def solve() -> int: MPG = 20 miles_driven = 120 gallons_used = miles_driven/MPG result = gallons_used return result
A family has 5 children and they all get the same amount of money. The total amount of money the family has is $100. How much money does each child get?
def solve() -> int: totalMoney = 100 numberOfChildren = 5 result = totalMoney // numberOfChildren return result
Ava is sewing curtains. She needs to make 8 curtains with 10 hooks each, and 14 curtains with 12 hooks each. If Ava charges $2 per hook, how much will her client have to pay for the curtains?
def solve() -> int: curtains_8 = 8 curtains_14 = 14 hooks_per_curtain_8 = 10 hooks_per_curtain_14 = 12 price_per_hook = 2 total_hooks_8 = curtains_8 * hooks_per_curtain_8 total_hooks_14 = curtains_14 * hooks_per_curtain_14 total_hooks = total_hooks_8 + total_hooks_14 total_...