question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
On a farm, there are 15 cows and 10 chickens. If each cow weighs twice as much as each chicken, and the total weight of all the cows and chickens is 3500kg, find the weight of one cow.
def solve() -> int: cows = 15 chickens = 10 total_weight = 3500 cow_weight = (total_weight - (chickens * 2)) / cows result = cow_weight return result
Jack received $600 and spent 1/6 of it and an additional $30 on a new skateboard. He then spent 2/3 of the remaining money and an additional $25 on some shoes. If he was left with $100, how much did he receive at first?
def solve() -> int: money_received = 600 money_spent_skateboard = money_received / 6 + 30 remaining_money_after_skateboard = money_received - money_spent_skateboard money_spent_shoes = (2/3) * remaining_money_after_skateboard + 25 remaining_money = remaining_money_after_skateboard - money_spent_shoe...
10. Steven needs to drive 545 miles. If his car can travel 24 miles per gallon, how many gallons of gasoline does he need?
def solve() -> int: miles = 545 miles_per_gallon = 24 result = miles / miles_per_gallon return result
Jessica and Mark are each making smoothies. Jessica has 2 cups of strawberries and 1 banana. Mark has 1 cup of strawberries and 2 bananas. If each cup of strawberries costs $1 and each banana costs $0.50, how much will it cost for both of them to make their smoothies?
def solve() -> int: jessica_strawberries = 2 jessica_bananas = 1 jessica_cost = jessica_strawberries * 1 + jessica_bananas * 0.5 mark_strawberries = 1 mark_bananas = 2 mark_cost = mark_strawberries * 1 + mark_bananas * 0.5 total_cost = jessica_cost + mark_cost result = total_cost ret...
In autumn, a farmer harvested apples from his orchard. He picked 3 times as many red apples as green apples. If he picked 24 green apples in total, how many apples did he pick in total?
def solve() -> int: green = 24 red = 3 * green total = green + red result = total return result
A store is having a 20% discount on all items for a week. If a shirt costs $25 without the discount, how much will it cost with the discount?
def solve() -> int: price = 25 discount = 0.2 discounted_price = price * (1 - discount) result = discounted_price return result
A candy store sold 4 times as many chocolates as it did lollipops, plus an additional 50 chocolates. If they sold 75 lollipops, how many chocolates did they sell?
def solve() -> int: lollipops_sold = 75 chocolates_sold = 4 * lollipops_sold + 50 result = chocolates_sold return result
Jack has 20 apples. He gives 4 apples to his friend Bob, and 3 apples to his sister Jill. He then buys 5 more apples for $0.5 each. How much money did Jack spend on the apples?
def solve() -> int: apples = 20 cost = 0 apples = apples - 4 apples = apples - 3 apples = apples + 5 cost = cost + 5 * 0.5 result = cost return result
There were 50 seats in a hall. 20 people left and 30 new people came in. There were now 2 times fewer people in the hall. How many people occupied these 50 seats before?
def solve() -> int: seats_hall = 50 people_hall = seats_hall people_hall -= 20 people_hall += 30 people_original = people_hall * 2 result = people_original + 20 return result
A regular hexagon has a side length of 5 cm. What is its perimeter?
def solve() -> int: side_length = 5 perimeter = side_length * 6 result = int(perimeter) return result
If Karen can knit a sweater in 5 days and crochet a blanket in 3 days, how long will it take her to knit 2 sweaters and crochet 4 blankets?
def solve() -> int: sweater_days = 5 blanket_days = 3 num_sweaters = 2 num_blankets = 4 total_sweater_time = sweater_days * num_sweaters total_blanket_time = blanket_days * num_blankets total_time = total_sweater_time + total_blanket_time result = total_time ...
Mike and Chris are employed at an automobile store, earning $14 per hour. Mike puts aside 2/5 of his salary, while Chris puts aside 3/5 of his salary. They both work 5 days a week, for 9 hours a day. How much money do they collectively save in eleven weeks?
def solve() -> int: salaryMike = 14 salaryChris = 14 savingsMike = salaryMike*0.2 savingsChris = salaryChris*0.3 numOfWeeks = 11 numOfHours = 5*9*numOfWeeks result = (savingsMike + savingsChris)*numOfHours return result
Student: Yusef bought a shirt that cost $50. This shirt came with free shipping so he got an additional $8 worth of discount. How much did he pay for the shirt?
def solve() -> int: cost = 50 discount = 8 final_price = cost - discount result = final_price return result
Tom is a fisherman. Every day he catches 4 fishes for himself and 3 for his wife. This last week he caught an additional 20 fishes for his daughter's birthday party. How many fishes did Tom catch for the week?
def solve() -> int: fishes_for_self = 4 fishes_for_wife = 3 additional_fishes = 20 total_fishes = (fishes_for_self + fishes_for_wife) * 7 + additional_fishes result = total_fishes return result
Mary has 12 apples, 7 oranges, and some bananas. She has 2 times as many apples as oranges and 3 times as many apples as bananas. How many bananas does she have?
def solve() -> int: apples = 12 oranges = 7 bananas = 0 apples = 2 * oranges apples = 3 * bananas bananas = apples / 3 result = bananas return result
Emily is navigating a city with a grid system. She goes 6 blocks north, then five times as many blocks east. Then she turns around and goes 9 blocks south and four times as many blocks west in the direction of her starting point. If Emily can walk 1.5 blocks/minute, how long will it take her to return to her starting p...
def solve() -> int: north = 6 east = 5 * north south = 9 west = 4 * north total_distance = north + south + east + west time = total_distance / 1.5 result = time return result
Ethan and Andrew need to read a book for their school assignment. If Ethan can complete the book in 15 days and Andrew takes three times longer, what is the average number of days for both to finish the book?
def solve() -> int: ethan_days = 15 andrew_days = ethan_days * 3 total_days = ethan_days + andrew_days average_days = total_days / 2 result = average_days return result
Student: Lucy wants to run a mile in 8 minutes. If she runs at a speed of 7.5 miles per hour, how many minutes will it take her to run a mile?
def solve() -> int: speed = 7.5 time = 1 / speed time = time * 60 result = time return result
A bakery made 340 muffins and sold half of them in the first week. In the second week they sold 1/4 of the remaining. How many muffins were left after two weeks?
def solve() -> int: muffins_start = 340 muffins_sold_first = muffins_start * 1/2 muffins_remaining = muffins_start - muffins_sold_first muffins_sold_second = muffins_remaining * 1/4 muffins_remaining -= muffins_sold_second result = muffins_remaining return result
==== Jonah bought a pack of 30 stickers and gave some to his friends. He used 4 stickers to decorate his notebook and 3 stickers to decorate his pencil case. If he has 12 stickers left, how many did he give to his friends?
def solve() -> int: pack = 30 used = 4 + 3 left = 12 given = pack - used - left result = given return result
A company's net income increased from $10 million to $20 million over the course of a year, representing a 100% increase in net income. However, its expenses rose from $5 million to $15 million, representing a 200% increase in expenses. Did the company's profit margin improve, decline or remain the same?
def solve() -> int: initial_net_income = 10 new_net_income = 20 initial_expenses = 5 new_expenses = 15 net_income_percent_increase = (new_net_income - initial_net_income) / initial_net_income expenses_percent_increase = (new_expenses - initial_expenses) / initial_expenses if net_income_perce...
Jackson wants to save $5000 for a trip in 8 months. How much money does he need to save each month to reach his goal?
def solve() -> int: savings_goal = 5000 months_to_save = 8 monthly_savings_needed = savings_goal / months_to_save result = monthly_savings_needed return result
Lily has 6 times as many flowers as Zack. Zack has 2 less flowers than Yara. Yara has 3 times as many flowers as Xander. If Xander has 4 flowers, how many flowers does Lily have?
def solve() -> int: xander = 4 yara = 3 * xander zack = yara - 2 lily = 6 * zack result = lily return result
At a zoo, the admission costs $15 for adults but it's $8 for seniors above 65 years old. If John takes his 2 grandparents and 3 of his friends to the zoo which opens at 9 A.M., how much will John pay for their admission?
def solve() -> int: adult_ticket_price = 15 senior_ticket_price = 8 num_adults = 1 num_seniors = 2 num_friends = 3 total_cost = (num_adults * adult_ticket_price) + (num_seniors * senior_ticket_price) + (num_friends * adult_ticket_price) result = total_cost return result
If the total number of light bulbs in the kitchen and foyer is 80 and a quarter of them are broken, how many are not broken?
def solve() -> int: total_bulbs = 80 broken_bulbs = total_bulbs/4 remaining_bulbs = total_bulbs - broken_bulbs result = remaining_bulbs return result
If a group of 7 people need 21 bottles of water for a day-long hike, how many bottles of water are needed for a group of 15 people?
def solve() -> int: num_of_people_1 = 7 num_of_water_bottles_1 = 21 num_of_people_2 = 15 num_of_water_bottles_2 = (num_of_people_2*num_of_water_bottles_1) / num_of_people_1 result = num_of_water_bottles_2 return result
Student: Kelly sells 12 lemonades on Monday and 18 lemonades on Tuesday. If the average number of lemonades she sells per day is 15, how many lemonades did she sell on Wednesday?
def solve() -> int: monday_sales = 12 tuesday_sales = 18 average_sales = 15 total_sales = monday_sales + tuesday_sales wednesday_sales = average_sales * 3 - total_sales result = wednesday_sales return result
John buys 400 pounds of flour and divides it into 20-pound bags. He shares 1/8 of the flour with his neighbor. He stores 3/5 of the remaining flour and keeps the rest on hand. How much flour does he keep on hand?
def solve() -> int: flour_bought = 400 bag_size = 20 flour_shared = flour_bought * (1/8) flour_remaining = flour_bought - flour_shared flour_stored = flour_remaining * (3/5) flour_kept = flour_remaining - flour_stored result = flour_kept return result
Sarah bought some vegetables for her kitchen. She bought 4 pounds of tomatoes and 9 pounds of carrots, for $32 total. If the tomatoes cost $2 per pound, how much do the carrots cost per pound?
def solve() -> int: tomatoes_pounds = 4 carrots_pounds = 9 total_cost = 32 tomatoes_cost_per_pound = 2 carrots_cost_per_pound = (total_cost - (tomatoes_pounds * tomatoes_cost_per_pound)) / carrots_pounds result = carrots_cost_per_pound return result
Alex has 4 more pencils than James. James has 10 pencils. How many pencils does Alex have?
def solve() -> int: james_pencils = 10 alex_pencils = james_pencils + 4 result = alex_pencils return result
Jerry needs to buy 30 books but can only buy them in boxes of 12. How many boxes will he need?
def solve() -> int: box_amount = 0 total_books = 0 while total_books < 30: box_amount += 1 total_books += 12 result = box_amount return result
Ben is taking a flight and wants to know which airline is fastest. One airline covers a distance of 1200 miles at an average speed of 400 MPH, while another airline covers a distance of 1500 miles at an average speed of 500 MPH. Which airline will get Ben to his destination faster?
def solve() -> int: distance_airline1 = 1200 speed_airline1 = 400 distance_airline2 = 1500 speed_airline2 = 500 time_airline1 = distance_airline1 / speed_airline1 time_airline2 = distance_airline2 / speed_airline2 if time_airline1 < time_airline2: result = "Airline 1" ...
An apple cost $1.25. How many apples can Bob buy with $20?
def solve() -> int: appleCost = 1.25 budget = 20 numOfApples = int(budget / appleCost) result = numOfApples return result
A rectangle has a width of 5 cm and an area of 60 cm^2. What is the length of the rectangle?
def solve() -> int: width = 5 area = 60 length = area / width result = length return result
If the school has 3 times as many desks as students and there are 96 students, how many desks are at the school?
def solve() -> int: number_of_students = 96 number_of_desks = number_of_students * 3 result = number_of_desks return result
Ray has a newly offered job at $22 every hour, working 40 hours per week. He predicts that 20% of his wage will be taken as taxes and other things. For 46 weeks of work every year, what is Ray's annual take-home pay?
def solve() -> int: hourly_wage = 22 hours_per_week = 40 weeks_per_year = 46 tax_percentage = 20 weekly_pay = hourly_wage * hours_per_week annual_pay = weekly_pay * weeks_per_year taxes = (annual_pay * tax_percentage) / 100 take_home_pay = annual_pay - taxes result = take_h...
A train travels 300 km in 5 hours. What is the average speed of the train?
def solve() -> int: distance = 300 time = 5 speed = distance / time result = speed return result
Student: If a pizza has a circumference of 30 cm, what is the diameter of the pizza?
def solve() -> int: circumference = 30 diameter = circumference / 3.14 result = diameter return result
Michael's garage is currently holding a dump truck, a tractor, a motorcycle, a skateboard, and two bicycles. How many wheels are in the garage?
def solve() -> int: dump_truck_wheels = 6 tractor_wheels = 4 motorcycle_wheels = 2 skateboard_wheels = 4 bicycle_wheels = 2 total_wheels = dump_truck_wheels + tractor_wheels + motorcycle_wheels + skateboard_wheels + (2 * bicycle_wheels) result = total_wheels return result
Anthony received a total of $30 as a gift. He spent a third of the money on coffee and the rest of it on books. How much money did Anthony spend on books?
def solve() -> int: amount_init = 30 amount_spent_coffee = amount_init / 3 amount_spent_books = amount_init - amount_spent_coffee result = amount_spent_books return result
-Sample solution (please look at it for the DO's and DON'Ts, the indentation is just for clarity and does not have to be exact same): Owen wants to buy a new bike that costs $300. He has saved $120 from his allowance and birthday money. He plans to sell some of his old toys for $5 each. How many toys does he need to se...
def solve() -> int: cost = 300 saved = 120 sell = 5 earn = cost - saved toys = earn // sell result = toys return result
san is making appetizers for her 8 friends for a game night. She made 3 pans of appetizers and each pan had 24 pieces. If each person ate 4 pieces, how many pieces were left?
def solve() -> int: pieces_per_pan = 24 pans = 3 total_pieces = pans * pieces_per_pan pieces_eaten_per_person = 4 total_pieces_eaten = pieces_eaten_per_person * 8 result = total_pieces - total_pieces_eaten return result
Sarah wants to read 100 pages of a book. She read only 25 pages on Monday and 50 pages on Tuesday. How many pages does she need to read on Wednesday to complete the book?
def solve() -> int: total_pages = 100 pages_read_monday = 25 pages_read_tuesday = 50 pages_left = total_pages - pages_read_monday - pages_read_tuesday pages_to_read_wednesday = pages_left result = pages_to_read_wednesday return result
Jack has a collection of 600 cards. 200 of them, Jack bought for $6 each. Of the rest, 10% were bought for $2. All others had a price of $1 each. How much did Jack spend on all the cards in his collection?
def solve() -> int: cards = 600 price_1 = 6 price_2 = 2 price_3 = 1 num_1 = 200 num_2 = cards - num_1 num_3 = num_2 * 10 / 100 num_4 = num_2 - num_3 total_1 = num_1 * price_1 total_2 = num_3 * price_2 total_3 = num_4 * price_3 total = total_1 + total_2 + total_3 resul...
A swimming pool is 20 meters long and 10 meters wide. It has a circular shallow end with a diameter of 5 meters. What is the area of the shallow end of the pool?
def solve() -> int: length = 20 width = 10 radius = 2.5 area_circle = 3.14 * radius ** 2 area_rectangular = length * width area_shallow_end = area_rectangular - area_circle result = area_shallow_end return result
How much money did Maria make this week if she was paid $8.90 per hour for 6 hours of work?
def solve() -> int: hourly_wage = 8.90 hours_worked = 6 total_payment = hourly_wage * hours_worked result = total_payment return result
A right-angled triangle has a height of 6 cm and a base of 8 cm. What is the length of the hypotenuse?
def solve() -> int: height = 6 base = 8 hypotenuse = (height ** 2 + base ** 2) ** 0.5 result = hypotenuse return result
After a rigorous swim, Mark had a cramp in his forearm. The pain went away after 1 day, however, he figured it would take 4 times that duration for it to totally heal. After that, he intended to wait 3 days before resuming swimming. How many weeks will he have to wait to begin a rigorous swim again if Mark wants to res...
def solve() -> int: one_day = 1 total_healing_duration = 4 * one_day additional_rest_duration = 4 * one_day swimming_resumption_duration = 3 * one_day total_rest_duration = total_healing_duration + swimming_resumption_duration + additional_rest_duration total_rest_weeks = total_rest_du...
and Tom together have 32 apples, if Sue has twice the amount Tom has, how many apples does Tom have?
def solve() -> int: total_apples = 32 apples_with_sue = 2 * total_apples / 3 apples_with_tom = total_apples - apples_with_sue result = apples_with_tom return result
Kevin and Brooke want to buy some new shoes. They go to the shoe store and see that the store is running a special buy one get one 50% off promotion. Kevin's shoes cost $70 and Brooke's cost $40. How much money will they spend?
def solve() -> int: price_a = 70 price_b = 40 discount = 0.5 total_cost = price_a + price_b*discount result = total_cost return result
A class has 25 students, but 3/5 of them are absent. How many students are present in the class?
def solve() -> int: students = 25 absent = students * 3/5 present = students - absent result = present return result
Rachel can read 60 pages an hour with glasses on and 50 pages an hour without glasses. She has to read a total of 120 pages and gets paid $10 per hour. How much does she make per hour?
def solve() -> int: glasses_reading_speed = 60 no_glasses_reading_speed = 50 total_pages = 120 hourly_pay = 10 glasses_reading_time = total_pages / glasses_reading_speed no_glasses_reading_time = total_pages / no_glasses_reading_speed total_reading_time = glasses_reading_time + no_...
A musician is paid by the hour and per performance. She earns $50 per hour and $200 per performance. She has to perform four times in the next 2 hours. She averages 2 performances in an hour. How much can she expect to earn per hour if she performs the entire time?
def solve() -> int: hourly_rate = 50 performance_rate = 200 total_hours = 2 total_performances = 4 average_performances_per_hour = 2 total_earnings = (hourly_rate * total_hours) + (performance_rate * total_performances) total_performances_in_2_hours = average_performances_per_hour * tot...
In a garage, there are 20 bikes. Each bike has 2 wheels and each wheel has 30 spokes. A mechanic removes 5 spokes from each wheel. How many spokes were removed from the garage?
def solve() -> int: bikes = 20 wheels_per_bike = 2 spokes_per_wheel = 30 spokes_removed_per_wheel = 5 total_wheels = bikes * wheels_per_bike total_spokes = total_wheels * spokes_per_wheel total_spokes_removed = total_wheels * spokes_removed_per_wheel result = total_spokes_remov...
Ben has 10 cherry trees and three times as many peach trees in his orchard as Kate. If Kate has four peach trees and six cherry trees, and they both have only cherry and peach trees in their orchards, how many more trees are in Ben's orchard than in Kate's?
def solve() -> int: ben_cherry = 10 ben_peach = 3 * 4 kate_cherry = 6 kate_peach = 4 ben_total = ben_cherry + ben_peach kate_total = kate_cherry + kate_peach difference = ben_total - kate_total result = difference return result
Jane has 9 flowers. She picks 3 more flowers, and then gives 4 flowers to her mother. She then plants 2 more flowers, and then cuts 3 flowers for a vase. She then waters the plant and sees 1 more flower grow. How many flowers does Jane have in the end?
def solve() -> int: flowers_total = 9 + 3 flowers_total = flowers_total - 4 - 3 flowers_total = flowers_total + 2 + 1 result = flowers_total return result
If a square has a perimeter of 32 cm, what is the length of each side?
def solve() -> int: perimeter = 32 side_length = perimeter / 4 result = side_length return result
A store gives a 20% discount on all items. If a shirt costs $30, how much will it cost with the discount?
def solve() -> int: original_price = 30 discount_percent = 20 discount_amount = original_price * (discount_percent / 100) final_price = original_price - discount_amount result = final_price return result
A company is producing 10,000 shirts. They need 2 yards of fabric for each shirt. If the fabric costs $5 per yard, how much will the company spend on fabric?
def solve() -> int: shirts = 10000 fabric_per_shirt = 2 cost_per_yard = 5 total_fabric = shirts * fabric_per_shirt total_cost = total_fabric * cost_per_yard result = total_cost return result
Student: A bookstore orders 100 books for $15 each and sells them for $20 each. How much profit does it make?
def solve() -> int: books = 100 cost = 15 sell = 20 total_cost = books * cost total_revenue = books * sell profit = total_revenue - total_cost result = profit return result
In a store, there are 160 products on sale. If the number of electronics is four times the number of clothing items, how many electronics are there?
def solve() -> int: num_products = 160 num_clothing = num_products / 5 num_electronics = 4 * num_clothing result = num_electronics return result
Paul's aunt is 10 times as old as Paul's parrot. If in 6 years, Paul's aunt will be 60 years, how old is Paul's parrot going to be in six years?
def solve() -> int: aunt_age = 60 - 6 parrot_age = aunt_age / 10 parrot_age_in_6_years = parrot_age + 6 result = parrot_age_in_6_years return result
If a taxi ride costs $4.50 per mile, how much will Emilio have to pay for a round trip to a conference that is 500 miles away from his home?
def solve() -> int: distance = 500 cost_per_mile = 4.50 round_trip_distance = distance * 2 total_cost = round_trip_distance * cost_per_mile result = total_cost return result
am and Alex are saving money for a trip. Sam saves $25 every week for 12 weeks. Alex saves $35 every week for 8 weeks. How much more money does Sam have than Alex after they finish saving?
def solve() -> int: sam_money = 25 * 12 alex_money = 35 * 8 money_diff = sam_money - alex_money result = f"Sam has ${money_diff} more than Alex after they finish saving." return result
A total of 100 apples was distributed to a group of people. If each person received 3 apples and there were still 7 apples left, how many people were there in the group?
def solve() -> int: total_apples = 100 apples_per_person = 3 remaining_apples = 7 total_people = (total_apples - remaining_apples) / apples_per_person result = total_people return result
Student: A music class has 30 students. If 1/3 of the students are taking piano lessons and the rest are taking guitar lessons, how many students are taking guitar lessons?
def solve() -> int: total_students = 30 piano_students = total_students / 3 guitar_students = total_students - piano_students result = guitar_students return result
A farmer has a rectangular field that measures 120 meters by 80 meters. He wants to divide the field into smaller square plots of equal size, such that each plot has a whole number of meters as its side length and there is no leftover space in the field. What is the largest possible side length of the square plots?
def solve() -> int: def gcd(a, b): while b!= 0: a, b = b, a % b return a gcd_length_width = gcd(120, 80) num_squares_length = 120 // gcd_length_width num_squares_width = 80 // gcd_length_width total_squares = num_squares_length * num_squares_width area_squ...
Ella and Noah are selling lemonade. They bought 6 liters of lemon juice for $18 and they can make 20 cups of lemonade from one liter of lemon juice. They also bought 2 kilograms of sugar for $4 and they use 50 grams of sugar for each cup of lemonade. They sell each cup of lemonade for $1. How much profit or loss do the...
def solve() -> int: lemon_juice_cost = 18 / (6 * 20) sugar_cost = 4 / (2 * 1000) * 50 cost_per_cup = lemon_juice_cost + sugar_cost revenue_per_cup = 1 profit_per_cup = revenue_per_cup - cost_per_cup total_profit = profit_per_cup * 6 * 20 result = total_profit ...
In a manufacturing plant, workers produced 150 units of a product every day. How many units were produced in a week and a half?
def solve() -> int: total_units = 0 daily_units = 150 days_in_week = 7 days_in_half_a_week = 3.5 total_units = (days_in_week * daily_units) + (days_in_half_a_week * daily_units) result = total_units return result
A painter charges $20 per hour plus a $50 fixed cost for a project. If the painter spends 8 hours on the project, how much will the customer pay for it?
def solve() -> int: hourly_rate = 20 fixed_cost = 50 total_hours = 8 total_cost = hourly_rate * total_hours + fixed_cost result = total_cost return result
Student: Emma shared 6 pizzas among 12 friends. Each pizza had 8 slices. She gave 2 slices to each friend, except for her best friend, who got 3 slices. How many slices of pizza were left?
def solve() -> int: pizzas = 6 friends = 12 slices_per_pizza = 8 total_slices = pizzas * slices_per_pizza slices_per_friend = 2 slices_best_friend = 3 total_slices_friends = (friends - 1) * slices_per_friend total_slices_all_friends = total_slices_friends + slices_best_friend slices_...
Student: A rectangular prism measures 10 meters in length, 5 meters in width, and 4 meters in height. What is the volume of the rectangular prism?
def solve() -> int: length = 10 width = 5 height = 4 volume = length * width * height result = volume return result
The daycare has 400 toys. If 60 toys were broken and 10 people donated 8 toys each, how many toys does the daycare have now?
def solve() -> int: toys = 400 broken_toys = 60 donors = 10 toys_donated_per_person = 8 toys -= broken_toys toys += donors * toys_donated_per_person result = toys return result
Leo had $900. He spent 1/9 of his money on a new watch, gave 1/6 of his money to his brother, used 1/12 of his money to buy a pizza, and invested the rest in a mutual fund. How much did Leo invest in the mutual fund?
def solve() -> int: leo_money = 900 watch_cost = leo_money * 1/9 brother_money = leo_money * 1/6 pizza_cost = leo_money * 1/12 leo_invest = leo_money - watch_cost - brother_money - pizza_cost result = leo_invest return result
``` A circular table has a diameter of 80 cm. What is its approximate circumference in meters?
def solve() -> int: pi = 3.14 diameter = 80 radius = diameter / 2 circumference = 2 * pi * radius/100 result = circumference return result
A pizza restaurant has 12 small tables and 6 large tables. If a small table seats 4 people and a large table seats 8 people, what is the maximum number of people that can be seated at once?
def solve() -> int: num_small_tables = 12 num_large_tables = 6 seats_per_small_table = 4 seats_per_large_table = 8 total_seats = num_small_tables * seats_per_small_table + num_large_tables * seats_per_large_table result = total_seats return result
Student: In a raffle ticket sale, the 4th graders earned $55 on Monday. On Tuesday, they earned $18 more than double their earnings from Monday. On Wednesday, they earned $31 more than their earnings on Monday. How much did they earn in three days?
def solve() -> int: monday = 55 tuesday = 18 + 2 * monday wednesday = 31 + monday total = monday + tuesday + wednesday result = total return result
Alex is participating in a charity event to carry books and wants to make sure that his backpack is not too heavy. The backpack can hold up to 20kg and he has 25 books to carry. Each book weighs 800g. How many books does Alex need to leave out of the backpack to stay within the weight limit?
def solve() -> int: books_to_carry = 25 weight_limit_kg = 20 book_weight_g = 800 total_weight_g = books_to_carry * book_weight_g total_weight_kg = total_weight_g / 1000 books_to_leave_out = (total_weight_kg - weight_limit_kg) / (book_weight_g / 1000) books_to_leave_out = round(book...
A box can hold 1500 cubic inches of items. If the box is 12 inches wide and 20 inches long, how deep is the box?
def solve() -> int: area_of_base = 12*20 depth = 1500/area_of_base result = depth return result
Helen has 3 cats and Sam has 8 cats. How many cats do Helen and Sam have together?
def solve() -> int: cats_helen = 3 cats_sam = 8 cats_together = cats_helen + cats_sam result = cats_together return result
John has $120. He wants to buy a book for $17 and a toy for $22. How much money will he have left?
def solve() -> int: money = 120 money -= (17 + 22) result = money return result
An employee works 8 hours a day and earns $15 per hour. If they work for 3 weeks, how much money will they earn?
def solve() -> int: hours_per_day = 8 hourly_wage = 15 weeks_worked = 3 total_hours = hours_per_day * 5 * weeks_worked total_wage = total_hours * hourly_wage result = total_wage return result
Student: Bill has to save 10% of his salary every month. If his salary is $900, how much money will he save in 8 months?
def solve() -> int: salary = 900 percentage = 0.1 saving = salary * percentage * 8 result = saving return result
A painter is working on a mural and is joined by a group of 9 assistants. Each assistant brings 2 buckets of paint with them. How many buckets of paint are used altogether? Maggie's Diner has 800 chicken strips required to serve 20 customers. How many chicken strips would be needed to serve 25% more customers?
def solve() -> int: num_assistants = 9 buckets_per_assistant = 2 total_buckets = num_assistants * buckets_per_assistant num_customers = 20 chicken_strips_per_customer = 800 / num_customers new_num_customers = num_customers * 1.25 new_num_strips = new_num_customers * chicken_strips_...
Q6. Jeff makes 25 baskets of apples in 5 hours. How many baskets of apples does he make in 8 hours?
def solve() -> int: baskets_in_5_hours = 25 hours_in_8_hours = 8 hours_in_5_hours = 5 result = (baskets_in_5_hours * hours_in_8_hours) / hours_in_5_hours return result
Student: A bike tire has a diameter of 40 centimeters. What is the circumference of the tire?
def solve() -> int: diameter = 40 radius = diameter / 2 pi = 3.14159 circumference = 2 * pi * radius result = circumference return result
Liam wants to finish his 700-page novel before the weekend so he can finally binge-watch his favorite TV show. He read 150 pages on Monday, 175 pages on Tuesday, and 200 pages on Wednesday. How many pages are left for him to read?
def solve() -> int: total_pages = 700 monday_pages = 150 tuesday_pages = 175 wednesday_pages = 200 total_read = monday_pages + tuesday_pages + wednesday_pages pages_left = total_pages - total_read result = pages_left return result
A triangle has a base of 8 cm and a height of 12 cm. What is the area of the triangle?
def solve() -> int: base = 8 height = 12 area = 0.5 * base * height result = area return result
A fruit store bought some oranges. During the first day, they sold 45% of their oranges. During the second day, they sold twice as many oranges as the previous day. On the third day it rained and they sold one sixth of the oranges from the second day. How many oranges did the store buy originally?
def solve() -> int: total_oranges = 0 oranges_sold_1 = total_oranges * 0.45 total_oranges -= oranges_sold_1 oranges_sold_2 = total_oranges * 2 total_oranges -= oranges_sold_2 oranges_sold_3 = total_oranges / 6 total_oranges -= oranges_sold_3 result = total_oranges return result
A family of three goes to the zoo. Each ticket costs $20. They buy a family pass for $60 that allows them to enter all the exhibits. They also rent a stroller for $15. They split a lunch that costs $30. If they split the bill evenly and they had $120 before entering the zoo, how much change do they receive?
def solve() -> int: num_people = 3 ticket_cost = 20 family_pass_cost = 60 stroller_cost = 15 lunch_cost = 30 total_cost = num_people * ticket_cost + family_pass_cost + stroller_cost + lunch_cost total_paid = 120 change = total_paid - total_cost result = change retu...
A restaurant bought 200 pounds of rice and serves each customer with 5 pounds. How many more pounds of rice should they serve to each customer?
def solve() -> int: rice_bought = 200 rice_per_customer = 5 extra_rice_per_customer = 0 extra_rice_per_customer = rice_bought % rice_per_customer result = extra_rice_per_customer return result
Yvonne has 17 coins that are all dimes, nickels and quarters. She has one fewer quarter than dimes and twice as many nickels as dimes. How many dimes does she have?
def solve() -> int: dimes = 17 // 3 quarters = 5 - 1 nickels = dimes * 2 coins = dimes + nickels + quarters result = dimes return result
-Separate each question by a blank line. Here are some possible questions and programs: Anna has 12 crayons in a box. She gives 3 of them to Bob and 2 of them to Claire. Then she buys a new box of crayons that has twice as many crayons as her original box. How many crayons does Anna have now?
def solve() -> int: crayons = 12 given_to_bob = 3 given_to_claire = 2 new_box_factor = 2 crayons_left = crayons - given_to_bob - given_to_claire crayons_new = new_box_factor * crayons crayons_total = crayons_left + crayons_new result = crayons_total return result
A box contains 24 red balls and 16 blue balls. If 8 balls are randomly drawn from the box, what is the probability that they are all red?
def solve() -> int: total_balls = 24 + 16 from math import comb total_ways = comb(total_balls, 8) red_ways = comb(24, 8) probability = red_ways / total_ways result = float(probability) return result
Olivia needs to buy a new phone. She has $600 saved up, but the phone she wants to buy costs $800. She decides to put the remaining balance on her credit card. After paying the initial $600, how much will she still owe before interest?
def solve() -> int: savings = 600 phone_cost = 800 remaining_balance = phone_cost - savings result = remaining_balance return result
A triangular field has a base of 10 meters and a height of 6 meters. A smaller triangular garden is located inside the field with a base of 4 meters and a height of 3 meters. What is the area of the field that is not covered by the garden?
def solve() -> int: field_base = 10 field_height = 6 garden_base = 4 garden_height = 3 field_area = 0.5 * field_base * field_height garden_area = 0.5 * garden_base * garden_height result = field_area - garden_area return result
If the cost of a book is $24.99 and it is on sale for 20% off, what is the sale price of the book?
def solve() -> int: cost_of_book = 24.99 discount_percentage = 0.20 discount_amount = cost_of_book * discount_percentage sale_price = cost_of_book - discount_amount result = sale_price return result
A store had a sale of 20% off. If a blouse originally costs $25, how much does it cost now?
def solve() -> int: price = 25 discount = price * 0.2 new_price = price - discount result = new_price return result
Robert had $16 and his buddy had $8. They went to a sandwich shop where they ordered 2 paninis for $6 each and a salad for $5. They also got 2 bottles of water for $1.50 each. The tax was $2.50. How much change should they have received in total?
def solve() -> int: robert_money = 16 buddy_money = 8 panini_price = 6 salad_price = 5 water_price = 1.50 tax = 2.50 total_cost = (2 * panini_price) + salad_price + (2 * water_price) + tax change = robert_money + buddy_money - total_cost result = change return result
Bob wants to buy a new bike. The bike he wants costs $300. Bob currently has $50 saved up and can save an additional $20 each week. In how many weeks will Bob have saved enough money to purchase the bike?
def solve() -> int: bike_cost = 300 current_savings = 50 savings_per_week = 20 weeks_to_save = (bike_cost - current_savings) / savings_per_week result = weeks_to_save return result