question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Student: Nick needs to buy fence posts for his yard. Each post costs $14. How much money does he need to buy 16 fence posts?
def solve() -> int: cost = 14 posts = 16 total = cost * posts result = total return result
Student: Bob went to the thrift shop and bought 6 items. Each item cost $4.50. He had a $25.00 gift card. How much money did he have left after buying the items?
def solve() -> int: items = 6 cost = 4.50 gift_card = 25.00 total_cost = items * cost balance = gift_card - total_cost result = balance return result
John works 8 hours a day from Monday to Friday with an hourly pay of $12. He works 6 hours on Saturday and 4 hours on Sunday with an hourly pay of $15. How much money does John make in a week?
def solve() -> int: weekday_pay = 12 * 8 * 5 weekend_pay = (6 * 15) + (4 * 15) total_pay = weekday_pay + weekend_pay result = total_pay return result
A bus has thirty passengers. If eight more passengers get in, the number of passengers becomes seven times the number of passengers in the taxi. How many passengers are in the taxi?
def solve() -> int: bus_passengers = 30 new_passengers = 8 total_passengers = bus_passengers + new_passengers taxi_passengers = (total_passengers) / 7 result = taxi_passengers return result
Harper had 25 stickers, but then tore 8. Hannah has 1/7 more than what Harper currently has, plus 4. How many stickers does Hannah have? Liam is organizing his pencil case. He has 8 pencils, 3 ballpoint pens and 5 highlighters. How many writing utensils does he have in total?
def solve() -> int: harper_stickers = 25 harper_stickers -= 8 hannah_stickers = harper_stickers + (harper_stickers * 1/7) + 4 liam_pencils = 8 liam_ballpoint_pens = 3 liam_highlighters = 5 total_utensils = liam_pencils + liam_ballpoint_pens + liam_highlighters re...
The price of a shirt is $20. If there is a 30% discount, what is the discounted price?
def solve() -> int: price = 20 discount_rate = 0.3 discount = price * discount_rate discounted_price = price - discount result = discounted_price return result
A girl solved 40 math problems out of 50. What percentage of the problems did she solve correctly?
def solve() -> int: num_of_problems = 50 num_of_correct_problems = 40 percentage_correct = (num_of_correct_problems / num_of_problems) * 100 result = percentage_correct return result
A three litre container has 2880 millilitres in it. How many millilitres are in one litre?
def solve() -> int: total_millilitres = 2880 litres = 3 millilitres_per_litre = total_millilitres / litres result = millilitres_per_litre return result
Student: Jane can knit 5 scarves in 6 days. If she has 15 days to knit, how many scarves can she finish?
def solve() -> int: scarves_per_day = 5/6 scarves_in_15_days = scarves_per_day * 15 result = scarves_in_15_days return result
Thomas and Adam both work at a construction company. 9 years ago, Adam had 6 times as much experience as Thomas. Now he has twice as much experience as Thomas. How many years of experience does Thomas have now?
def solve() -> int: x = 9 adam_experience_9_years_ago = 6 * x adam_experience_now = 2 * x thomas_experience_now = adam_experience_now / 2 result = thomas_experience_now return result
Tim has $50 in January. He spends 1/4 of his money in February and saves $7. In March, he spends twice as much money as he did in February. How much money does Tim have at the end of March?
def solve() -> int: money_jan = 50 money_feb = money_jan / 4 savings_feb = 7 money_march = (money_feb * 2) + savings_feb total_money = money_jan - money_feb - savings_feb + money_march result = total_money return result
Bob has a rectangular garden that is 8 meters long and 6 meters wide. He wants to build a fence around it and leave a 1 meter gap for the entrance. How many meters of fencing does he need?
def solve() -> int: perimeter = 2 * (8 + 6) - 2 result = perimeter return result
A restaurant offers 15% off on meals if you buy more than 4. If you paid $68 for 5 meals, what is the original price of a single meal?
def solve() -> int: original_price = 0 discount = 0.15 num_meals = 5 total_paid = 68 discounted_price = total_paid / (1 - discount) original_price = discounted_price / num_meals result = original_price return result
Rachel spent 3/8 of her allowance on a book and 7/12 of her allowance on a toy. She has $12 left. How much was her original allowance?
def solve() -> int: book_spending = 3/8 toy_spending = 7/12 remaining_money = 12 total_spending = 1 - (book_spending + toy_spending) original_allowance = remaining_money / total_spending result = original_allowance return result
ve started with $400 in his savings account. The account increased by 5.5% over a 4 month period, and he deposited another $300. What is the final balance of the account?
def solve() -> int: initial_invest = 400 app_rate = 0.055 deposit = 300 final_value = (initial_invest * (1 + app_rate)) + deposit result = final_value return result
A grocery store sells 3 types of oranges. The first type costs $1 per piece, the second type costs $1.50 per piece, and the third type costs $2 per piece. If a customer buys 3 of the first type, 4 of the second type, and 2 pieces of the third type, what is the total cost?
def solve() -> int: first_type = 3 second_type = 4 third_type = 2 cost_first_type = first_type * 1 cost_second_type = second_type * 1.5 cost_third_type = third_type * 2 total_cost = cost_first_type + cost_second_type + cost_third_type result = total_cost return result
There were 124 computers and 93 TVs at a store. How many more computers than TVs are there?
def solve() -> int: computers = 124 tvs = 93 difference = computers - tvs result = difference return result
Beth has four times as many pennies as nickels. If she loses half of her pennies and gains 10 more nickels, how much money does she have in dollars if she originally had 80 pennies?
def solve() -> int: pennies = 80 nickels = pennies / 4 pennies = pennies / 2 nickels = nickels + 10 total_cents = (pennies * 1) + (nickels * 5) total_dollars = total_cents / 100 result = total_dollars return result
Fred planted 72 flowers, each flower needs 4 liters of water every day and each watering can holds 12 liters. How many full waterings does Fred need to do every day if he wants to water all the flowers?
def solve() -> int: waterings = 0 liters_needed = 72 * 4 can_liters = 12 while liters_needed > 0: liters_needed = liters_needed - can_liters waterings = waterings + 1 result = waterings return result
Mary has 90% in math class and 85% in science class. If both classes have equal weight in final grade, what is her average?
def solve() -> int: math_grade = 0.9 science_grade = 0.85 final_grade = (math_grade + science_grade) / 2 result = final_grade return result
Alyssa, Brian, and Lily are buying candies from the store. Currently, Brian has double the number of candies as Alyssa but has 10 fewer candies than Lily. If Lily has 60 candies now, how many more candies should they buy so that all three of them will have a total of 200 candies?
def solve() -> int: brian_candies = 60 - 10 alyssa_candies = brian_candies / 2 lily_candies = 60 total_candies = brian_candies + alyssa_candies + lily_candies candies_to_buy = 200 - total_candies result = candies_to_buy return result
Ava collected 80 seashells. She gave 1/6 of the seashells to her mother and 1/3 of the remaining shells to her little sister. How many shells did Ava's sister receive?
def solve() -> int: seashells_collected = 80 seashells_given_to_mother = seashells_collected * (1/6) remaining_seashells = seashells_collected - seashells_given_to_mother seashells_given_to_sister = remaining_seashells * (1/3) result = seashells_given_to_sister return result
Tim, Gary, and Jason are organizing books for the library. Tim has 2 more books than Gary and Jason has 3/2 times more books than Tim. If Gary has 22 books, how many books do the three have together?
def solve() -> int: total = 0 total = total + 22 total = total + (22 + 2) total = total + (22 + 2)*(3/2) result = total return result
A car has a fuel tank capacity of 40 liters. If the car uses 8 liters of fuel per 100 kilometers, how far can the car travel on a full tank of fuel?
def solve() -> int: tank_capacity = 40 fuel_per_100km = 8 distance = (tank_capacity / fuel_per_100km) * 100 result = distance return result
Student: Sara is going to the supermarket. She needs a third of all the items for kitchen, half of the remaining items for baking and the rest for dinner. If she has 16 items left for dinner, how many items did she need in total?
def solve() -> int: third = 1/3 half = 1/2 dinner = 16 baking = half * (1 - third) total = dinner / (1 - baking - third) + dinner + dinner * third / baking total = round(total) result = total return result
Possible questions and programs: A car dealer buys a used car for $15,000 and spends $2,000 on repairs and cleaning. He wants to make a 20% profit on his investment. How much should he sell the car for?
def solve() -> int: profit = 0.2 * (15000 + 2000) selling_price = (15000 + 2000) + profit result = 20400 return result
Student: At the farm, there are 12 chickens and each of them has 2 legs. How many legs are there in total at the farm?
def solve() -> int: num_chickens = 12 num_legs_per_chicken = 2 total_num_legs = num_chickens * num_legs_per_chicken result = total_num_legs return result
David and Danielle will be celebrating their 3rd anniversary in 9 months. How many months ago did they celebrate their first anniversary?
def solve() -> int: months_in_a_year = 12 current_anniversary = 3 months_to_current_anniversary = current_anniversary * months_in_a_year months_ago_first_anniversary = months_to_current_anniversary - 9 result = months_ago_first_anniversary return result
Daniel is a chef and needs to prepare 10 fruit tarts for a catering event. Each tart requires 1.5 pounds of fruit. Daniel plans to use a mix of peaches, apricots, and plums. Peaches cost $2.50 per pound, apricots cost $3.00 per pound, and plums cost $2.75 per pound. How much will Daniel spend on fruit for the tarts?
def solve() -> int: peaches_price = 2.50 apricots_price = 3.00 plums_price = 2.75 tarts_quantity = 10 fruit_per_tart = 1.5 peaches_cost = peaches_price * fruit_per_tart * tarts_quantity apricots_cost = apricots_price * fruit_per_tart * tarts_quantity plums_cost = plums_price * fruit...
Danny has 10 times as much money as Harry. Harry has three times as much money as Lena. How much money do Danny, Harry, and Lena have combined if Lena has $70?
def solve() -> int: lena = 70 harry = lena * 3 danny = harry * 10 result = lena + harry + danny return result
John decided to plant some trees in his backyard. He plants 1/4 of the trees on the first day, 2/3 of the remaining trees on the second day, and the last remaining trees on the third day. If there were a total of 240 trees to plant, how many trees did he plant on the third day?
def solve() -> int: trees = 240 firstDay = 240 * (1/4) secondDay = (240 * (1/4)) * (2/3) thirdDay = (240 * (1/4) * (2/3)) * (1/1) result = thirdDay return result
A gym offers two types of workout regimes. One regime burns 500 calories per session, and another regime burns 700 calories per session. However, 20% of the calories burned are the same in both regimes. How many calories would be burned using both workout regimes together?
def solve() -> int: regime1 = 500 regime2 = 700 same_calories = 0.2 * (regime1 + regime2) total_calories = regime1 + regime2 - same_calories result = total_calories return result
There are 30 students in a class. The teacher gives each student 2 stickers. The stickers come in 5 different shapes: star, circle, square, triangle, and heart. The teacher has 120 stickers in total. How many stickers of each shape does the teacher have?
def solve() -> int: total = 120 shapes = 5 stickers_per_shape = total / shapes result = stickers_per_shape return result
A car gets 25 miles per gallon of gas. If a road trip is 360 miles, how much gas will the car use?
def solve() -> int: mpg = 25 road_trip_distance = 360 gas_needed = road_trip_distance / mpg result = gas_needed return result
A toy store is having a promotion where every customer who buys a toy gets a free board game. A family of four buys their toy and receives their board game. They had planned to stop for a game later where they would spend $25 altogether, but now that they have the board game they don't have to buy it at the stop. When ...
def solve() -> int: toy_price = 20 board_game_price = 8 total_planned_spending = 25 total_spent = 4 * toy_price amount_saved = board_game_price new_total_planned_spending = total_planned_spending - board_game_price percentage_saved = (amount_saved / new_total_planned_spen...
How many sides does a square have?
def solve() -> int: num_sides = 4 result = num_sides return result
It takes Tom 3 hours to paint a room, and it takes his brother 2 hours to paint the same room. How long does it take if they paint the room together?
def solve() -> int: tom_time = 3 brother_time = 2 total_job = 1 tom_share = total_job / tom_time brother_share = total_job / brother_time combined_share = tom_share + brother_share time_for_both = total_job / combined_share result = time_for_both return result
Olivia runs a hair salon with 4 senior hairstylists and 6 junior stylists. She pays the senior hairstylists $50 for every customer. She pays the junior hairstylists half as much. What is the amount she pays every 10 customers?
def solve() -> int: senior_hairstylists = 4 junior_stylists = 6 senior_payment = 50 junior_payment = senior_payment / 2 customers = 10 senior_total_payment = senior_hairstylists * senior_payment * customers junior_total_payment = junior_stylists * junior_payment * customers ...
Student: A recipe calls for 3/4 cup of sugar to make 12 cookies. How much sugar will be needed to make 30 cookies?
def solve() -> int: sugar_per_cookie = 3/4 / 12 total_cookies = 30 total_sugar = sugar_per_cookie * total_cookies result = total_sugar return result
Liam bought a car and paid $5000 for a deposit. He is going to pay $750 per month for the next 4 years. What is the total cost of the car for Liam?
def solve() -> int: deposit = 5000 monthly_payment = 750 num_payments = 12*4 total_cost = deposit + monthly_payment*num_payments result = total_cost return result
Rebecca puts $60 into her piggy bank every week. She saves her money for 80 weeks until the piggy bank is full. Rebecca goes to the bank to deposit her savings and starts the process again. If she repeats this 4 more times, how much money has she saved in the bank account? Melissa started practicing violin every day fo...
def solve() -> int: weekly_savings = 60 weeks_until_full = 80 total_savings = weekly_savings * weeks_until_full initial_practice_time = 30 increased_practice_time = 45 weeks_practiced = 3 total_practice_time = (initial_practice_time * 2) + (increased_practice_time * (weeks_practiced - 2...
An art museum has 200 paintings and sculptures on display. If 40% are paintings, how many paintings are there in the museum?
def solve() -> int: total_art = 200 painting_percentage = 40 painting_count = (painting_percentage / 100) * total_art result = painting_count return result
Student: - The number of coins with heads facing up in a jar is 7/15 of the total number of coins. If there are 60 coins with tails facing up and 20 coins with both sides showing heads, and the jar has 300 coins, calculate the number of coins with heads facing up and the number of coins with both sides showing tails.
def solve() -> int: total_coins = 300 coins_heads_up = 20 coins_tails_up = 60 coins_heads_up_ratio = 7/15 coins_heads_up_total = total_coins * coins_heads_up_ratio coins_tails_up_total = total_coins - coins_heads_up - coins_tails_up result = (coins_heads_up_total, coins_tails_up_total) ...
san runs for 25 minutes every Monday and Wednesday. On Friday she runs for 35 minutes. On Tuesday and Thursday Susan runs for 20 minutes. There is no running on Saturday and Sunday. How many minutes did Susan run in one week?
def solve() -> int: mins_in_monday_wednesday = 2 * 25 mins_in_friday = 35 mins_in_tuesday_thursday = 2 * 20 total_mins = mins_in_monday_wednesday + mins_in_friday + mins_in_tuesday_thursday result = total_mins return result
Student: - There are 7 bottles of juice and each bottle has 500 ml of juice. If each bottle had 100 ml more juice, how many ml of juice would be in 9 bottles?
def solve() -> int: bottles = 7 ml_per_bottle = 500 extra_ml = 100 total_ml = bottles * ml_per_bottle total_ml_9_bottles = total_ml + (extra_ml * (9 - bottles)) result = total_ml_9_bottles return result
Ana and Bob went grocery shopping. Ana bought twice as much as Bob did. If Bob bought 5 pounds of apples, how many pounds of apples did Ana buy?
def solve() -> int: bob_apples = 5 ana_apples = bob_apples*2 result = ana_apples return result
John can bike 10 miles in 45 minutes. How many miles can he bike in 1 hour?
def solve() -> int: speed_per_minute = 10/45 speed_per_hour = speed_per_minute * 60 result = speed_per_hour return result
Lota and Nina delivered mail in their town. Lota delivered 2/3 of all the mail while Nina delivered 3/4 of what Lota delivered. If they delivered a total of 90 mail, how many mail did Nina deliver?
def solve() -> int: total_mail = 90 lota_mail = total_mail/3 * 2 nina_mail = lota_mail * 3/4 result = nina_mail return result
Student: Max has 18 apples, and he wants to put an equal number of apples into each of 4 bags. How many apples should be in each bag?
def solve() -> int: apples = 18 bags = 4 apples_in_each_bag = apples // bags remaining_apples = apples % bags result = apples_in_each_bag return result
Sophia is buying stickers for her ESL class. She needs to give each of the 18 students 12 stickers. She teaches for 6 days a week and each class has 20 students. If a pack of 120 stickers cost $5, how much did she spend on them all?
def solve() -> int: students_per_class = 20 days_per_week = 6 students_total = 18 stickers_per_student = 12 stickers_per_pack = 120 cost_per_pack = 5 stickers_needed = students_total * stickers_per_student packs_needed = stickers_needed / stickers_per_pack total_packs_needed = p...
Amanda has a pizza that is cut into 16 slices. She gives away 25% of the pizza to her friends, then eats 4 slices. How many slices of pizza are left?
def solve() -> int: pizza_slices = 16 slices_given_to_friends = pizza_slices/4 slices_remaining = pizza_slices - slices_given_to_friends - 4 result = slices_remaining return result
In a survey conducted in a town of 800 people, 48% of the people surveyed reported they own a car. How many people do not own a car?
def solve() -> int: total_people = 800 car_owners = total_people * 0.48 people_without_cars = total_people - car_owners result = people_without_cars return result
A CD rack is 6 feet tall and can hold 700 CDs. If each CD sleeve takes up 1/8 of a foot, how many CDs can the rack hold if double stacked?
def solve() -> int: rack_height = 6 sleeve_width = 1/8 rack_capacity_single = 700 rack_capacity_double = rack_capacity_single * 2 rack_height_available = rack_height * 2 num_sleeves_fit = rack_height_available // sleeve_width num_cds_double_stacked = num_sleeves_fit * rack_capacity_single ...
Kaitlyn is organizing a library with 500 books. Her first helper, Tim, sorts 100 books. Her second helper, Emily, then sorts 1/5 of the remaining books. Her third helper, Zoe, sorts 1/3 of the remaining books. How many books are still left unsorted?
def solve() -> int: books_total = 500 books_sorted_by_tim = 100 books_remaining_after_tim = books_total - books_sorted_by_tim books_sorted_by_emily = books_remaining_after_tim * (1/5) books_remaining_after_emily = books_remaining_after_tim - books_sorted_by_emily books_sorted_by_zoe = ...
``` Tom has to study for 15 minutes. He studies for 8 minutes and then takes a 2 minute break. He repeats this pattern until he finishes his studying. How many breaks does he take?
def solve() -> int: studying = 15 breaks = 0 while studying > 0: studying -= 8 breaks += 1 if studying > 0: studying -= 2 result = breaks - 1 return result
If a man walks at a speed of 3 miles per hour for 20 minutes, and then runs at a speed of 6 miles per hour for the next 40 minutes, what is his average speed for the whole distance?
def solve() -> int: walk_distance = 3 / 60 * 20 run_distance = 6 / 60 * 40 total_distance = walk_distance + run_distance total_time = 60 average_speed = total_distance / total_time * 60 result = f'The average speed of the man for the whole distance is {average_speed} miles per hour.' result ...
arah decides to knit a blanket. She uses 20 balls of wool and it takes her 3 hours to knit each ball. However, she loses 15% of the wool due to knotting and tangling. How long does Sarah spend knitting the blanket?
def solve() -> int: time_per_ball = 3 wool_used = 0.85 * 20 total_time = wool_used * time_per_ball result = total_time return result
Student: Emma and Noah are selling lemonade. Emma sells a cup of lemonade for 0.5 dollars and Noah sells a cup of lemonade for 0.75 dollars. Emma sells 40 cups and Noah sells 24 cups. What percentage of the total revenue does Emma earn?
def solve() -> int: emma_price = 0.5 noah_price = 0.75 emma_cups = 40 noah_cups = 24 total_revenue = emma_price * emma_cups + noah_price * noah_cups emma_revenue = emma_price * emma_cups percentage = emma_revenue / total_revenue * 100 result = percentage return result
Student: - Mr. Jones has 18 chickens and 12 ducks on his farm. He sells half of his chickens and a third of his ducks at the market. How many birds does he have left on his farm?
def solve() -> int: chickens = 18 ducks = 12 chickens_sold = chickens / 2 ducks_sold = ducks / 3 birds_left = chickens + ducks - chickens_sold - ducks_sold result = birds_left return result
A toy car travels 12 meters in 5 seconds. What is its average speed in m/s?
def solve() -> int: distance = 12 time = 5 speed = distance / time result = speed return result
Mia has 30 stickers. She trades 4 stickers for 2 erasers. Each eraser costs 3 stickers. How many stickers does she have left?
def solve() -> int: stickers_left = 30 - 4 stickers_gained = 2 * 3 stickers_left = stickers_left + stickers_gained result = stickers_left return result
Lara can write articles at the rate of one every 25 minutes. She writes for an hour and a half in the morning and then takes a 15-minute break. She then writes for another hour and a half and takes a 45-minute break for lunch. She then writes for the rest of the day until 5:00 p.m. She starts writing at 9:00 a.m. How m...
def solve() -> int: morning_minutes = 90 - 15 afternoon_minutes = 5 * 60 - 90 - 45 - 9 * 60 articles_morning = morning_minutes // 25 articles_afternoon = afternoon_minutes // 25 result = articles_morning + articles_afternoon return result
A freight train carrying 100 cars travels along a track. The train is 1 mile long and takes 5 minutes to pass through a tunnel that is 3 miles long. What is the total time it takes for the train to completely pass through the tunnel and exit on the other side?
def solve() -> int: train_length = 1 tunnel_length = 3 train_speed = (train_length + tunnel_length) / 5 total_time = (train_length + tunnel_length)/train_speed result = total_time return result
A pizza has a diameter of 15 inches. What is the circumference and area of the pizza?
def solve() -> int: diameter = 15 radius = diameter / 2 circumference = 2 * 3.14 * radius area = 3.14 * radius ** 2 result = (circumference, area) return result
A baker makes 12 dozen cupcakes and sells them for 1.5 dollars each. He spends 18 dollars on ingredients and 24 dollars on electricity. What is his profit?
def solve() -> int: cupcakes = 12 * 12 price = 1.5 ingredients = 18 electricity = 24 revenue = cupcakes * price cost = ingredients + electricity profit = revenue - cost result = profit return result
A hospital has 30 patients who require nutrition drinks. Each drink contains 8 ounces of liquid and costs $3.50. If each patient needs 3 drinks per day, what is the total cost of the drinks per day?
def solve() -> int: patients = 30 ounces_per_drink = 8 cost_per_drink = 3.50 drinks_per_day = 3 total_ounces_per_day = patients * drinks_per_day * ounces_per_drink total_cost_per_day = patients * drinks_per_day * cost_per_drink result = total_cost_per_day return result
A fisherman caught 50 fish. He gave 10 fish to his friend. He caught 28 more fish and gave away 12 more fish. How many fish does the fisherman have now?
def solve() -> int: fish = 50 fish -= 10 fish += 28 fish -= 12 result = fish return result
A cylindrical container has a radius of 4 cm and a height of 8 cm. Calculate the volume of the container in cubic centimeters.
def solve() -> int: radius = 4 height = 8 volume = (3.14)*(radius **2) * height result = volume return result
A supermarket sells apples and oranges for $0.75 and $0.90 each, respectively. If a customer buys 5 apples and 3 oranges, how much do they pay (including sales tax of 7%)?
def solve() -> int: apple_price = 0.75 orange_price = 0.9 num_apples = 5 num_oranges = 3 subtotal = (apple_price * num_apples) + (orange_price * num_oranges) sales_tax_rate = 0.07 sales_tax = subtotal * sales_tax_rate total_cost = subtotal + sales_tax result = total_cost return ...
The sum of two consecutive odd numbers is 56. What are the two numbers?
def solve() -> int: x = (56-1)/2 result = (x, x+2) return result
A bakery sold 120 bagels last month. If the bakery sells 15 more bagels every week than the previous week, in how many weeks will the bakery sell a total of 400 bagels?
def solve() -> int: bagels_last_month = 120 bagels_per_week = 0 total_weeks = 0 total_bagels_sold = 0 while total_bagels_sold < 400: bagels_per_week += 15 total_weeks += 1 total_bagels_sold += bagels_per_week result = total_weeks return r...
Anna and Bob share a pizza. The pizza has 8 slices and each slice has 3 olives. Anna eats 3 slices and Bob eats the rest. How many olives did Anna and Bob eat in total?
def solve() -> int: olives_on_pizza = 8 * 3 olives_anna = 3 * 3 olives_bob = olives_on_pizza - olives_anna olives_total = olives_anna + olives_bob result = olives_total return result
Three friends are sharing a pizza equally. If the pizza cost $15, how much does each friend pay?
def solve() -> int: pizza_price = 15 num_friends = 3 split_cost = pizza_price/num_friends result = split_cost return result
The width of a rectangle is 40% of its length. If the length is 25 cm, what is the area of the rectangle?
def solve() -> int: length = 25 width_percentage = 40 width = width_percentage / 100 * length area = length * width result = area return result
Student: A car gets 25 miles per gallon. How much will it cost to travel 500 miles if gas costs $2.50 per gallon?
def solve() -> int: miles_per_gallon = 25 total_miles = 500 gas_price = 2.50 gas_needed = total_miles / miles_per_gallon total_cost = gas_needed * gas_price result = total_cost return result
Timothy has a wooden plank 2 meters long. He cut off half of the plank. How long is the plank now?
def solve() -> int: initial_length = 2 cut_fraction = 0.5 final_length = initial_length * (1 - cut_fraction) result = final_length return result
Alice has a box of chocolates that contains 24 pieces. She wants to share them equally with her three friends, Bob, Cathy, and Dan. However, Bob is allergic to nuts, so he can only eat half of the chocolates that are nut-free. There are 8 chocolates that are nut-free and 16 that are not. How many chocolates will each f...
def solve() -> int: total = 24 friends = 3 nut_free = 8 nutty = 16 bob = nut_free / 2 left = total - bob each = left / friends result = (bob, each) return result
A piece of string that is 20 inches long is divided into two parts in a ratio of 3:4. What is the length of each part?
def solve() -> int: total_parts = 3 + 4 part1 = (3/total_parts) * 20 part2 = (4/total_parts) * 20 result = (part1, part2) return result
Tina and her friends want to go to a water park. The tickets are $25 each. They are also charged a $10 parking fee and an additional $3 per person entrance fee. If there are 8 people going, how much will it cost for all of them to go to the water park?
def solve() -> int: tickets = 25 parking_fee = 10 entrance_fee = 3 num_people = 8 total_cost = (tickets + entrance_fee) * num_people + parking_fee result = total_cost return result
Jane has 8 more cookies than Jack. If Jack has 16 cookies, how many cookies do they need to eat so that they have the same number of cookies?
def solve() -> int: jane_cookies = 16 + 8 cookie_difference = jane_cookies - 16 cookies_to_eat = cookie_difference / 2 result = cookies_to_eat return result
A restaurant bill is $80 and the tip is 20%. What is the total amount to be paid, including the tip?
def solve() -> int: bill = 80 tip_percent = 20 tip_amount = (bill * tip_percent) / 100 total_amount = bill + tip_amount result = total_amount return result
Student: Jessica is planning to travel to Europe. She wants to buy currency for her trip. She needs to buy €400 and the exchange rate is $1.20/€. What is the total she needs to spend in dollars to buy the Euros?
def solve() -> int: euros = 400 exchange_rate = 1.20 total_dollars = euros * exchange_rate result = total_dollars return result
Student: William was playing basketball with his friends. He had twice as many shots as his friend John who had 3 more shots than his friend Jeff. If William had 18 shots, how many shots did Jeff have?
def solve() -> int: william_shots = 18 john_shots = 0 jeff_shots = 0 john_shots = william_shots / 2 jeff_shots = john_shots - 3 result = jeff_shots return result
A flower shop sells 30 more roses than lilies every day. If the shop sells 50 lilies every day, how many roses and lilies will it sell in August?
def solve() -> int: lilies_per_day = 50 roses_per_day = lilies_per_day + 30 days_in_august = 31 total_lilies_in_august = lilies_per_day * days_in_august total_roses_in_august = roses_per_day * days_in_august result = total_lilies_in_august, total_roses_in_august return result
A student borrows $500 from a bank with a 12% annual interest rate. If the student plans to pay back the entire loan in 3 years, how much will the student pay the bank in total?
def solve() -> int: loan_amount = 500 interest_rate = 12 time = 3 interest_amount = loan_amount * (interest_rate / 100) * time total_amount = loan_amount + interest_amount result = total_amount return result
The price of a shirt at a store is $25.00, but due to a sale, it is now 20% off. What is the sale price?
def solve() -> int: original_price = 25.00 percent_off = 20/100 sale_price = original_price - (percent_off * original_price) result = sale_price return result
For a recipe, the cook needs 100g of flour per person and 150g of vegetables every 2 people. If there are 6 people to feed, how much flour and vegetables should the cook use?
def solve() -> int: flour_per_person = 100 vegetables_per_two_people = 150 people_to_feed = 6 flour_needed = flour_per_person * people_to_feed vegetables_needed = (vegetables_per_two_people * (people_to_feed // 2)) result = (flour_needed, vegetables_needed) return result
Student: Lisa is baking cookies for a school fundraiser. She has a recipe that makes 36 cookies with 2 cups of flour, 0.75 cups of sugar, and 0.5 cups of butter. She wants to make as many cookies as possible with 10 cups of flour, 5 cups of sugar, and 3 cups of butter. How many cookies can she make and how much of each...
def solve() -> int: flour = 10 sugar = 5 butter = 3 recipe_flour = 2 recipe_sugar = 0.75 recipe_butter = 0.5 cookies = (flour // recipe_flour) * (sugar // recipe_sugar) * (butter // recipe_butter) leftover_flour = flour % recipe_flour leftover_sugar = sugar % recipe_sugar leftove...
Mike bought a shirt that is on sale for 20% off its original price of $30. If he also used a $5 coupon, what is the final price he paid?
def solve() -> int: original_price = 30 discount_percentage = 20 coupon_amount = 5 discount = original_price * (discount_percentage/100) final_price = original_price-discount-coupon_amount result = final_price return result
Possible questions and python programs: Sofia is making a quilt and decides to use fabric strips of different lengths and colors to create a border. She needs 4 strips of 20 cm, 6 strips of 15 cm, and 8 strips of 10 cm. She can order the exact amount of fabric she needs. How many meters of fabric does Sofia need to ord...
def solve() -> int: strip_20 = 20 / 100 strip_15 = 15 / 100 strip_10 = 10 / 100 border = (4 * strip_20) + (6 * strip_15) + (8 * strip_10) result = round(border, 2) return result
Student: Leo collected 80 coins from different countries. He gave his dad 20 coins and his mom 15 coins. Then he exchanged a quarter of the remaining coins for some new coins at a store. If he wants to have 12 coins of each country, how many countries can he have in his collection?
def solve() -> int: coins = 80 dad_coins = 20 mom_coins = 15 remaining_coins = coins - dad_coins - mom_coins exchanged_coins = remaining_coins // 4 total_coins = remaining_coins + exchanged_coins num_countries = total_coins // 12 result = num_countries return result
If 13% of a class of 30 students are absent, how many students are present in the class?
def solve() -> int: total_students = 30 absent_ratio = 13 / 100 present_ratio = 1 - absent_ratio present_count = int(present_ratio * total_students) result = present_count return result
Tommy and Julie both have software engineering projects due at the same time. Tommy can do his project in 10 hours, while Julie can do hers in 8 hours. They both work at the same efficiency. How much quicker will Julie finish her project compared to Tommy?
def solve() -> int: tommy_time = 10 julie_time = 8 time_diff = tommy_time - julie_time result = time_diff return result
Martha has $193 andshe buys 3 items for $27 each. She also takes out a quarter of her money to buy new clothes. How much money does she have left?
def solve() -> int: total = 193 item1 = 27 item2 = 27 item3 = 27 clothes = total * 0.25 total = total - item1 - item2 - item3 - clothes result = total return result
King's Furniture is having a sale on all beds, discounting them by 35%. If you purchase more than 6 beds, you receive an additional 1/2 off the discounted price of the number of beds over 6. If you buy 8 beds for $800 each, what will the total cost of the beds be?
def solve() -> int: beds = 8 discounted_price = 800 * 0.65 additional_discount = 0 if beds > 6: additional_discount = (beds - 6) * discounted_price * 0.5 total_cost = (6 * discounted_price) + additional_discount result = total_cost return result
Noah is gathering donations for a homeless shelter. In the first week, he received a certain number of donations. In the next two weeks, he received twice as many donations as he did in the first week. If he received 90 donations in total, how many donations did he receive in the first week?
def solve() -> int: x = 90/5 result = x return result
The length of a rectangle is 5cm more than twice the width. If the area of the rectangle is 100 cm², what is the length?
def solve() -> int: area=100 width=(area*(1/2))**(0.5) length=(2*width)+5 result=(length) return result
Student: Rhys and his family had 4 camping trips over the past 6 weeks. Each trip involves packing 9 camping items. How many camping items will they have packed?
def solve() -> int: trips = 4 items_per_trip = 9 total_items = trips * items_per_trip result = total_items return result
In a store, the price of an item is $120. On the festive season, the store increased the price of items by 20% and also gave a discount of 10% on it. What is the final price of the item?
def solve() -> int: price = 120 increase_percentage = 0.20 discount_percentage = 0.10 new_price = price * (1 + increase_percentage) final_price = new_price * (1 - discount_percentage) result = final_price return result
A water tank can hold 2000 gallons of water. If it is currently filled with 1250 gallons, what percentage of the tank is filled?
def solve() -> int: tank_capacity = 2000 current_water = 1250 percentage_filled = (current_water / tank_capacity) * 100 result = percentage_filled return result