question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Sara has 20 stickers in her album. Every week, she gets 5 more stickers from her friends and puts them in her album. She also gives away 2 stickers from her album to her brother every week. How many stickers will she have in her album after 8 weeks?
def solve() -> int: stickers = 0 stickers = stickers + 20 for week in range(8): stickers = stickers + 5 stickers = stickers - 2 result = stickers return result
The age ratios of two persons A and B are 3:5. If the age of A is 27 years, what is the age of B?
def solve() -> int: age_ratio = 3/5 age_A = 27 age_B = age_A/age_ratio result = age_B return result
Katie worked 5 hours every day in February. She worked 7 hours every day in June and 9 hours every day in November. What is the average amount of hours that Katie worked per month in those 3 months?
def solve() -> int: feb_hours = 5 * 28 jun_hours = 7 * 30 nov_hours = 9 * 30 total_hours = feb_hours + jun_hours + nov_hours average_hours = total_hours / 3 result = average_hours return result
A car travels 72 kilometers in 3 hours. How many meters does it travel in one minute?
def solve() -> int: meters = 72 * 1000 minutes = 3 * 60 meters_per_minute = meters / minutes result = meters_per_minute return result
Emily drove for 3 hours at 60km/h and for another 2 hours at 80km/h. What was her average speed for the whole trip?
def solve() -> int: distance1 = 60 * 3 distance2 = 80 * 2 total_distance = distance1 + distance2 total_time = 3 + 2 avg_speed = total_distance / total_time result = avg_speed return result
Student: A school has 850 students. If 25% of them are boys, how many girls are there in the school?
def solve() -> int: total_students = 850 percentage_boys = 0.25 num_boys = total_students * percentage_boys num_girls = total_students - num_boys result = num_girls return result
Josephine is considering whether to go to a concert or a movie. The concert tickets cost $40 and the movie costs $12. If Josephine goes to the concert, she will spend 3 hours and increase her productivity by 15% the next day, but if she goes to the movie, she can finish reading the book she started. How much more per h...
def solve() -> int: ticket_concert = 40 ticket_movie = 12 time_concert = 3 productivity_increase = 0.15 cost_concert = ticket_concert cost_movie = ticket_movie productivity_concert = productivity_increase / time_concert productivity_movie = 0 more_per_hour = productivi...
A farmer has a rectangular field which is 60 meters long and 40 meters wide. If the farmer wants to plant rice on 70% of the field, how many square meters of land will be left unplanted?
def solve() -> int: total_area = 60 * 40 rice_area = 0.70 * total_area unplanted_area = total_area - rice_area result = unplanted_area return result
Diego has 6 more than four times the number of toys as Bria. If Bria has 3 toys, how many toys does Diego have?
def solve() -> int: number_of_toys_Bria = 3 number_of_toys_Diego = 4 * number_of_toys_Bria + 6 result = number_of_toys_Diego return result
Max has 120 balls in which some are in 8 baskets and 12 balls are not in any basket. His friend gave him 60 more balls. If all balls must be placed in a basket, how many more baskets does he need?
def solve() -> int: balls_in_baskets = 120 - 12 extra_balls = 60 total_balls = balls_in_baskets + extra_balls baskets_needed = (total_balls // 8) + 1 extra_baskets_needed = baskets_needed - 8 result = extra_baskets_needed return result
At a pet store, there are 20 dogs, 10 cats, and 5 birds. If each customer buys an average of 3 pets, how many customers does the store need to sell all the animals in the store?
def solve() -> int: dogs = 20 cats = 10 birds = 5 total_animals = dogs + cats + birds customers = total_animals/3 result = customers return result
If 10 people can shovel 20,000 pounds of coal in 14 days, how many people must work for 12 days to shovel 25,000 pounds?
def solve() -> int: people = 10 days = 14 coal_shoveled = 20000 coal_target = 25000 days_target = 12 extra_coal = coal_target - coal_shoveled shoveled_per_day = coal_shoveled / days extra_people = (extra_coal / shoveled_per_day) * (days_target / days) result = people + ext...
Michelle works in a factory and earns $18 for each hour worked. She is entitled to a bonus of $50 if she arrives on time every day of the week. She worked for 30 hours this week and was late once. What will be her total payout?
def solve() -> int: hours_worked = 30 hourly_rate = 18 bonus = 50 days_in_week = 7 days_on_time = days_in_week - 1 total_pay = hours_worked * hourly_rate bonus_pay = 0 if days_on_time == days_in_week: bonus_pay = bonus total_payout = total_pay + bonus_pay ...
John is currently 30 years old. His younger sister is half his age. When John turns 40, how old will his sister be?
def solve() -> int: john_age = 30 sister_age = john_age / 2 sister_age_in_10_years = sister_age + 10 result = f'When John turns 40, his sister will be {sister_age_in_10_years} years old.' result = sister_age_in_10_years return result
A restaurant has 500 chairs and gets 15% more. How many chairs are there now?
def solve() -> int: current_chairs = 500 percent_increase = 0.15 increase_amount = current_chairs * percent_increase total_chairs = current_chairs + increase_amount result = total_chairs return result
William walked for 2 hours on Monday, and twice as long on Tuesday. On Wednesday, he walked half as much as he did on Monday. How many hours did William walk in total in the three days?
def solve() -> int: monday_hours = 2 tuesday_hours = 2 * monday_hours wednesday_hours = monday_hours / 2 total_hours = monday_hours + tuesday_hours + wednesday_hours result = total_hours return result
Tyler is going on a road trip with friends. They rent an SUV that costs $80 per day plus $0.20 per mile. If they drive 500 miles round trip and rent the car for 3 days, how much does each person owe for the car rental?
def solve() -> int: days_rented = 3 cost_per_day = 80 total_miles = 500 cost_per_mile = 0.20 total_rental_cost = (days_rented * cost_per_day) + (total_miles * cost_per_mile) num_people = 4 cost_per_person = total_rental_cost / num_people result = cost_p...
A toaster oven costs $60, but is on sale for 15% off. If you have a coupon for an additional 20% off, what is the final price?
def solve() -> int: original_price = 60 percent_discount = 0.15 discounted_price = original_price - (original_price * percent_discount) discount_code = 0.2 final_price = discounted_price - (discounted_price * discount_code) result = final_price return result
arah has 50 less than four times as many siblings as Jane. Lena has 2/5 times as many siblings as Jane. If Jane has 100 siblings, how many more siblings does Sarah have more than Lena?
def solve() -> int: sarah = 4*100 - 50 lena = 2/5 * 100 difference = sarah - lena result = difference return result
A bakery sells three types of pies: apple, cherry, and blueberry. Each pie costs $10. The bakery sold 60 pies in total. Twenty-five percent of the pies sold were apple, forty percent of them were cherry, and the rest were blueberry. How much money did the bakery make from selling blueberry pies?
def solve() -> int: apple = 0.25 * 60 cherry = 0.4 * 60 blueberry = 60 - apple - cherry revenue_blueberry = blueberry * 10 result = revenue_blueberry return result
A jar contains 24 red and 16 blue marbles. Kelly takes out 3 red and 2 blue marbles from the jar. What fraction of the remaining marbles in the jar are red?
def solve() -> int: from fractions import Fraction r = 24 b = 16 r -= 3 b -= 2 remaining = r + b fraction = Fraction(r, remaining) result = fraction return result
Leon bought 45 products from the shop. He gave 15 of them to his friend and donated another 3 to charity. He kept 27 of them in his house. How many products did he keep at his house?
def solve() -> int: number_total = 45 number_friend = 15 number_charity = 3 result = number_total-(number_friend+number_charity) result = 27 return result
A jar contains 250 grams of peanuts. If a serving of peanuts is 30 grams, how many servings are in the jar?
def solve() -> int: total_peanuts = 250 serving_size = 30 num_servings = total_peanuts // serving_size result = num_servings return result
A company has 150 computers in its office. The CEO decides to upgrade the technology by buying new computers. On Tuesday, he buys a quarter of the number of computers he bought on Monday. How many computers has the company added in total?
def solve() -> int: monday_computers = 100 tuesday_computers = monday_computers / 4 total_computers_added = monday_computers + tuesday_computers result = total_computers_added return result
Leo has 60 pencils. He uses a tenth of them for his homework, and gives a fifth of the remaining pencils to his classmates. How many pencils does Leo have left?
def solve() -> int: pencils = 60 pencils_used = pencils // 10 pencils_given = (pencils - pencils_used) // 5 pencils_left = pencils - pencils_used - pencils_given result = pencils_left return result
Thomas ate 5 apples from the orchard at 4 cents each, how much money did Thomas spend on apples?
def solve() -> int: total = 0 for i in range(5): total = total + 0.04 result = total return result
Billy had to study 3 times as much as Jane for a project. If Jane had to study 36 hours, how many hours did Billy have to study?
def solve() -> int: hours_jane = 36 hours_billy = hours_jane * 3 result = hours_billy return result
A carpet company charges $30 per square yard for installation. If Tim wants to install a carpet that is 12 feet by 14 feet in his bedroom, how much will the installation cost?
def solve() -> int: cost_per_square_yard = 30 width = 12/3 length = 14/3 area_in_square_yards = width * length total_cost = area_in_square_yards * cost_per_square_yard result = total_cost return result
A store charges $90 for a TV with a 20% discount. What was the original price of the TV?
def solve() -> int: discounted_price = 90 discount_percent = 20 original_price = discounted_price / ((100 - discount_percent) / 100) result = original_price return result
Student: There are 5 times as many daisies as tulips in a garden. If there are 25 tulips, how many daisies are there?
def solve() -> int: tulips = 25 daisies = tulips * 5 result = daisies return result
Student: If a pizzeria charges $5 for a regular size pizza and $8 for a large size pizza, how much change would a customer get if they gave the cashier $20 for 2 regular pizzas?
def solve() -> int: regular_price = 5 large_price = 8 regular_quantity = 2 large_quantity = 0 total_cost = regular_price * regular_quantity + large_price * large_quantity given_amount = 20 change = given_amount - total_cost result = change return result
A grocery store sells 8 apples for $4. If a customer wants to buy 32 apples, how much will they have to pay?
def solve() -> int: apples = 32 price_per_apple = 4/8 total_price = apples*price_per_apple result = total_price return result
A recipe for pancakes requires 2 cups of flour, 1.5 cups of milk, and 2 eggs. How many pancakes can you make with 6 cups of flour, 4.5 cups of milk, and 6 eggs?
def solve() -> int: pancakes_per_flour = 6 / 2 pancakes_per_milk = 4.5 / 1.5 pancakes_per_eggs = 6 / 2 batches = min(pancakes_per_flour, pancakes_per_milk, pancakes_per_eggs) pancakes = batches * 4 result = round(pancakes) return result
A black limousine is three times the length of a white sedan. The length of the white sedan is also one-fifth the length of a purple truck. If the purple truck and black limousine are parked next to each other, what length of the black limousine might the purple truck driver see if the limousine is 75 feet long?
def solve() -> int: white_sedan_length = 75 / 3 purple_truck_length = white_sedan_length * 5 length_seen_by_purple_truck_driver = purple_truck_length - 75 result = length_seen_by_purple_truck_driver return result
Student: An apple pie recipe calls for 6 apples that are peeled and sliced. If each apple costs $0.50, how much will it cost to make the pie?
def solve() -> int: apples = 6 apple_cost = 0.5 total_apple_cost = apples * apple_cost result = total_apple_cost return result
Student: Jamie is saving money for his trip to Disneyland, he saved $3000. If he spends 1/3rd of it on tickets, 1/5th of the remaining on hotel accommodations, and 1/4th of the rest on food. How much money does he have left?
def solve() -> int: total = 3000 tickets = total / 3 remaining = total - tickets hotel = remaining / 5 remaining = remaining - hotel food = remaining / 4 remaining = remaining - food result = remaining return result
arah has a recipe that calls for 2 cups of flour, 1 cup of sugar, 3 eggs, and 1/4 cup of butter. She wants to make half of the recipe. How much of each ingredient does she need?
def solve() -> int: flour = 2 / 2 sugar = 1 / 2 eggs = 3 / 2 butter = 1/4 / 2 result = flour, sugar, eggs, butter return result
A shirt is marked down from $35 to $28. What is the discount percentage?
def solve() -> int: original_price = 35 discount_percentage = ((original_price-28) / original_price) * 100 result = round(discount_percentage,2) return result
Ben collected 24 bottles and 18 cans for recycling. He got 10 cents for each bottle and 5 cents for each can. He used half of the money he earned to buy a book. How much did the book cost?
def solve() -> int: bottles = 24 cans = 18 bottle_rate = 0.1 can_rate = 0.05 money = bottles * bottle_rate + cans * can_rate book = money / 2 result = book return result
Last week, Ethan had 80 pencils and Olivia had three times as many pencils as Ethan. Yesterday, Ethan gave 13 pencils to Sophia and Olivia gave Sophia 12 more pencils than Ethan gave. How many pencils did Sophia get?
def solve() -> int: ethan_pencils = 80 olivia_pencils = 3 * ethan_pencils ethan_gave = 13 olivia_gave = ethan_gave + 12 sophia_got = ethan_gave + olivia_gave result = sophia_got return result
A park covers an area of 14000 sq. ft. If the length of the park is 200 ft, what is the width of the park?
def solve() -> int: area = 14000 length = 200 width = area / length result = width return result
If you have $50 and you spend 10% of it each day for 7 days, how much money will you have left after the 7 days?
def solve() -> int: money = 50 percentage = 10 days = 7 amount_spent = money * (percentage/100) result = money - (amount_spent * days) return result
Student: The elevation of Mount Everest is 29,029 feet. If the temperature decreases 5 degrees Fahrenheit for every 1,000-foot increase in elevation, then what is the temperature at the top of Mount Everest if the temperature at the base of the mountain is 60 degrees Fahrenheit?
def solve() -> int: everest_elevation = 29029 base_temp = 60 temp_decrease_per_1000ft = 5 elevation_difference = everest_elevation / 1000 temp_decrease = elevation_difference * temp_decrease_per_1000ft everest_temp = base_temp - temp_decrease result = everest_temp return result
A toy shop has 80 teddy bears and 100 dolls. How many gift packages of 3 toys each can they make using all the stock?
def solve() -> int: teddy_bears = 80 dolls = 100 total_toys = teddy_bears + dolls gift_packages = total_toys // 3 result = gift_packages return result
Cindy has 15 stickers. She gives 2 stickers to each of her 4 friends. She also receives 3 stickers from her teacher. How many stickers does she have left?
def solve() -> int: stickers = 15 friends = 4 stickers_per_friend = 2 stickers_from_teacher = 3 stickers_given_to_friends = stickers_per_friend * friends stickers_after = stickers + stickers_from_teacher - stickers_given_to_friends result = stickers_after return resu...
Samantha started a 312-page book on Sunday and aims to finish it by Saturday. She read 42 pages on Sunday, 65 pages on Monday, and 89 pages on Tuesday. If she can read four times as much on Saturday as she does on Friday, how many pages does she need to finish on Friday to complete the book within her goal?
def solve() -> int: sunday_pages = 42 monday_pages = 65 tuesday_pages = 89 total_pages_read = sunday_pages + monday_pages + tuesday_pages pages_left = 312 - total_pages_read friday_pages = pages_left / 5 saturday_pages = 4 * friday_pages result = friday_pages return re...
Student: Darren has 8 cats in his house and each cat has 9 whiskers, how many whiskers in total does Darren have?
def solve() -> int: num_cats = 8 num_whiskers = 9 total_whiskers = num_cats * num_whiskers result = total_whiskers return result
``` A company has 100 employees, and 40% of them are women. How many women are there in the company?
def solve() -> int: employees = 100 women_percentage = 40 women = employees * (women_percentage / 100) result = women return result
A grocery store sells 3 types of fruits, Apples, Bananas, and Oranges. The cost per pound for each fruit is $1 for Apples, $1.5 for Bananas, and $2 for Oranges. If a customer buys 5 pounds of Apples, 4 pounds of Bananas, and 2 pounds of Oranges, what is the total cost of the customer’s purchase?
def solve() -> int: apples_price = 1 bananas_price = 1.5 oranges_price = 2 apples_quantity = 5 bananas_quantity = 4 oranges_quantity = 2 total_cost = (apples_price * apples_quantity) + (bananas_price * bananas_quantity) + (oranges_price * oranges_quantity) result = total_cost return ...
Barbara brought 30 muffins to work and wanted to share them evenly among 5 coworkers. How many will each person get?
def solve() -> int: muffins_brought = 30 number_of_coworkers = 5 muffins_per_person = muffins_brought/number_of_coworkers result = muffins_per_person return result
Samantha prepared a cake that required 50% more ingredients than the cake she usually makes. The ingredients for her usual cake cost $20, and for the newest cake they cost $5 per extra unit. What was the total amount spent on ingredients to make the new cake?
def solve() -> int: usual_cake_ingredients = 20 new_cake_ingredients = usual_cake_ingredients * 1.5 extra_ingredients = new_cake_ingredients - usual_cake_ingredients total_cost = usual_cake_ingredients + (extra_ingredients * 5) result = total_cost return result
A small car uses 12 gallons of gas to travel 400 miles. If a person plans to travel 800 miles, how many gallons of gas will the car consume?
def solve() -> int: milesPerGallon = 400/12 distanceToTravel = 800 gallonsNeeded = distanceToTravel/milesPerGallon result = gallonsNeeded return result
Student: Alice is making a smoothie. She uses 200 milliliters of milk that has 50 calories per 100 milliliters, 100 grams of strawberries that have 33 calories per 100 grams, and a tablespoon of honey that has 64 calories. How many calories are in the smoothie?
def solve() -> int: milk_ml = 200 milk_cal_per_100ml = 50 strawberries_g = 100 strawberries_cal_per_100g = 33 honey_cal = 64 milk_cal = (milk_ml / 100) * milk_cal_per_100ml strawberries_cal = (strawberries_g / 100) * strawberries_cal_per_100g total_cal = milk_cal + strawberries_cal + hon...
A furniture shop sold 600 chairs for a month. During the first week, 80 chairs were sold. In the second week, twice the number of chairs sold in the first week was sold. An equal number of chairs were sold in the third and fourth week. How many chairs were sold in each of the third and fourth week?
def solve() -> int: total_chairs = 600 week1 = 80 week2 = 2 * week1 remaining_chairs = total_chairs - week1 - week2 week3 = remaining_chairs / 2 week4 = week3 result = week3 return result
There is a full tank of 65 liters of water. If 11 liters are used daily, how many days will the tank of water last?
def solve() -> int: total_water = 65 daily_usage = 11 days = total_water/daily_usage result = days return result
An organizer at a convention initially ordered 12 dozen t-shirts for the event. However, due to an increase in the number of expected attendees, they ended up ordering 4 times the original number of t-shirts. If each t-shirt was given out to an attendee, how many attendees received a t-shirt?
def solve() -> int: initial_dozen = 12 initial_tshirts = initial_dozen * 12 new_tshirts = initial_tshirts * 4 result = new_tshirts result return result
Bob is planning a birthday party for his daughter. He needs to purchase 4 large pizzas and each pizza contains 8 slices. The party will have 24 people attending. How many leftover pizza slices will Bob have?
def solve() -> int: num_pizzas = 4 num_slices = num_pizzas * 8 num_people = 24 leftovers_slices = num_slices - num_people result = leftovers_slices return result
In a math competition, a contestant scores 80 points in the first round and 3 times as many points in the second round. What is the total score for the contestant?
def solve() -> int: first_round_score = 80 second_round_score = 3 * first_round_score total_score = first_round_score + second_round_score result = total_score return result
At a picnic, there are 20 people who eat 3 hot dogs each and 30 people who eat 2 hot dogs each. If there was a total of 120 hot dogs, how many hot dogs were left over?
def solve() -> int: hot_dogs_total = 120 hot_dogs_first_group = 20*3 hot_dogs_second_group = 30*2 hot_dogs_eaten_total = hot_dogs_first_group + hot_dogs_second_group hot_dogs_leftover = hot_dogs_total - hot_dogs_eaten_total result = hot_dogs_leftover return result
Student: If the sale tax rate is 8% and a shirt costs $20, how much will the shirt cost after tax?
def solve() -> int: sale_tax_rate = 0.08 shirt_cost = 20 cost_after_tax = shirt_cost + (shirt_cost * sale_tax_rate) result = cost_after_tax return result
A painter can finish painting a room in 6 hours. If he hires an assistant who's half as efficient, how long will it take for them both to finish painting the room together?
def solve() -> int: painter_hours = 6 assistant_efficiency = 0.5 work_done_in_one_hour_together = 1 painter_efficiency = work_done_in_one_hour_together / painter_hours assistant_efficiency = painter_efficiency * assistant_efficiency total_efficiency = painter_efficiency + assistant_efficiency ...
Diego needs to fill up his gas tank for his upcoming road trip. The gas station sells gas for $2.90 per gallon. If Diego's tank holds 15 gallons and he already has 2 gallons, how much will it cost to fill up the tank?
def solve() -> int: gas_price = 2.90 tank_size = 15 current_gas = 2 needed_gas = tank_size - current_gas total_cost = needed_gas * gas_price result = total_cost return result
A rectangular box has a length of 9cm, a width of 4cm, and a height of 6cm. What is the volume of the box in cubic centimeters?
def solve() -> int: length = 9 width = 4 height = 6 volume = length * width * height result = volume return result
Max has a rectangular garden that is 12 meters long and 8 meters wide. He wants to fence the garden with wood planks that are 1 meter long and cost $2 each. How many wood planks does he need and how much will it cost?
def solve() -> int: perimeter = 2 * (12 + 8) planks = perimeter / 1 cost = planks * 2 result = [planks, cost] return result
Sarah bought 2 sweatshirts for $20 each and 3 pairs of socks for $5 each. If she paid with a $50 bill, how much change must she get?
def solve() -> int: sweatshirt_price = 20 socks_price = 5 total_cost = (2*sweatshirt_price) + (3*socks_price) paid = 50 change = paid - total_cost result = change return result
Victor is saving to buy a new guitar that cost $700, but he also wants to have some extra money for a vacation that will require $300. He can save $75 per week, but he has to pay $40 per week for his tuition. If he has $500 in his savings already, how long will it take him to save enough to buy the guitar and go on a v...
def solve() -> int: guitar_cost = 700 vacation_cost = 300 weekly_savings = 75 weekly_tuition = 40 current_savings = 500 weekly_savings -= weekly_tuition total_savings_needed = guitar_cost + vacation_cost - current_savings weeks_needed = total_savings_needed / weekly_savings result = ...
Sarah can solve 12 math problems in 18 minutes and Sophie can solve the same 12 math problems in 15 minutes. How many minutes would it take both of them to solve 30 math problems?
def solve() -> int: sarah_problems = 12 sarah_time = 18 sophie_problems = 12 sophie_time = 15 sarah_rate = sarah_problems / sarah_time sophie_rate = sophie_problems / sophie_time combined_rate = sarah_rate + sophie_rate time_taken = 30 / combined_rate result ...
Kevin has $25. He wants to buy a toy that costs $12. How much money does he have left?
def solve() -> int: money = 25 toy = 12 left = money - toy result = left return result
Joanna has $128 in her fund. The number of $5 bills is 4 times the number of $10 bills. How many $5 bills does Joanna have?
def solve() -> int: five_bills = 0 ten_bills = 0 total = 128 five_bills = total // 5 ten_bills = total // 10 five_bills = ten_bills * 4 result = five_bills return result
Student: A car travels 120 miles in 2 hours. What is its speed in miles per hour (mph)?
def solve() -> int: distance = 120 time = 2 speed = distance / time result = speed return result
A company produces 1500 units of a product every day. If the production efficiency drops by 20%, how many units will they produce each day?
def solve() -> int: drop = 1500 * 0.2 new_production = 1500 - drop result = new_production return result
Mary has $100 in her savings account. She saves $25 per week for 4 weeks, then $50 per week for the next 3 weeks. What is her average savings per week over the 7 weeks?
def solve() -> int: total_savings = 100 + (25*4) + (50*3) average_savings = total_savings / 7 result = average_savings return result
Student: A rectangle has a length of 6cm and a width of 4cm. What is its area in square centimeters?
def solve() -> int: length = 6 width = 4 area = length * width result = area return result
Mr. White borrowed $2000 from his bank and is required to pay it back in 6 months with an additional 10% interest rate. How much will Mr. White be required to pay back?
def solve() -> int: principal_amount = 2000 interest_rate = 0.10 months = 6 interest = principal_amount * interest_rate total_amount = principal_amount + interest result = total_amount return result
A cashier is counting change for a cash register. Each transaction needs 4 quarters, and there will be a total of 15 transactions. How many quarters will the cashier need to count in total?
def solve() -> int: quarters_per_transaction = 4 total_transactions = 15 total_quarters = quarters_per_transaction * total_transactions result = total_quarters return result
Hannah is 7 years older than half the age of Ben. If Ben is currently 18, calculate Hannah's age.
def solve() -> int: age_ben = 18 age_hannah = (age_ben//2) + 7 result = age_hannah return result
Sarah received grades of 85, 90, 95, and 80 in her first semester of college. If she wants an overall average of at least 90 percent, what minimum average should she score in her second semester?
def solve() -> int: grade1 = 85 grade2 = 90 grade3 = 95 grade4 = 80 total_grades = grade1 + grade2 + grade3 + grade4 num_grades = 4 desired_average = 90 minimum_average = (desired_average * (num_grades + 1) - total_grades) / num_grades result = minimum_average ...
Student: A rectangular field measures 50 meters by 40 meters. If a fence costs $5 per meter, how much will it cost to fence the field?
def solve() -> int: length = 50 width = 40 cost_per_meter = 5 perimeter = 2 * (length + width) total_cost = perimeter * cost_per_meter result = total_cost return result
Student: A shopkeeper bought 200 pencils for $20. He sold some of them at 5 cents per pencil and the rest at 3 cents per pencil. If he earned a total of $4 by selling them all, how many pencils were sold at 5 cents per pencil?
def solve() -> int: pencils_bought = 200 cost_per_pencil = 20 / pencils_bought price_5c = 0.05 price_3c = 0.03 total_earning = 4 pencils_sold_5c = total_earning / price_5c pencils_sold_3c = pencils_bought - pencils_sold_5c total_pencils_sold = pencils_sold_5c + pencils_sold_3c total_...
John can swim twice as fast as his sister Lily. If John can swim across a 300-meter long river in 6 minutes, how long will it take for Lily to do the same crossing?
def solve() -> int: john_speed = 300 / 6 lily_speed = john_speed / 2 lily_time = 300 / lily_speed result = lily_time return result
A jar has 4 red, 5 blue and 6 green balls. If a ball is selected randomly, what is the probability of selecting a blue ball?
def solve() -> int: total_balls = 4 + 5 + 6 blue_balls = 5 probability = blue_balls / total_balls result = probability return result
Jack can lift twice as much weight as Jill. Jill can only lift a quarter as much weight as Dave. If Dave can lift 200 pounds, how much weight can Jack lift? result =? ?
def solve() -> int: weight_Dave = 200 weight_Jill = weight_Dave/4 weight_Jack = weight_Jill*2 result = weight_Jack return result
Adam spends 15 hours a week practicing soccer. He spends 1 hour per day painting. He sleeps for 8 hours everyday. He attends a 2-hour class 3 days a week. He spends 5 hours working each day. How much time does he have left in his week?
def solve() -> int: soccer_hours = 15 painting_hours = 1 * 7 sleep_hours = 8 * 7 class_hours = 2 * 3 work_hours = 5 * 7 total_hours = 7 * 24 free_hours = total_hours - soccer_hours - painting_hours - sleep_hours - class_hours - work_hours result = free_hours return re...
Student: Gina's family are going for a holiday. The total cost for the hotel stay and entrance tickets cost $700. If the family have a 10% discount coupon, calculate the amount of money they will need to pay after the discount?
def solve() -> int: cost = 700 discount = 0.1 discounted_cost = cost * (1 - discount) result = discounted_cost return result
Andy collected some stamps and put them in albums. There were 12 stamps in each album but 4 stamps were not in any album. He gave away 3 albums to his sister and he has 6 albums with him. How many stamps did Andy collect in the beginning?
def solve() -> int: stamps_per_album = 12 stamps_not_in_album = 4 albums_given_away = 3 albums_with_andy = 6 total_albums = albums_given_away + albums_with_andy total_stamps = total_albums * stamps_per_album + stamps_not_in_album result = total_stamps return result
A rectangular lawn is 40 m long and 30 m wide. If it is surrounded by a path of uniform width of 2 m, what is the area of the path?
def solve() -> int: length = 40 width = 30 path_width = 2 length_with_path = length + 2*path_width width_with_path = width + 2*path_width path_area = (length_with_path*width_with_path) - (length*width) result = path_area return result
Student: David purchased a table at $100 and spent $50 to refinish it. If he sold the table for $220 afterwards, calculate the profit he made from selling the table.
def solve() -> int: cost_of_table = 100 cost_of_refinishing = 50 selling_price = 220 total_cost = cost_of_table + cost_of_refinishing profit = selling_price - total_cost result = profit return result
``` A pizza place offers a 20% discount on orders over $20. If you order a pizza for $25, how much will you save?
def solve() -> int: order_amount = 25 discount_threshold = 20 discount = 0.2 if order_amount > discount_threshold: savings = order_amount * discount else: savings = 0 result = f'You will save ${savings} with the discount.' result = savings return result
A snack pack contains 5 chocolates and 10 candies, if you eat 2 chocolates and 4 candies, how many chocolates and candies are left in the snack pack?
def solve() -> int: chocolates_in_pack = 5 candies_in_pack = 10 chocolates_eaten = 2 candies_eaten = 4 chocolates_left = chocolates_in_pack - chocolates_eaten candies_left = candies_in_pack - candies_eaten result = chocolates_left + candies_left return result
Student: Sophia wants to buy a book that costs $15. She has a $10 gift card. If she uses the gift card, how much money does she still need to buy the book?
def solve() -> int: book_price = 15 gift_card = 10 remaining_cost = book_price - gift_card result = remaining_cost return result
A pizza restaurant sells pizzas for $15 each. They make a total of $600 in sales. How many pizzas did they sell?
def solve() -> int: price_per_pizza = 15 total_sales = 600 num_pizzas = total_sales // price_per_pizza result = num_pizzas return result
Student: The width of a rectangle is 11 centimeters and the length is 7 centimeters. What is the area of the rectangle?
def solve() -> int: width = 11 length = 7 area = width * length result = area return result
A car travels 150 kilometers in two hours. What is the average speed of the car in kilometers per hour?
def solve() -> int: distance = 150 time = 2 speed = distance / time result = speed return result
A local amusement park charges $32 for a ticket and $16 for a parking pass. If a family of four is planning on going to the amusement park, how much will it cost them?
def solve() -> int: ticket_price = 32 parking_price = 16 num_people = 4 total_cost = (ticket_price * num_people) + (parking_price * num_people) result = total_cost return result
Olivia and Benjamin are working on a group project. They have completed 9 out of 20 pages but Olivia accidentally spilled coffee on 2 pages. How many more pages do they need to complete?
def solve() -> int: completed_pages = 9 total_pages = 20 spilled_pages = 2 remaining_pages = total_pages - completed_pages - spilled_pages result = remaining_pages return result
Amy and Ben went to lunch. They shared an appetizer that cost $10.00. Amy's entree was $16.50 and Ben's entree was $18.00. They each ordered a drink for $3.50 and left a 25% tip. What was the entire price of their lunch?
def solve() -> int: num_drinks = 2 drink_price = 3.50 appetizer_price = 10.00 subtotal = appetizer_price + (16.50 + 18.00) + (num_drinks * drink_price) tip_percent = 25 tip = subtotal * tip_percent / 100 total_bill = subtotal + tip result = total_bill return result
Max, Olivia, and Sophia are studying for a test. Max studies for 2 hours, Olivia studies for 3 hours, and Sophia studies for 6 hours. How many more hours did Sophia study than Max and Olivia combined?
def solve() -> int: max_hours = 2 olivia_hours = 3 sophia_hours = 6 total_hours = max_hours + olivia_hours difference = sophia_hours - total_hours result = difference return result
If the sum of the ages of a mother and daughter is six times the age of the daughter, and the mother is 35 years old, what is the age of the daughter?
def solve() -> int: result = 7 return result
Jacob has bought a new car. The total cost of the car and the tax he paid for the car was $32,875. The car itself cost $25,000. What was the tax he paid?
def solve() -> int: tax = 32875 - 25000 result = tax return result
If Jack weighs 120 lbs and is half as much as what Natalie weighs, and Natalie weighs 40 lbs less than what Will weighs, what is the total weight of the three?
def solve() -> int: jack_weight = 120 natalie_weight = jack_weight * 2 will_weight = natalie_weight + 40 total_weight = jack_weight + natalie_weight + will_weight result = total_weight return result