question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
At the bakery, there are 4 dozen cupcakes that are equally divided between 4 flavors. How many cupcakes of each flavor are there?
def solve() -> int: total_cupcakes = 4 * 12 num_flavors = 4 cupcakes_each_flavor = total_cupcakes / num_flavors result = cupcakes_each_flavor return result
A factory produced 5000 units of product A and 7000 units of product B. If product A costs $10 per unit and product B costs $8 per unit, what is the total cost of the products?
def solve() -> int: units_A = 5000 cost_A = 10 units_B = 7000 cost_B = 8 total_cost = (units_A * cost_A) + (units_B * cost_B) result = total_cost return result
Student: Henry goes to the gas station to fill his car's gas tank. He fills 15 gallons of gas for $45. How much does he pay per gallon of gas?
def solve() -> int: gallons = 15 price = 45 per_gallon = price / gallons result = per_gallon return result
David can mow 12 lawns in one day, it takes him 7 hours to do this task. If he has only 35 hours in one week to work, how many lawns can he mow in total?
def solve() -> int: lawns_per_day = 12 hours_per_day = 7 hours_per_week = 35 lawn_rate = lawns_per_day / hours_per_day lawns_per_week = lawn_rate * hours_per_week result = lawns_per_week return result
Alan bought three boxes of chocolates worth $3, $5, and $7, respectively. If he paid $18 in total, how much change will he receive from a $20 bill?
def solve() -> int: total_price = 3 + 5 + 7 change = 20 - total_price result = change return result
There are 30 students in the classroom. If 20% of the boys and 30% of the girls likes to play basketball, how many boys and girls likes to play basketball?
def solve() -> int: total_students = 30 boys_percentage = 0.5 girls_percentage = 0.5 boys_liking_basketball = total_students * boys_percentage * 0.2 girls_liking_basketball = total_students * girls_percentage * 0.3 result = (boys_liking_basketball, girls_liking_basketball) return result
How much will a family save in taxes if their income in the current year drops by 25% from the previous year?
def solve() -> int: income_last_year = 1000 income_current_year = income_last_year * 0.75 tax_last_year = income_last_year * 0.20 tax_current_year = income_current_year * 0.20 savings_on_tax = tax_last_year - tax_current_year result = savings_on_tax return result
Jeff drives to his friend's house and back. On his way there, he drives at an average speed of 60 km/h and takes 40 minutes. On his way back, he drives at an average speed of 50 km/h and takes 48 minutes. How far is Jeff's friend's house from his own?
def solve() -> int: speed_there = 60 speed_back = 50 time_there = 40 time_back = 48 distance_there = speed_there * time_there / 60 distance_back = speed_back * time_back / 60 result = distance_there return result
A clothing store offers a 10% discount on all items costing over $50. If a customer buys 3 items that each cost $60, how much will they pay?
def solve() -> int: discounted_price = (60*3 - (60*3 - 50)*0.1) result = discounted_price return result
A rectangle has a perimeter of 30 cm and a length of 7 cm. What is the width of the rectangle?
def solve() -> int: perimeter = 30 length = 7 width = (perimeter / 2) - length result = width return result
ven is making a smoothie. He uses 2/3 cup of milk for every 1/4 cup of strawberries. If he has 5 cups of milk, how many cups of strawberries does he need?
def solve() -> int: milk = 5 milk_per_straw = 2/3 / 1/4 straw = milk / milk_per_straw result = straw return result
Gary has 75 marbles. He gives away 5 marbles each day and buys 15 new marbles every week. How many marbles will Gary have after 4 weeks?
def solve() -> int: marbles = 75 weeks = 4 givenaway = 5 * 7 * weeks bought = 15 * weeks marbles = marbles + bought - givenaway result = marbles return result
A rectangle has a length of 10 units and a width of 5 units. What is the perimeter of the rectangle?
def solve() -> int: length = 10 width = 5 perimeter = 2*length + 2*width result = perimeter return result
A football team ran the ball 240 yards on 40 carries. What was the average number of yards gained per carry?
def solve() -> int: yards = 240 carry = 40 total_yards = yards/carry result = total_yards return result
Ethan has 50 marbles. If 8 marbles are blue, 24 marbles are yellow, and the rest are green, what percentage of marbles are green?
def solve() -> int: blue_marbles = 8 yellow_marbles = 24 green_marbles = 50 - blue_marbles - yellow_marbles percentage_green = (green_marbles/50)*100 result = percentage_green return result
A school is holding a fundraiser and needs to sell 1000 raffle tickets. Each ticket costs $5. How much money will they raise if they sell all the tickets?
def solve() -> int: tickets_sold = 1000 ticket_price = 5 total_money_raised = tickets_sold * ticket_price result = total_money_raised return result
Student: A recipe calls for 2/3 cups of sugar for every 2 cups of flour. How much sugar is needed if you use 8 cups of flour?
def solve() -> int: flour = 8 sugar = 0 ratio = 2/3 sugar = flour * ratio / 2 result = sugar return result
Robert has $400 and wants to save up for a trip that costs $550. He plans to save $20 each week by doing odd jobs. How many weeks will it take him to save enough for the trip?
def solve() -> int: savings = 400 cost = 550 weekly_savings = 20 weeks_needed = (cost - savings) // weekly_savings + 1 result = weeks_needed return result
Rachel goes to the gym thrice a week for one hour every day. If her gym session lasts for two hours due to a new workout plan, how many hours does she work out every week?
def solve() -> int: days_per_week = 3 old_session_length = 1 new_session_length = 2 old_total_time = days_per_week * old_session_length new_total_time = days_per_week * new_session_length time_difference = new_total_time - old_total_time total_workout_time = old_total_tim...
Student: Sandy has 87 candies, and she distributed these in equal numbers of students of her two classes. Calculate the number of candies each student will get if each class has 30 students.
def solve() -> int: candies = 87 classes = 2 students = 30 candies_per_class = candies // classes candies_per_student = candies_per_class // students result = candies_per_student return result
Julie is purchasing a new backpack. The backpack costs $50, but there is a 20% discount applicable. With tax, the final cost comes out to be $43.20. What is the tax rate on the backpack?
def solve() -> int: discounted_price = 50 - (0.2*50) final_price = 43.20 tax_amount = final_price - discounted_price tax_rate = tax_amount/discounted_price result = tax_rate return result
Jenna's grocery bill was $90. She got a 15% discount with a coupon. How much money did she save?
def solve() -> int: original_bill = 90 discount = 90 * 0.15 amount_saved = discount result = amount_saved return result
A store sells umbrellas for $12 each and raincoats for $35 each. If a customer spent $98 on 3 umbrellas and some raincoats, how many raincoats did the customer buy?
def solve() -> int: total_spent = 98 num_umbrellas = 3 umbrella_price = 12 raincoat_price = 35 total_umbrella_cost = num_umbrellas * umbrella_price raincoat_cost = total_spent - total_umbrella_cost num_raincoats = raincoat_cost / raincoat_price result = num_raincoats return result
John spends 20% of his income on food, 30% on rent and 10% on transportation. If his monthly income is $3000, how much money does he spend on food and transportation together?
def solve() -> int: income = 3000 food_percentage = 0.2 rent_percentage = 0.3 transportation_percentage = 0.1 food_expense = income * food_percentage transportation_expense = income * transportation_percentage total_expense = food_expense + transportation_expense result = ...
Student: Claire is carpeting her room with square carpets. She has a room that is 8 meters long and 5 meters wide. How many square meters of carpet does Claire need to buy?
def solve() -> int: length = 8 width = 5 area = length * width result = area return result
A family of four went to a zoo. The admission fee for an adult was $15 and for a child was $10. The family also bought two bags of popcorn for $3 each and four bottles of water for $2 each. How much did the family spend at the zoo?
def solve() -> int: admission_fee = 2 * 15 + 2 * 10 popcorn_cost = 2 * 3 water_cost = 4 * 2 total_cost = admission_fee + popcorn_cost + water_cost result = total_cost return result
In a pencil case, there are pens in 4 colors. Inside, there are 18 black pens. There are six times as many blue pens as black pens. Green pens make up 25% of the blue pens. How many pens of a different color are in the case if the total of all pens in the case is seven times more than the number of green pens?
def solve() -> int: black_pens = 18 blue_pens = 6 * black_pens green_pens = 0.25 * blue_pens total_pens = 7 * green_pens different_color_pens = total_pens - (black_pens + blue_pens + green_pens) result = different_color_pens return result
A school talent show sold 100 tickets for $5 each and 50 t-shirts for $10 each. They used all the money to buy new stage lights that cost $500. How much money did they raise from the talent show?
def solve() -> int: num_of_tickets = 100 price_of_ticket = 5 num_of_tshirts = 50 price_of_tshirt = 10 cost_of_lights = 500 total_money = (num_of_tickets * price_of_ticket) + (num_of_tshirts * price_of_tshirt) result = total_money return result
Student: Walt has completed a certain number of tasks each day for the past 5 days. He has completed one more task each day than he had the day before. How many tasks has Walt completed by the end of the 5th day?
def solve() -> int: tasks_day_1 = 1 tasks_day_2 = tasks_day_1 + 1 tasks_day_3 = tasks_day_2 + 1 tasks_day_4 = tasks_day_3 + 1 tasks_day_5 = tasks_day_4 + 1 result = tasks_day_1 + tasks_day_2 + tasks_day_3 + tasks_day_4 + tasks_day_5 return result
A retailer introduces a new product and sells 100 items within the first week. If the demand for the product increases by 35% every week, how many items will be sold after 1 month?
def solve() -> int: week1_sales = 100 demand_increase = 0.35 weeks_in_month = 4 week2_sales = week1_sales + (week1_sales * demand_increase) week3_sales = week2_sales + (week2_sales * demand_increase) week4_sales = week3_sales + (week3_sales * demand_increase) total_sales = week1_sa...
A sphere has a radius of 8 cm. What is its volume? What is its surface area?
def solve() -> int: radius = 8 pi = 3.14159 volume = 4/3 * pi * radius**3 surface_area = 4 * pi * radius**2 result = surface_area return result
Angela and her mom have 12 apples, if Angela's mom slices the apples into 6 equal pieces, how many pieces of apples are left?
def solve() -> int: total_pieces = 12*6 remaining_pieces = total_pieces - (12 + 1) result = remaining_pieces return result
8 friends are splitting a hotel room for a weekend stay. The total cost for the weekend is $,480. If each person splits the bill evenly, how much will each person pay?
def solve() -> int: num_of_friends = 8 total_cost = 480 result = total_cost/num_of_friends return result
Yuki is creating a jacket from fabric she purchased from a store. The total fabric for the jacket cost her $105. If the sales tax is 6.4%, how much money in total did Yuki pay for the fabric?
def solve() -> int: cost_fabric = 105 sales_tax = 0.064 total_cost = cost_fabric + cost_fabric*sales_tax result = total_cost return result
John wants to buy a new phone for himself. There are 3 options, costing $300, $500 and $700. If he wants to spend $2500 at the most and chooses to buy 2 of the $500 phones, 1 of the $300 phone, and 3 of the $700 phone, how much money does he have left?
def solve() -> int: phone1 = 300 phone2 = 500 phone3 = 700 quantity_phone1 = 1 quantity_phone2 = 2 quantity_phone3 = 3 total_cost = (phone1 * quantity_phone1) + (phone2 * quantity_phone2) + (phone3 * quantity_phone3) money_left = 2500 - total_cost result = money_l...
There are 8 dogs at the animal shelter, 6 of them are puppies. What percent of the dogs are puppies?
def solve() -> int: total_dogs = 8 puppy_dogs = 6 ratio = puppy_dogs/total_dogs percent_puppy_dogs = ratio * 100 result = percent_puppy_dogs return result
Student: A bus ticket costs $3 for a single ride, or $25 for a monthly pass. If you use the bus twice a day on weekdays, how much do you save in a month by buying the pass instead of paying for each ride?
def solve() -> int: ticket_price = 3 pass_price = 25 rides_per_day = 2 weekdays_per_month = 20 total_cost_per_ride = ticket_price * rides_per_day * weekdays_per_month savings = total_cost_per_ride - pass_price result = savings return result
Maxamillian wants to buy 60 boxes of candy for his birthday party. A box of candy contains 10 pieces, and each piece costs 2 cents. How much will it cost Maxamillian for all the boxes?
def solve() -> int: total_price = 0 number_of_boxes = 60 pieces_per_box = 10 price_per_piece = 0.02 total_price = number_of_boxes * pieces_per_box * price_per_piece result = total_price return result
Student: You have a jug that holds 2 liters of water. If you pour out 1/4 of the jug, how many liters of water are left in the jug?
def solve() -> int: jug_capacity = 2 water_poured_out = jug_capacity * 0.25 water_left = jug_capacity - water_poured_out result = water_left return result
A family went to a restaurant for dinner. If the father paid $45, the mother paid $35, and the two children together paid $20, how much was the total bill?
def solve() -> int: total_bill = 45 + 35 + 20 result = total_bill return result
James's coach tells him to practice basketball for 2 hours each day for a total of $20. He does this for June, except for the 3 Mondays in June. Afterwards, he spends $80 on video games and gives his friend Jack half of that amount. How much money does James have left?
def solve() -> int: hours_per_day = 2 days_in_June = 30 mondays_in_June = 3 total_hours_practiced = (days_in_June - mondays_in_June) * hours_per_day total_cost = 20 money_spent_on_video_games = 80 money_given_to_Jack = money_spent_on_video_games / 2 money_left = total_cost - (m...
Student: A movie theater has a total of 100 seats. If 70 of them are already taken, how many seats are left?
def solve() -> int: total_seats = 100 taken_seats = 70 seats_left = total_seats - taken_seats result = seats_left return result
Possible new questions: Sophia sells 15 bracelets and 12 necklaces every week. A bracelet costs $8 and a necklace costs $12. She also pays 15 percent of her total earnings in taxes. How much is her total earning every week?
def solve() -> int: revenue = 15 * 8 + 12 * 12 tax = revenue * 0.15 earning = revenue - tax result = earning return result
Ethan wants to buy a new bicycle for $250. He has been saving his allowance of $20 for the last 8 weeks. He also did some yard work for his neighbors and earned $75. After buying the bicycle, he has $35 left. How much did he earn for each yard work?
def solve() -> int: allowance_per_week = 20 weeks_saving = 8 total_allowance = allowance_per_week * weeks_saving yard_work_earnings = 75 bicycle_cost = 250 remaining_money = 35 total_earnings = total_allowance + yard_work_earnings yard_work_earnings = total_earnings - bicy...
Maria loves to bake cupcakes and sell them to her friends. She spends $10 on ingredients for every batch of 12 cupcakes. She sells each cupcake for $2. She wants to save up for a new bike that costs $150. How many batches of cupcakes does she need to bake and sell to reach her goal?
def solve() -> int: cost_per_batch = 10 price_per_cupcake = 2 goal = 150 profit_per_batch = (price_per_cupcake * 12) - cost_per_batch batches_needed = goal / profit_per_batch batches_needed = int(batches_needed) + 1 result = batches_needed return result
Ryan has 10 fish in his aquarium. After six months, he has twice as many fish as he started with. If each fish eats 2 pellets of food per day, how many pellets does Ryan need to feed his fish in a week?
def solve() -> int: fish_in_aquarium = 10 months_passed = 6 fish_after_months = fish_in_aquarium * 2 pellets_per_fish_per_day = 2 days_in_a_week = 7 pellets_per_week = fish_after_months * pellets_per_fish_per_day * days_in_a_week result = pellets_per_week return result
Student: John wants to paint a wall that is 12 feet tall and 10 feet wide. If a gallon of paint can cover 100 square feet, how many gallons of paint does he need to buy?
def solve() -> int: wall_height = 12 wall_width = 10 paint_coverage = 100 wall_area = wall_height * wall_width paint_needed = wall_area / paint_coverage result = paint_needed return result
In a factory, the average production rate for a machine is 50 units per hour, for a second machine is 75 units per hour and for a third machine is 100 units per hour. What is the overall average production rate for all the machines?
def solve() -> int: machine1_rate = 50 machine2_rate = 75 machine3_rate = 100 total_rate = machine1_rate + machine2_rate + machine3_rate average_rate = total_rate / 3 result = average_rate return result
A school has 360 students and 12 classes. Each class has the same number of students. The school wants to divide the students into groups of 3 for a project. How many groups will there be in total?
def solve() -> int: students = 360 classes = 12 students_per_class = students / classes groups_per_class = students_per_class / 3 groups = groups_per_class * classes result = groups return result
A car travels 72 km in an hour. How many minutes does it take to travel 90 km?
def solve() -> int: speed = 72 distance = 90 time_in_hours = distance / speed time_in_minutes = time_in_hours * 60 result = f'The car will take {round(time_in_minutes)} minutes to travel 90 km.' result = round(time_in_minutes) return result
If a chef can cook 6 dishes in an hour, how many dishes can they cook in a week if they work for 9 hours a day from Monday to Friday?
def solve() -> int: dishes_per_hour = 6 hours_per_day = 9 days_per_week = 5 dishes_per_week = dishes_per_hour * hours_per_day * days_per_week result = dishes_per_week return result
Brian has 70 stickers. Sabrina has half as many stickers as Brian. Tim has 15 more stickers than Sabrina. How many stickers do they have altogether?
def solve() -> int: stickers_brian = 70 stickers_sabrina = stickers_brian / 2 stickers_tim = stickers_sabrina + 15 total_stickers = stickers_brian + stickers_sabrina + stickers_tim result = total_stickers return result
Four chefs were comparing their recipe time based on their dish. They found out that Maria takes 2 hours less than Susan while Susan takes 5 hours less than Dave. Then, Joel takes 2 hours less than Dave. How much less time in hours does Maria take compared to Joel?
def solve() -> int: maria_time = 0 susan_time = 0 dave_time = 0 joel_time = 0 dave_time = 5 susan_time = dave_time - 5 susan_time = 2 maria_time = susan_time - 2 joel_time = dave_time - 2 difference = joel_time - maria_time result = difference ret...
If the queen's eggs have hatched 10500 bees in total, and the queen loses 900 each day, how long will it take for the hive to have no bees left?
def solve() -> int: bees_count = 10500 lost_bees = 900 day_count = 0 while bees_count > 0: bees_count -= lost_bees day_count += 1 result = day_count return result
A company produces 5000 units of product A and 3000 units of product B. If the profit margin for A is 20% and the profit margin for B is 10%, what is the company's total profit?
def solve() -> int: units_a = 5000 units_b = 3000 profit_margin_a = 0.2 profit_margin_b = 0.1 revenue_a = units_a * 50 revenue_b = units_b * 30 profit_a = revenue_a * profit_margin_a profit_b = revenue_b * profit_margin_b total_profit = profit_a + profit_b result = total_profit ...
Justin ordered 2 gallons of chocolate ice cream for his birthday party. He used 3/10 of the ice cream for ice cream sundaes, 1/4 of the ice cream for chocolate shakes, and 1/5 of the ice cream for ice cream cake. How much ice cream was left over?
def solve() -> int: gallons_ordered = 2 sundaes = 3/10 * gallons_ordered shakes = 1/4 * gallons_ordered cake = 1/5 * gallons_ordered leftover = gallons_ordered - (sundaes + shakes + cake) result = leftover return result
A company had a revenue of $50,000 in the first quarter of the year. If the revenue for the second quarter decreased by 10%, what was the revenue for the second quarter?
def solve() -> int: first_quarter_revenue = 50000 decrease_percent = 10 decrease_factor = 1 - decrease_percent/100 second_quarter_revenue = first_quarter_revenue * decrease_factor result = second_quarter_revenue return result
Student: A group of students collected 540 cans of food for a charity drive. If each box can hold 24 cans, how many boxes are needed to pack the cans?
def solve() -> int: cans = 540 cans_per_box = 24 boxes = cans // cans_per_box result = boxes return result
Vanessa had two types of battery packages: one with 8 AA batteries and the other with 6 AAA batteries. What is the total number of batteries Vanessa had?
def solve() -> int: AA_pack = 8 AAA_pack= 6 total_batteries = AA_pack + AAA_pack result = total_batteries return result
Tom buys 20 different kinds of plants, and he plants them in his garden. After the first-year growth, he realizes that 5 of the species didn't survive. He then plants two times more of the survived plants the next year and sells them to the locals. If each plant sold for $10, what is his total earnings, and how much mo...
def solve() -> int: num_bought = 20 num_died = 5 num_survived = num_bought - num_died num_after_growth = num_survived * 2 total_earnings = num_after_growth * 10 amount_spent = num_bought * 5 difference = total_earnings - amount_spent result = difference...
Joe has a pencil that's half as long as Jane's pencil. If their pencils combined length is 14 inches, how long is Joe's pencil?
def solve() -> int: jane_pencil_length = 14 * 2 / 3 joe_pencil_length = jane_pencil_length / 2 result = joe_pencil_length return result
Two doctors, Grace and Alex, work for different hospitals. In 2020, Alex made $25,000 more than Grace. In 2021, Grace's earnings increased by 15% while Alex's earnings increased by 20%. If Alex earned $150,000 in 2020, find the total earnings of the two doctors in 2021.
def solve() -> int: Graces_2020_earnings = 150000 - 25000 Alexs_2020_earnings = 150000 Graces_2021_earnings = (Graces_2020_earnings*0.15)+Graces_2020_earnings Alexs_2021_earnings = (Alexs_2020_earnings*0.20)+Alexs_2020_earnings total_earnings = Graces_2021_earnings + Alexs_2021_earnings result =...
Carson can do a hollow hold for 30 seconds without taking a break. She can hold it for 20% longer if she has a 10-second rest halfway through. Furthermore, ankle weights give her another 10%. If Carson can hold the hollow hold for 36 seconds with ankle weights for 30 seconds without them, how long could she hold it wit...
def solve() -> int: rest_time = 10 hollow_hold_time = 30 hollow_hold_with_rest = hollow_hold_time + (hollow_hold_time * 0.2) hollow_hold_with_weights = 36 hollow_hold_without_rest = hollow_hold_with_weights - (rest_time * 2) result = hollow_hold_without_rest return result...
Sarah wants to buy a new refrigerator that costs $900. She noticed that the appliance store offers a 10% discount on all appliances priced over $800. How much money can Sarah save by buying the refrigerator during the discount period?
def solve() -> int: price = 900 discount = 0.10 if price > 800: savings = price * discount else: savings = 0 result = savings return result
Mike is playing basketball, for 2 hours each day. He decided to increase his time spent on playing basketball weekly, by 3 hours. How much time does Mike want to spend during one week on playing basketball?
def solve() -> int: hours_per_day = 2 increase_per_week = 3 days_per_week = 7 total_hours_per_week = hours_per_day * days_per_week + increase_per_week result = total_hours_per_week return result
A truck can carry 20 boxes. If a company needs to transport 240 boxes, how many truckloads are required?
def solve() -> int: boxes_per_truck = 20 num_boxes = 240 num_trucks = num_boxes // boxes_per_truck + (1 if num_boxes % boxes_per_truck!= 0 else 0) result = num_trucks return result
Mary wants to make a quilt that has a square pattern of 5 rows and 5 columns. Each square is 8 inches by 8 inches. She needs to add a border of 2 inches around the quilt. What is the area of the quilt?
def solve() -> int: squares = 5 * 5 square_area = 8 * 8 quilt_area = squares * square_area perimeter = 2 * (5 * 8) + 2 * (5 * 8) border_width = 2 border_area = perimeter * border_width area = quilt_area + border_area result = area return result
Alice can knit a scarf 50% faster than her mother. If her mother takes 3 hours to knit a scarf, how long would it take Alice to knit 6 scarves?
def solve() -> int: alice_speed = 1.5 alice_time = 3 / alice_speed alice_total = alice_time * 6 result = alice_total return result
A group of 9 friends decided to have a barbecue. They will need 4 hot dogs and 3 hamburgers for each person. If they have a total of 33 hot dogs and hamburgers, how many people will attend the barbecue?
def solve() -> int: total_food = 33 hotdogs_per_person = 4 hamburgers_per_person = 3 total_per_person = hotdogs_per_person + hamburgers_per_person num_of_people = total_food // total_per_person result = num_of_people return result
George has to spend 1 hour and 20 minutes at the gym. If he spends 35 minutes on the treadmill and 25 minutes lifting weights, how much time does he have left to use the other equipment at the gym?
def solve() -> int: hours = 1 minutes = 20 time_spent = 35 + 25 time_left = (hours*60 + minutes) - time_spent result = time_left return result
Jake is four times older than Cole and Cole is five years older than Jake's daughter. If Jake is 36 years old, how old is his daughter?
def solve() -> int: jake = 36 cole = jake / 4 daughter = cole - 5 result = daughter return result
A factory produces 5000 bolts per hour. How many bolts can be produced in a 6-hour shift?
def solve() -> int: bolts_per_hour = 5000 hours_worked = 6 total_bolts_produced = bolts_per_hour * hours_worked result = total_bolts_produced return result
Student: Emil is making lunch boxes for a picnic. He needs to make 9 boxes and each box contains 4 sandwiches. How many sandwiches does Emil need to make?
def solve() -> int: num_boxes = 9 num_sandwiches_per_box = 4 total_num_sandwiches = num_boxes * num_sandwiches_per_box result = total_num_sandwiches return result
On the planet Neptune, there are 75 scientists. One-quarter of them have never conducted an experiment. How many scientists on Neptune have conducted an experiment?
def solve() -> int: total_scientists = 75 never_conducted = total_scientists / 4 conducted = total_scientists - never_conducted result = conducted return result
-A farmer grows 1200 kg of wheat in 15 days. How many kg of wheat does he grow in one hour?
def solve() -> int: rate = 1200 / 15 rate = rate / 24 result = rate * 1 return result
Jack bought a box of chocolates with 42 pieces inside. If he wants to give 7 chocolates to each of his 5 friends, how many chocolates will Jack have left over?
def solve() -> int: total_pieces = 42 pieces_per_friend = 7 no_of_friends = 5 total_pieces_given = pieces_per_friend * no_of_friends remaining_pieces = total_pieces - total_pieces_given result = remaining_pieces return result
Student: Every 8 seconds, a marble falls from a pipe, and every 12 seconds, a coin falls from another pipe. How many marbles and coins will fall in 3 minutes, and what is their total value if each marble is worth 5 cents and each coin is worth 10 cents?
def solve() -> int: marble_time = 8 coin_time = 12 total_time = 3 * 60 marble_value = 0.05 coin_value = 0.1 marble_count = total_time // marble_time coin_count = total_time // coin_time total_value = marble_count * marble_value + coin_count * coin_value result = (marble_count, c...
Q3: An artist needs to mix 3 parts of paint with 4 parts of water to make a custom color for a painting. If the artist needs 24 liters of the paint, how much water needs to be added?
def solve() -> int: paint_parts = 3 water_parts = 4 total_liters = 24 water_liters = (water_parts / (paint_parts + water_parts)) * total_liters result = water_liters return result
In January, Karen earned $300. In February, she earned half this amount. In March, she earned $400. What is her total income over these three months?
def solve() -> int: income_jan = 300 income_feb = income_jan / 2 income_mar = 400 total_income = income_jan + income_feb + income_mar result = total_income return result
Laura can knit 5 sweaters and 10 scarves each week. A sweater costs $50 and a scarf costs $20. She also receives an extra bonus of 10 percent of her total earnings after taxes. How much is her total earning each week?
def solve() -> int: cost_sweaters = 50 cost_scarfs = 20 num_sweaters = 5 num_scarfs = 10 total_cost = cost_sweaters * num_sweaters + cost_scarfs * num_scarfs tax_fee = total_cost * 0.1 bonus_cost = total_cost * 0.1 total_earning = total_cost - tax_fee + bonus_cost result = ...
A pizza parlor sells pizzas of three different sizes: small (10"), medium (12"), and large (14"). If 60% of the pizzas sold are medium, and the rest of the pizzas are equally divided between the small and large sizes, how many small pizzas are sold for every 3 large pizzas sold?
def solve() -> int: total_pizzas_sold = 100 medium_percentage = 0.6 medium_pizzas = total_pizzas_sold * medium_percentage non_medium_pizzas = total_pizzas_sold - medium_pizzas small_pizzas = non_medium_pizzas / 2 large_pizzas = non_medium_pizzas / 2 / 3 result = small_pizzas / large_pizzas ...
Suzy has 900 marbles. She gives away 25% of her marbles to her friend. How many marbles does she have left?
def solve() -> int: marbles_given_away = 0.25 * 900 marbles_left = 900 - marbles_given_away result = marbles_left return result
Tina bought a dress that was originally $80, but she got a 20% discount. How much did she pay for the dress?
def solve() -> int: discount = 0.20*80 final_price = 80 - discount result = final_price return result
April has saved 3/4 of the money she needs for a trip. She has saved $675 so far. How much money does April still need to save in order to afford the trip?
def solve() -> int: total_saved = 675 total_cost = total_saved / 0.75 remaining_cost = total_cost - total_saved result = remaining_cost return result
In a restaurant, there are three times as many spoons as forks. The kitchen has 200 dishes. If the restaurant has half as many spoons as dishes in the kitchen, how many forks are there in the restaurant?
def solve() -> int: spoons = 0 forks = 0 dishes = 200 spoons = dishes / 2 forks = spoons / 3 result = forks return result
While working out, Mark listens to music. He can lift weights for 1 hour. He listens to six songs, which are an average length of 5 minutes. How many songs does he listen to during his workout?
def solve() -> int: hours_workout = 1 minutes_per_hour = 60 minutes_per_song = 5 total_minutes_workout = hours_workout * minutes_per_hour total_songs = total_minutes_workout / minutes_per_song result = total_songs return result
Kim's car can drive 21 miles on 1 gallon of gasoline. She needs to drive 120 miles. How many gallons of gasoline will Kim need to fill her tank to complete her route?
def solve() -> int: miles_per_gallon = 21 total_miles = 120 gallons_needed = total_miles / miles_per_gallon result = gallons_needed return result
Student: Lu needs to paint the fence around his yard. He has enough paint to cover 108 square feet per gallon. He needs to paint 576 square feet. How many gallons of paint will Lu need?
def solve() -> int: square_feet_needed = 576 square_feet_per_gallon = 108 gallons_needed = square_feet_needed / square_feet_per_gallon result = round(gallons_needed, 2) return result
Karen pays for 40% of her daughter's wedding. The total cost is $50,000. How much does Karen pay for her daughter's wedding? Alice has been saving money for the past year. She has earned the same amount she saved twice over in 10 months. If Alice's savings currently is worth $500, how much has she been saving per month...
def solve() -> int: total_cost = 50000 karen_payment = total_cost * 0.4 alice_savings = 500 alice_savings_per_month = alice_savings / 10 monthly_savings = alice_savings_per_month / 2 result = karen_payment return result
The children collected 120 seashells at the beach. If each child collected an equal number of seashells, and there were 8 children, how many seashells did each child collect?
def solve() -> int: seashells_collected = 120 num_children = 8 seashells_per_child = seashells_collected / num_children result = seashells_per_child return result
Xara watched 30 episodes of a show in 10 days and Yara watched 36 episodes of the same show in 12 days. If they watched the same number of episodes each day, how many more episodes per day did Yara watch than Xara?
def solve() -> int: xara_episodes_per_day = 30 / 10 yara_episodes_per_day = 36 / 12 difference = yara_episodes_per_day - xara_episodes_per_day result = difference return result
Dan has 12 orange balls and 8 less than 3 times as many black balls. He loses a fifth of his orange balls and a quarter of his black balls. How many balls does he have left?
def solve() -> int: orange = 12 black = 3 * orange - 8 orange_lose = orange // 5 orange_left = orange - orange_lose black_lose = black // 4 black_left = black - black_lose total = orange_left + black_left result = total return result
A pizza shop charges $12 for a medium pizza and $15 for a large pizza. It also offers a 10% off coupon for orders over $50. How much will Daniel pay for ordering 3 medium pizzas and 2 large pizzas with the coupon?
def solve() -> int: cost_without_coupon = 3 * 12 + 2 * 15 if cost_without_coupon > 50: cost_with_coupon = cost_without_coupon * 0.9 else: cost_with_coupon = cost_without_coupon amount_paid = cost_with_coupon result = amount_paid return result
Student: In a garden, there are 7 types of flowers: daisies, lilies, sunflowers, roses, violets, tulips, and dandelions. There are a total of 800 flowers and the amount of daisies and violets are equal. Lilies make up 6% of the flowers and the amount of tulips is double the amount of roses. How many sunflowers are in t...
def solve() -> int: daisies = 0 violets = 0 lilies = 0 sunflowers = 0 roses = 0 tulips = 0 dandelions = 0 daisies = violets = 800 / 2 lilies = 800 * 0.06 roses = 800 - daisies - violets - lilies tulips = roses * 2 sunflowers = 800 - daisies - violets - lilies - roses - tu...
ara needs to buy some groceries before she goes to work. It takes 20 minutes of her drive time to get to the store. If her work starts at 9:30 AM, what time should Sara leave her house?
def solve() -> int: leave_time = 9.30 * 60 - 20 result = leave_time // 60 return result
A car travels 50 miles in one hour. How long will it take to travel 150 miles?
def solve() -> int: miles_to_travel = 150 miles_per_hour = 50 time_in_hours = miles_to_travel / miles_per_hour result = time_in_hours return result
Dave works for a grocery store. He can pack 20 bags every 10 minutes, and he usually works 6 hours a day 5 days a week. If Dave worked an extra 2 hours last Wednesday, and an extra 3 hours last Sunday, how many bags was he able to pack this week?
def solve() -> int: bags_per_minute = 20 / 10 minutes_per_hour = 60 hours_per_day = 6 days_per_week = 5 extra_hours_wednesday = 2 extra_hours_sunday = 3 total_hours = (hours_per_day * days_per_week) + extra_hours_wednesday + extra_hours_sunday total_minutes = total_hours * minu...
Possible questions and programs: Tim and Alice are planning to visit their grandparents in another state. They need to buy plane tickets for themselves and their two kids. The adult tickets cost $350 each and the kids tickets cost $250 each. There is also a 10% tax and a $25 baggage fee per person. How much do they nee...
def solve() -> int: adult_price = 350 kid_price = 250 tax_rate = 0.1 baggage_fee = 25 num_adults = 2 num_kids = 2 num_tickets = num_adults + num_kids subtotal = (adult_price * num_adults) + (kid_price * num_kids) tax = subtotal * tax_rate total_fee = num_tickets * baggage_fee ...
David caught 72 fish. Rachel caught four times as many fish as David. If Rachel let go a third of her fish, and David cooked half of his, how many fish do they have left in total?
def solve() -> int: david = 72 rachel = 4 * david rachel_left = rachel - rachel / 3 david_left = david / 2 total_left = rachel_left + david_left result = total_left return result
Student: Lisa saved $120 from her allowance. She bought a dress for $40, a necklace for $15 and a pair of earrings for $10. She then sold her old backpack for $25 and her old shoes for $20. How much money does Lisa have left?
def solve() -> int: saved = 120 dress = 40 necklace = 15 earrings = 10 backpack = 25 shoes = 20 spent = dress + necklace + earrings earned = backpack + shoes left = saved - spent + earned result = left return result