question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Mark joined a reading club where members contributed an average of 6 books per day. The club's admin purged older books at a rate of 1 book per week per member. If the club had 30 members and had a total of 1000 books, how many books would there be after Mark had joined the club for 3 weeks?
def solve() -> int: members = 30 average_books_per_day = 6 books_purged_per_week_per_member = 1 weeks = 3 total_books = members * average_books_per_day * weeks books_purged = members * books_purged_per_week_per_member * weeks remaining_books = 1000 + total_books - books_purged ...
At the bakery, there were 48 loaves of bread, and half of them were whole wheat and the other half were white. Each whole wheat loaf cost $3, and each white loaf cost $2. If 2/3 of the whole wheat loaves and 1/4 of the white loaves were sold, how much money did the bakery make?
def solve() -> int: whole_wheat = 48 / 2 white = 48 / 2 cost_ww = 3 cost_w = 2 sold_ww = whole_wheat * 2 / 3 sold_w = white * 1 / 4 revenue_ww = sold_ww * cost_ww revenue_w = sold_w * cost_w total_revenue = revenue_ww + revenue_w result = total_revenue re...
If a recipe for a cake calls for 2 cups of sugar and makes 10 servings, how many cups of sugar would be needed for 24 servings?
def solve() -> int: sugar_per_serving = 2 initial_servings = 10 desired_servings = 24 total_sugar = (sugar_per_serving * desired_servings) / initial_servings result = total_sugar return result
Alex was collecting $5 a day for his basketball team's fundraiser. After 50 days, his collection box was full. Alex took all the money to the school's administration office. He repeated this process 6 times. How much money did Alex raise for his team in total?
def solve() -> int: money_per_day = 5 days = 50 repetitions = 6 total_money = money_per_day * days * repetitions result = total_money return result
A bag contains 6 red balls, 8 green balls, and 10 black balls. If a ball is selected randomly, what is the probability that it is black?
def solve() -> int: total_balls = 6 + 8 + 10 black_balls = 10 probability = black_balls/total_balls result = probability return result
Jacob bought 12 skateboards for his skatepark. Each skateboard cost $89.99. The store charged him a total of $60.32 in tax. He left with $19.63 in change. How much did Jacob start with? Jessica wants to buy 3 pairs of shoes for each season of the year. The shoes are originally priced at $50, but there is a 30% discount...
def solve() -> int: num_skateboards = 12 cost_per_skateboard = 89.99 total_cost = num_skateboards * cost_per_skateboard tax = 60.32 change = 19.63 amount_paid = total_cost + tax - change num_seasons = 4 num_shoes_per_season = 3 original_price = 50 discount = 0.3 tax_rate...
Jayden and Kayla are twins. Jayden has 12 marbles and Kayla has 8 marbles. They decide to share their marbles equally. How many marbles will each of them have after sharing?
def solve() -> int: total = 12 + 8 each = total / 2 result = each return result
A phone manufacturing company made 3,000 units in the first year and 6,000 in the fifth year. What is the average number of phones made each year?
def solve() -> int: first_year = 3000 fifth_year = 6000 total_units = fifth_year - first_year + 1 average_per_year = (first_year + fifth_year) / total_units result = average_per_year return result
Jack needs to pave his driveway, which is 30 feet long and 10 feet wide. Each bag of pavers covers 2 square feet, but he loses 25% of the pavers due to faulty material. How many bags of pavers does he need to buy?
def solve() -> int: length = 30 width = 10 area = length * width pavers_needed = area / 2 lost_pavers = pavers_needed * 0.25 total_pavers_needed = pavers_needed + lost_pavers bags_needed = total_pavers_needed / 2 result = bags_needed return result
A construction worker was tasked to build a 3-story building. Out of the total materials needed, he bought 45% for the first floor, 35% for the second floor, and the rest for the third floor. How much does he spend on the third floor?
def solve() -> int: total_material = 0 first_floor_material = total_material * 0.45 second_floor_material = total_material * 0.35 third_floor_material = total_material - (first_floor_material + second_floor_material) result = third_floor_material return result
Jacob cycles to work every day. If each trip takes him 30 minutes covering 3 miles, and he didn't cycle for 2 days in June, calculate the total distance he covered in a month.
def solve() -> int: days_in_june = 30 days_not_cycling = 2 days_cycling = days_in_june - days_not_cycling time_per_trip = 0.5 total_time_cycling = days_cycling * time_per_trip distance_per_trip = 3 total_distance = total_time_cycling * distance_per_trip ...
If a company has a profit margin of 20% and the cost of goods sold is $100, what is the selling price of the product?
def solve() -> int: cost_of_goods_sold = 100 profit_margin = 0.2 selling_price = cost_of_goods_sold / (1 - profit_margin) result = selling_price return result
Dana collects 8 marbles and 4 times as many cards as marbles. She loses a quarter of the marbles and a fifth of the cards in a game. She then finds 3 more marbles and 6 more cards on the playground. How many marbles and cards does Dana have now?
def solve() -> int: marbles = 8 cards = 4 * marbles marbles_lost = marbles // 4 cards_lost = cards // 5 marbles_after_game = marbles - marbles_lost cards_after_game = cards - cards_lost marbles_found = 3 cards_found = 6 marbles_now = marbles_after_game + marbles_found cards_now ...
Student: Tom has $200 in his bank account. Every month, he deposits $50 and spends $30 on groceries. After six months, how much money will Tom have?
def solve() -> int: balance = 200 deposit = 50 expense = 30 months = 6 total = balance + (deposit * months) - (expense * months) result = total return result
Dave is 5 years older than Sean. If Dave is 17 years old, how old is Sean?
def solve() -> int: dave_age = 17 sean_age = dave_age - 5 result = sean_age return result
A ticket to a concert costs $50. If they sell 5000 tickets, they will make a gross revenue of how many dollars?
def solve() -> int: gross_revenue = 50 * 5000 result = gross_revenue return result
Benjamin solves 5 math problems every Monday through Wednesday. Then he solves four times as many math problems as he solved on Monday every Thursday and Friday. How many math problems will he solve in a month with 4 weeks?
def solve() -> int: mon_wed = 5 thu_fri = 4 * mon_wed week = mon_wed * 3 + thu_fri * 2 month = week * 4 result = month return result
A bakery decreased the price of a certain cake by $2 every year. If the price in 2015 was $24, what was the price in 2019?
def solve() -> int: price_2015 = 24 decrease_per_year = 2 years_passed = 2019 - 2015 price_2019 = price_2015 - (decrease_per_year * years_passed) result = price_2019 return result
Student: Jack has an apple tree with 12 apples. He needs 6 apples per pie. How many pies can he make?
def solve() -> int: apples = 12 apples_per_pie = 6 pies = apples // apples_per_pie result = pies return result
Student: Jackie bought a book which costs $20. She has $20 in her pocket and earned an additional $20 by selling her old bike. How much money does Jackie have now?
def solve() -> int: initial_amount = 20 earned_amount = 20 total_amount = initial_amount + earned_amount result = total_amount return result
arah wants to buy a new laptop. The laptop costs $800, but she has a 15% off coupon. If she also has to pay an 8% sales tax, how much will she pay for the laptop in total?
def solve() -> int: laptop_price = 800 discount = laptop_price * 0.15 subtotal = laptop_price - discount sales_tax = subtotal * 0.08 total = subtotal + sales_tax result = total return result
An ice cream parlor is giving away free cups of ice cream. Each cup costs $3. If 200 people receive a free cup each, how much money did the ice cream parlor spend?
def solve() -> int: price_per_cup = 3 number_of_people = 200 total_spent = price_per_cup * number_of_people result = total_spent return result
Jim needs to buy 6 textbooks for his upcoming semester. Each textbook costs $70 and is now on sale for 15% off. How much will Jim pay for the textbooks?
def solve() -> int: num_textbooks = 6 textbook_cost = 70 discount_percentage = 15 total_cost = num_textbooks * textbook_cost discount_amount = total_cost * (discount_percentage / 100) final_cost = total_cost - discount_amount result = final_cost return result
Ben loves to play soccer. He practices for 2 hours on weekdays and 3 hours on weekends. He also participates in a soccer tournament every month, where he plays 4 matches of 90 minutes each. How many hours does Ben play soccer for in 2 months?
def solve() -> int: daily_hours = 2 weekly_hours = daily_hours * 5 + 3 * 2 monthly_hours = weekly_hours * 4 + 4 * 1.5 total_hours = monthly_hours * 2 result = "Ben plays soccer for " + str(total_hours) + " hours in 2 months." return result
A company that earns $50,000 in profits each month decides to donate 25% of their profits to charity. How much money do they donate to charity each month?
def solve() -> int: monthly_profit = 50000 donation_percentage = 0.25 donation_amount = monthly_profit * donation_percentage result = donation_amount return result
A box contains 20 red balls and 30 blue balls. If you randomly pick one ball from the box, what is the probability that it's red?
def solve() -> int: TotalBalls = 20 + 30 RedBalls = 20 ProbabilityOfRedBall = RedBalls / TotalBalls result = ProbabilityOfRedBall return result
Sarah wants to order 7 personalized luggage tags for her family. The tags cost $6 each and currently have a 20% discount. The monogramming will cost her $4 per tag. What is the total cost of the luggage tags with monogramming?
def solve() -> int: num_tags = 7 tag_cost = 6 discount = 0.2 monogram_cost = 4 total_tag_cost = num_tags * tag_cost * (1 - discount) total_monogram_cost = num_tags * monogram_cost total_cost = total_tag_cost + total_monogram_cost result = total_cost return result
At the restaurant, Tina found 42 crayons, Jason discovered 34 crayons and Nathan picked up 16 crayons. How many more crayons did Tina and Jason find than Nathan?
def solve() -> int: crayons_tina = 42 crayons_jason = 34 crayons_nathan = 16 result = crayons_tina + crayons_jason - crayons_nathan return result
John had 5 sandwiches. He bought 3 more sandwiches and gave 2 of them away. How many sandwiches does John have left?
def solve() -> int: total = 0 total += 5 total += 3 total -= 2 result = total return result
A school has 2735 students and 540 teacher. How many more students than teachers are there in the school?
def solve() -> int: num_students = 2735 num_teachers = 540 difference = num_students - num_teachers result = difference return result
Emily needs to save $10000 in 6 months. She has already saved $4000 in 3 months. How much money does she need to save per week in the next 12 weeks to reach her goal?
def solve() -> int: goal = 10000 saved = 4000 remaining_months = 6 - 3 remaining_weeks = 12 remaining_amount = goal - saved amount_per_week = remaining_amount / (remaining_months * 4 + remaining_weeks) result = amount_per_week return result
Max is picking apples in an orchard. Every time he picks a basketful of 15 apples, he eats 3 of them himself. If he needs to pick 75 apples, how many basketfuls will he need to fill?
def solve() -> int: apples_per_basket = 15 apples_picked = 75 apples_eaten = 3 apples_needed = apples_picked + apples_eaten basketfuls_needed = apples_needed / apples_per_basket result = basketfuls_needed return result
Student: A store had 235 pencils. Mary bought 85 pencils and John bought 76 pencils. How many pencils are left in the store?
def solve() -> int: pencils = 235 pencils = pencils - 85 pencils = pencils - 76 result = pencils return result
Student: Rachel wants to reduce her body weight by 10%. If she currently weighs 130 pounds, how many pounds does she need to lose to reach her goal?
def solve() -> int: current_weight = 130 percent_reduction = 0.1 weight_to_lose = current_weight * percent_reduction result = weight_to_lose return result
A rectangle has an area of 56 square meters. If the length of the rectangle is 8 meters, calculate its perimeter.
def solve() -> int: length = 8 area = 56 width = area/length perimeter = 2*(length + width) result = perimeter return result
Every summer, Diana dyes her hair a new color. She started this tradition when she was 20 years old, which was the year she dyed her second hair color. In six years, Diana will have had 14 different hair colors. How old is Diana now?
def solve() -> int: start_age = 20 start_color = 2 years_passed = 6 hair_colors = 14 current_age = start_age + years_passed current_color = start_color + (hair_colors - start_color) // years_passed result = current_age return result
John has 18 apples. If he gives away 4 apples to his friend, how many apples will he have left?
def solve() -> int: apples_John_has = 18 apples_John_gives_away = 4 apples_left = apples_John_has - apples_John_gives_away result = apples_left return result
Jack needs $1200 for rent, $200 for groceries, $300 for medical expenses, and $90 for utilities. He also wants to save $100 in case of an emergency. If Jack makes $17 per hour at his job, how many hours will he need to work this month?
def solve() -> int: rent = 1200 groceries = 200 medical_expenses = 300 utilities = 90 emergency_fund = 100 total_expenses = rent + groceries + medical_expenses + utilities + emergency_fund hourly_rate = 17 hours_needed = total_expenses / hourly_rate result = hours_needed ...
There are 30 students in a class and the teacher wants to divide them into equal teams. If each team must have at least 4 students, how many teams can be formed?
def solve() -> int: num_teams = 0 if 30//4 >= 4: num_teams = 30//4 else: num_teams = 4 result = num_teams return result
If a rectangle has a length of 15 meters and a width of 9 meters, what is the perimeter of the rectangle?
def solve() -> int: length = 15 width = 9 perimeter = 2 * (length + width) result = perimeter return result
Rachel baked 300 muffins for the fundraiser. 40% of them were sold in the morning, and the remaining were sold in the afternoon. If 50 muffins were left unsold, how many muffins were sold in the afternoon?
def solve() -> int: muffins_baked = 300 muffins_sold_morning = muffins_baked * 0.4 muffins_remaining = muffins_baked - muffins_sold_morning muffins_sold_afternoon = muffins_remaining - 50 result = muffins_sold_afternoon return result
An ice cream shop sells small cones for $2.50 each and large cones for $5. If the shop sells 10 small cones and 5 large cones, how much money did they make in total?
def solve() -> int: small_cone_cost = 2.5 large_cone_cost = 5 total_small_cones = 10 total_large_cones = 5 total_cost = (small_cone_cost * total_small_cones) + (large_cone_cost * total_large_cones) result = total_cost return result
If the price of a gym membership is $50 per month and it increases by 2% every year, what will be the cost of the membership in 5 years?
def solve() -> int: price_per_month = 50 annual_increase = 0.02 years = 5 cost_in_5_years = price_per_month * (1 + annual_increase)**years result = cost_in_5_years return result
Student: Liam has 18 crayons. He shares them equally among 6 friends. How many crayons does each friend get?
def solve() -> int: crayons = 18 friends = 6 crayons_per_friend = crayons / friends result = crayons_per_friend return result
Student: The Perry family has a combined age of 120 years. The mother is 3 years younger than the father. If the father is 48 years old, how old is the mother?
def solve() -> int: father_age = 48 combined_age = 120 mother_age = combined_age - father_age - 3 result = mother_age return result
phanie works in a warehouse. She needs to stack 5 boxes on top of each other. Each box is 5 inches in height. How many total inches will the stack of boxes be?
def solve() -> int: numberbox = 5 boxheight = 5 totalheight = numberbox * boxheight result = totalheight return result
Student: Tina, Victoria and William have a combined total of 980 coins in their collection. William has 8 coins less than Tina, and Victoria has 15 coins more than William. How many coins does Victoria have overall?
def solve() -> int: tina = 0 william = 0 victoria = 0 total = 980 william = 27 tina = 35 victoria = 42 result = victoria return result
Some possible questions and programs are: Lisa wants to make lemonade for her friends. She needs 6 lemons for each quart of lemonade. She can buy a bag of 12 lemons for $4 at the farmers market, or individual lemons for $0.5 each at the grocery store. How much money does she save by buying the bag of lemons if she want...
def solve() -> int: lemons_needed = 6 * 3 cost_farmers_market = 4 * (lemons_needed // 12) cost_grocery_store = 0.5 * lemons_needed savings = cost_grocery_store - cost_farmers_market result = savings return result
A box of seven candles was left in a sunny room and is slowly melting. Every time a candle melts, the remaining candles melt five times as fast as the previous one. How many times faster than the first candle does the sixth candle’s remains melt?
def solve() -> int: candle_1 = 1 candle_2 = candle_1 * 5 candle_3 = candle_2 * 5 candle_4 = candle_3 * 5 candle_5 = candle_4 * 5 candle_6 = candle_5 * 5 result = candle_6 / candle_1 return result
A hospital has 120 beds. If 25% of the beds are intensive care beds and 50% of the remaining are surgical beds, how many beds are surgical beds?
def solve() -> int: beds = 120 intensive_care_beds = beds * 0.25 remaining_beds1 = beds - intensive_care_beds surgical_beds = remaining_beds1 * 0.50 result = surgical_beds return result
A truck can carry 2000 pounds of cargo. If the driver has 8000 pounds to transport, how many trips must the driver make?
def solve() -> int: max_cargo = 2000 total_cargo = 8000 trips_needed = total_cargo / max_cargo result = trips_needed return result
There are 20 students in a class. The teacher needs to divide them into groups of 4 for a team activity. How many groups can the teacher make?
def solve() -> int: num_students = 20 group_size = 4 num_groups = num_students // group_size result = num_groups return result
Student: Megan is four times younger than her brother. If Megan is 15, how old is her brother?
def solve() -> int: megan_age = 15 brother_age = megan_age * 4 result = brother_age return result
A gym charges $20 for each session and $100 for a monthly membership. If a person goes to the gym 3 times a week in a month, which option will be cheaper for him?
def solve() -> int: session_cost = 20 total_session_cost = session_cost * 12 membership_cost = 100 if total_session_cost < membership_cost: result = "Going to gym 3 times a week in a month is cheaper" else: result = "Getting a monthly membership is cheaper" return result
Sally can finish cleaning a room in a quarter of the time it takes Ethan. If Ethan finishes cleaning a room in 60 minutes, how long will it take Sally to finish?
def solve() -> int: ethan_time = 60 sally_time = ethan_time / 4 result = sally_time return result
Mark needs to mow his lawn that is 1200 square feet. If he can mow at a rate of 200 square feet per hour for the first four hours and then 100 square feet per hour thereafter, how long will it take him to finish the job?
def solve() -> int: lawn_area = 1200 rate_first_four_hours = 200 rate_after_four_hours = 100 time_first_four_hours = 4 time_after_four_hours = (lawn_area - (rate_first_four_hours * time_first_four_hours)) / rate_after_four_hours total_time = time_first_four_hours + time_after_four_hour...
A tea shop sells 3 types of tea: green tea, black tea, and oolong tea. The green tea costs $3 per cup, the black tea costs $4 per cup, and the oolong tea costs $5 per cup. If the shop sells 10 cups of green tea, 5 cups of black tea, and 3 cups of oolong tea, what is the average price per cup of tea?
def solve() -> int: green_tea = 3*10 black_tea = 4*5 oolong_tea = 5*3 total_cost = green_tea+black_tea+oolong_tea total_cups = 10+5+3 avg_cost = total_cost/total_cups result = avg_cost return result
Tom swims for 2 hours every day. He burns 200 calories per hour. For breakfast, he has an 800 calorie omelet. For lunch, he has a sandwich with a third of the calories of breakfast. For dinner, he has double the calories of lunch. How many calories does he burn and consume while swimming?
def solve() -> int: hours_swimming = 2 calories_burned_per_hour = 200 calories_burned = hours_swimming * calories_burned_per_hour calories_breakfast = 800 calories_lunch = calories_breakfast / 3 calories_dinner = calories_lunch * 2 calories_consumed = calories_breakfast + calo...
am runs 5 kilometers every day. He increases his distance by 10% every week. How far will he run on the 8th day of the 3rd week?
def solve() -> int: distance = 5 increase = 0.1 week = 3 day = 8 distance *= (1 + increase) ** 2 distance *= (1 + increase) ** (day - 1) result = distance return result
If it takes 4 people to assemble a car in 20 hours, how long would it take if there were 6 people in the team?
def solve() -> int: people_1 = 4 hours_1 = 20 people_2 = 6 hours_2 = (people_1 * hours_1) / people_2 result = hours_2 return result
Gabrielle has a collection of 80 bracelets. 65% of her bracelets are beaded. Gabrielle plans to wear one-fifth of her beaded bracelets on a special occasion. If each beaded bracelet has an average length of 7 inches, how many total inches of bracelets will she wear?
def solve() -> int: bracelets_total = 80 beaded_bracelets_percentage = 65 beaded_bracelets = (beaded_bracelets_percentage / 100) * bracelets_total bracelets_to_wear = beaded_bracelets / 5 average_length = 7 total_inches = bracelets_to_wear * average_length result = total_inches retu...
Olivia has 36 apples. She gave 12 apples to her mom. After that, 1/4 of her remaining apples were infected by worms. How many apples does she have left?
def solve() -> int: olivia_apples = 36 mom_apples = 12 olivia_apples_left = olivia_apples - mom_apples infected_apples = olivia_apples_left / 4 olivia_apples_left = olivia_apples_left - infected_apples result = olivia_apples_left return result
Student: John rode his bike for 5 miles in 10 minutes, what is John's average speed?
def solve() -> int: distance = 5 time = 10 speed = distance / time result = speed return result
If a store was short-staffed and had an increased customer complaint rate of 40% per day, how many complaints would they have after 4 days?
def solve() -> int: total_complaints = 0 starting_complaints = 120 complaint_increases_percent = 0.4 for day in range(4): total_complaints += round(starting_complaints * (1 + complaint_increases_percent)) starting_complaints *= (1 + complaint_increases_percent) result ...
Sarah has 10 siblings and each of them has the same number of children as she does except for 4 who have 7 children each. How many grandchildren does she have?
def solve() -> int: sarah_siblings = 10 siblings_with_7_children = 4 sarah_children = 3 siblings_with_same_number_of_children = sarah_siblings - siblings_with_7_children total_children_of_siblings_with_same_number = siblings_with_same_number_of_children * sarah_children total_children_of_si...
Student: A store sells three types of pens: A, B, and C. 30% of the pens sold are type A, 45% are type B, and the rest are type C. Out of the type A pens sold, 5% are faulty, while the faulty rate for type B and type C pens are 2% and 1% respectively. If a randomly selected pen is faulty, what is the probability that i...
def solve() -> int: total_pens_sold = 1000 type_a_percentage = 0.3 type_b_percentage = 0.45 type_c_percentage = 1 - type_a_percentage - type_b_percentage type_a_faulty_percentage = 0.05 type_b_faulty_percentage = 0.02 type_c_faulty_percentage = 0.01 type_a_pens_sold = total_pens_sold * t...
A bear escapes from the forest preserve at 11 PM but the rangers don't notice until 1 AM. Emma earns $600 per week if she works for 50 hours and earns $25 per hour for every hour of overtime. How much would she earn if she worked 65 hours last week?
def solve() -> int: hours_worked = 65 regular_hours = 50 overtime_hours = hours_worked - regular_hours overtime_pay_rate = 25 regular_pay_rate = 600 / regular_hours regular_pay = regular_pay_rate * regular_hours overtime_pay = overtime_pay_rate * overtime_hours total_pay = regular_p...
Anna has $250 in her bank account. She spends $70 every week. How many weeks will it take for Anna to have $40 left in her bank?
def solve() -> int: initial_balance = 250 weekly_spending = 70 end_balance = 40 weeks = (initial_balance - end_balance) / weekly_spending result = weeks return result
A candy bar costs $1.20. How many candy bars can you buy with $24?
def solve() -> int: cost_per_bar = 1.2 total_money = 24 num_bars = total_money // cost_per_bar result = num_bars return result
At a snack bar, Anna ordered 3 hot dogs and 4 burgers. Each hot dog is served in a bun while each burger is served between two buns. If Anna ate 7 buns in total, how many hot dog buns did she eat?
def solve() -> int: hotdog_buns = (7 - (4*2))//1 result = hotdog_buns return result
A group of 6 friends went to a bar and ordered drinks. The first person ordered a $12.50 fruity cocktail, the second person ordered a $5.25 beer, the third person ordered a $9.00 whiskey, the fourth person ordered a $8.75 vodka cranberry, the fifth person ordered a $6.25 margarita, and the sixth person ordered a $10.50...
def solve() -> int: tax_tip_rate = 0.25 person1 = 12.50 person2 = 5.25 person3 = 9.00 person4 = 8.75 person5 = 6.25 person6 = 10.50 subtotal = person1 + person2 + person3 + person4 + person5 + person6 tax_tip = subtotal * tax_tip_rate total = subtotal + tax_tip result = total...
Paul bought seven pairs of headphones for his store, all at the same price. He also bought a CD player that costs $45 and two sets of batteries at $10 for each set. If he gave the cashier $200, how much change did he receive?
def solve() -> int: headphones_price = 0 cd_player_price = 45 batteries_price = 10 * 2 total_cost = headphones_price * 7 + cd_player_price + batteries_price change = 200 - total_cost result = change return result
A factory produces 120 items per hour. How long will it take the factory to produce 600 items?
def solve() -> int: production_rate_hour = 120 num_items_needed = 600 production_time = num_items_needed / production_rate_hour result = production_time return result
A car rental company charges $40 per day for renting a car. If a customer rents a car for 5 days, they will get a 10% discount on the total rental cost. How much will a customer pay for renting a car for 5 days after applying the discount?
def solve() -> int: days_rented = 5 daily_cost = 40 total_cost = days_rented * daily_cost discount = total_cost * 0.1 discounted_total = total_cost - discount result = discounted_total return result
Julie needs to put new tiles in her bathroom that is 10 feet by 8 feet. If each tile is 0.5 square feet, how many tiles does she need to buy?
def solve() -> int: bathroom_length = 10 bathroom_width = 8 tile_size = 0.5 result = (bathroom_length * bathroom_width) / tile_size return result
Ben got a $50 bill from his uncle to buy some snacks and drinks for his birthday party. He bought 4 bags of chips that cost $3 each, 3 packs of cookies that cost $4 each, and 5 bottles of soda that cost $2 each. How much money should Ben return to his uncle?
def solve() -> int: total_cost = 4 * 3 + 3 * 4 + 5 * 2 change = 50 - total_cost result = change return result
A grocery store has 10 aisles and two-thirds of them are fully stocked. The remaining aisles are at one-half capacity only. If each aisle has 50 items and each item has an average weight of 0.5 kg, how many kilograms of goods are in the grocery store?
def solve() -> int: aisles = 10 full_stocked = aisles * (2/3) half_capacity = aisles - full_stocked items_per_aisle = 50 avg_weight_per_item = 0.5 total_kg_full_stocked = full_stocked * items_per_aisle * avg_weight_per_item total_kg_half_capacity = half_capacity * items_per_aisle * avg_weigh...
Here are some possible questions and programs: Laura bought some groceries at the supermarket. She bought 3 kg of apples at $5 per kg, 2 kg of bananas at $3 per kg, and a dozen eggs at $4. She also used a coupon that gave her 10% off her total purchase. How much did she pay for her groceries?
def solve() -> int: total_price = 3 * 5 + 2 * 3 + 4 discounted_price = total_price * 0.9 result = discounted_price return result
A basketball team has 5 players. If the team plays a full game of 4 quarters, with each quarter lasting 15 minutes, how many minutes in total does each player play?
def solve() -> int: players = 5 quarters = 4 quarter_time = 15 total_time = quarters * quarter_time time_per_player = total_time / players result = time_per_player return result
Sophia wants to buy a pair of shoes. She can get a 30% discount on a $80 pair of shoes with Nike. She can also save 20% off a $100 pair of shoes with Adidas. How much money would she save by choosing the cheapest pair of shoes?
def solve() -> int: nike_price = 80 adidas_price = 100 nike_discount = 0.3 adidas_discount = 0.2 nike_savings = nike_price * nike_discount adidas_savings = adidas_price * adidas_discount if nike_savings < adidas_savings: cheapest_savings = nike_savings else: ...
Every Sunday, Chef Brian makes lasagna for his family. He and his wife each eat 3 pieces, and their daughter eats 2 pieces. Chef Brian uses a lasagna that has 12 pieces. How many lasagnas will Chef Brian need to make in a year?
def solve() -> int: pieces_per_sunday = 3 daughter_pieces_per_sunday = 2 total_pieces_per_sunday = pieces_per_sunday + daughter_pieces_per_sunday lasagnas_per_year = 52 * (total_pieces_per_sunday / 12) result = lasagnas_per_year return result
John is a hockey player and he has 17 hockey pucks. He finds that each puck is roughly 3 inches in diameter. How many square inches are all the hockey pucks together?
def solve() -> int: pucks = 17 diameter = 3 radius = diameter / 2 circle_area = 3.14 * radius * radius total_area = pucks * circle_area result = 505.28 return result
Jamie went on a picnic with his friends. He brought 36 pieces of candy and gave away 9 to each of his friends. How many pieces of candy did Jamie have left?
def solve() -> int: total = 0 givenAway = 9 total = total + (givenAway * 3) jamie = 36 total = total + jamie result = total - (givenAway * 3) return result
Student: A family is building a house. The cost of materials for the construction is $1000. If the cost of labor is 2.5 times the cost of materials, how much money does the family have to pay for labor in total?
def solve() -> int: cost_materials = 1000 cost_labor = cost_materials * 2.5 total_cost_labor = cost_labor result = total_cost_labor return result
Alex has a coupon for "30% off any item over $50". If he buys a jacket for $60, how much money does he save?
def solve() -> int: original_price = 60 discount_percentage = 30 minimum_price = 50 if original_price > minimum_price: discount_amount = original_price * (discount_percentage / 100) final_price = original_price - discount_amount saved_amount = original_price - final_price ...
A train travels at a speed of 60 miles per hour for 3 hours. It then slows down to 50 miles per hour for the next hour. What is the total distance traveled by the train?
def solve() -> int: speed_1 = 60 speed_2 = 50 time_1 = 3 time_2 = 1 distance_1 = speed_1 * time_1 distance_2 = speed_2 * time_2 total_distance = distance_1 + distance_2 result = total_distance return result
Student: Emily is making birthday cards for her friends. She bought a box of 64 crayons and gave 2 crayons to each of her 22 friends. How many crayons does Emily have left?
def solve() -> int: crayons_bought = 64 num_friends = 22 crayons_per_friend = 2 total_crayons_given = num_friends * crayons_per_friend crayons_left = crayons_bought - total_crayons_given result = crayons_left return result
Student: A group of 5 friends are sharing a pizza, the first friend eats half the pizza, the second friend eats a quarter of what's left, the third friend eats half of what's left, the fourth friend eats the remaining 2 slices, and the last friend doesn't eat any. How many slices does the pizza have?
def solve() -> int: slices = 0 slices = slices + (slices / 2) slices = slices + (slices / 4) slices = slices + (slices / 2) slices = slices + 2 result = slices return result
Tom's laptop weighs 5 pounds. It increased its weight to 1.7 times its starting weight. He is able to sell the laptop for $50 per pound. How much more is it worth after gaining the weight?
def solve() -> int: laptop_weight = 5 increased_weight = laptop_weight * 1.7 worth_after_increase = increased_weight * 50 worth_difference = worth_after_increase - (laptop_weight * 50) result = worth_difference return result
A car travels 45 km in 30 minutes. At what speed is the car moving in metres per second?
def solve() -> int: distance_travelled = 45 time_in_minutes = 30 speed_in_kmph = (distance_travelled/(time_in_minutes/60)) speed_in_mps = speed_in_kmph*(5/18) result = speed_in_mps return result
Christina wants to make a fruit salad for a party of 30 people. If each person will get 1 cup of fruit and the fruit salad recipe calls for 2 cups of fruit per 4 people, how many cups of fruit does she need to make the salad?
def solve() -> int: num_people = 30 cups_per_person = 1 cups_per_batch = 2 servings_per_batch = 4 total_servings = num_people total_batches = total_servings // servings_per_batch total_cups = total_batches * cups_per_batch total_fruit = total_cups * 2 result = total_fruit return...
Student: A plane takes off with a total of 30,000 gallons of fuel. After 3 hours of the flight, the plane has consumed 20% of its fuel. How many gallons of fuel does the plane have left?
def solve() -> int: total_fuel = 30000 flight_time = 3 fuel_consumed = 0.2 fuel_used = total_fuel * fuel_consumed fuel_left = total_fuel - fuel_used result = fuel_left return result
Jay and Judy packed some sandwiches. Jay packed 5 peanut butter sandwiches, 6 cheese sandwiches, and 7 ham sandwiches, while Judy packed 8 peanut butter sandwiches, 4 cheese sandwiches and 3 ham sandwiches. How many sandwiches did they packed in total?
def solve() -> int: sandwiches_jay_pb = 5 sandwiches_jay_cheese = 6 sandwiches_jay_ham = 7 sandwiches_judy_pb = 8 sandwiches_judy_cheese = 4 sandwiches_judy_ham = 3 result = sandwiches_jay_pb + sandwiches_jay_cheese + sandwiches_jay_ham + sandwiches_judy_pb + sandwiches_judy_cheese + sandwic...
In a soccer tournament, the winning team got 3/7 of the total prize money. They spent 1/4 of their prize money and had $800 left. What was the total prize money?
def solve() -> int: winning_team_prize = 800 / (1 - 1/4) total_prize_money = winning_team_prize / (3/7) result = total_prize_money return result
Bob has $1200 in his checking account. He withdraws 25% of it to pay rent, then he spends 30% of the remaining amount on a new phone. How much money does Bob have left after these expenses?
def solve() -> int: balance = 1200 rent = balance * 0.25 remaining = balance - rent phone = remaining * 0.3 result = remaining - phone return result
A bakery sells cupcakes for $2 each and cookies for $1 each. If a customer buys 10 cupcakes and 5 cookies, how much do they pay in total?
def solve() -> int: cupcake_price = 2 cookie_price = 1 num_cupcakes = 10 num_cookies = 5 total_price = (cupcake_price*num_cupcakes) + (cookie_price*num_cookies) result = total_price return result
Student: Tom's business generates a profit of $25 for every item he sells. If he sold 10 items last month, how much total profit did he make?
def solve() -> int: items_sold = 10 profit_per_item = 25 total_profit = items_sold * profit_per_item result = total_profit return result
Student: A car travels at a speed of 72 kmph. If the car travels 2/5 th of the journey in 2.4 hours, what speed should it maintain for the remaining journey to complete the journey in time?
def solve() -> int: speed = 72 distance = 1 fraction_of_distance = 2/5 time_taken = 2.4 distance_covered = fraction_of_distance * distance time_remaining = 1 - fraction_of_distance time_remaining_in_hours = time_remaining * time_taken speed_required = distance_covered / time_remaining...
Olivia purchased a piano for $10,000 and spent 8% of that price on the bench and sheet music. If she had twice as much money as the price of the piano beforehand, how much money does she have left now?
def solve() -> int: price_of_piano = 10000 amount_spent = 0.08 * price_of_piano total_spent = price_of_piano + amount_spent money_beforehand = 2 * price_of_piano money_left = money_beforehand - total_spent result = money_left return result
A car travels 60 miles per hour. Calculate the distance it covers in 3 hours.
def solve() -> int: speed_in_mph = 60 time_in_hours = 3 distance_covered = speed_in_mph * time_in_hours result = f'<<<{distance_covered} miles>>>' result = distance_covered return result