question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
If a loaf of bread costs $2.50 and Tom has $15, how many loaves of bread can he buy?
def solve() -> int: bread_cost = 2.5 tom_money = 15 num_loaves = tom_money // bread_cost result = num_loaves return result
Student: If there are 59 bags of candy and each bag contains 8 candy pieces, how many pieces of candy are there in total?
def solve() -> int: bags = 59 pieces_per_bag = 8 total_pieces = bags * pieces_per_bag result = total_pieces return result
There are 15 apples. If I give 1/3 of the apples to my friend, and then split the remaining apples equally between us, how many apples will each of us get?
def solve() -> int: apples = 15 friend_apples = apples / 3 remaining_apples = apples - friend_apples apples_each = remaining_apples / 2 result = apples_each return result
A delivery truck drives 70 miles in the first hour, 65 miles in the second hour, and 60 miles in the third hour. What is the truck's average speed in miles per hour for the entire trip?
def solve() -> int: miles = 70 + 65 + 60 hours = 3 average_speed = miles / hours result = average_speed return result
In the spelling contest, Jacob has 10 points, Emily has 6 points, and Sarah has five times the combined points of Jacob and Emily. If their opponents' team has a total of 80 points, how many points are their team behind? Sophie has a set of 8 books. Each book costs $10, except for one which costs $15. If Sophie decides...
def solve() -> int: jacob_points = 10 emily_points = 6 sarah_points = 5 * (jacob_points + emily_points) opponents_points = 80 team_points = jacob_points + emily_points + sarah_points points_behind = opponents_points - team_points result = points_behind num_books = 8 ...
Jack put his cookies in the oven after it finished heating. The recommended time was 15 minutes for them to be fully cooked. He put them in for 5 minutes. How many minutes remained?
def solve() -> int: time_in_oven = 5 recommended_time = 15 time_remaining = recommended_time - time_in_oven result = time_remaining return result
Andrew has four times as many apples as Louise. If Louise has 6 apples, how many apples does Andrew have?
def solve() -> int: louise_apples = 6 andrew_apples = 4 * louise_apples result = andrew_apples return result
Max is counting the number of cars and people in different cities he visits. The first city has 10,000 cars and 20,000 people. The second city has 15,000 cars and 25,000 people. The third city has 20,000 cars and Emma and Olivia decided to have a singing competition. Emma sang for 4 hours and then another 3 hours after...
def solve() -> int: city1_cars = 10000 city1_people = 20000 city2_cars = 15000 city2_people = 25000 city3_cars = 20000 emma_singing_hours = 4 emma_resting_hours = 3 emma_resting_minutes = 30 olivia_singing_hours = (emma_singing_hours + emma_resting_hours) * (1 + 1...
A mall has 24 shops and half of them are rented. The remaining shops are all at three-quarters capacity. If each shop has 3 salespersons and 2 customers, how many people are in the mall?
def solve() -> int: num_shops = 24 rented_shops = num_shops / 2 vacant_shops = num_shops - rented_shops capacity = 0.75 occupied_shops = vacant_shops * capacity total_people = (rented_shops + occupied_shops) * (3 + 2) result = total_people return result
Mallory went to the fair and had 12 tickets. If she used half of her tickets, how many tickets does Mallory have left?
def solve() -> int: tickets = 12 fraction = 1/2 remaining_tickets = tickets - fraction * tickets result = int(remaining_tickets) return result
A laptop cost $1,200 and each year its value decreases by 20%. How much will it be worth in three years?
def solve() -> int: laptop_cost = 1200 cost_decrease = 0.2 laptop_value = laptop_cost * (1 - cost_decrease) ** 3 result = laptop_value return result
Dena has 1 fewer baskets than boxes. If she has 6 baskets, how many items does Dena have in total?
def solve() -> int: baskets = 6 boxes = baskets - 1 items = baskets + boxes result = items return result
After working for 8 hours a day, Lilly completed 3/8 of a project. If the project requires 35 total hours to complete, how long will it take Lilly to finish the project?
def solve() -> int: completed_fraction = 3/8 remaining_fraction = 1 - completed_fraction remaining_project_hours = remaining_fraction * 35 time_per_hour_fraction = 1/8 total_hours_needed = remaining_project_hours / time_per_hour_fraction result = total_hours_needed return result
James bought 5 laptops for his employees. Each laptop cost $799.99. The store charged him a total of $35.75 in tax. He left with $166.26 in change. How much did James start with?
def solve() -> int: laptop_cost = 799.99 num_laptops = 5 tax = 35.75 change = 166.26 total_cost = laptop_cost * num_laptops total_cost_with_tax = total_cost + tax starting_amount = total_cost_with_tax + change result = starting_amount return result
Student: In a math class with 25 students, 60% of them are girls. If each girl has 2 math books and each boy has 1 math book, and the total number of math books in the class is 40, how many boys are in the class?
def solve() -> int: num_students = 25 percent_girls = 0.6 num_girls = num_students * percent_girls num_boys = num_students - num_girls num_books_per_girl = 2 num_books_per_boy = 1 total_num_books = 40 num_girls = num_students * percent_girls num_boys = num_students - num_girls nu...
There are 1/4 times as many monkeys as lions in the Wildlife Park. If there are 48 monkeys, calculate the total number of lions and monkeys in the Park.
def solve() -> int: monkeys = 48 lions = monkeys * 4 total = monkeys + lions result = total return result
There are 50 books in a library. If the number of books increases by 20% every year, how many books will there be after 5 years?
def solve() -> int: num_books = 50 increase_percent = 0.2 years = 5 for i in range(years): num_books += num_books * increase_percent result = num_books return result
Student: 7. Bob has 10 dollars he is planning to spend on snacks at the store. Each snack costs $0.75. How many snacks can Bob get?
def solve() -> int: dollars = 10 snack_cost = 0.75 snacks = dollars / snack_cost snacks = int(snacks) result = snacks return result
If the area of a square is 64 sq units, what is the perimeter of the square?
def solve() -> int: side_length = (64)**(1/2) perimeter = 4*side_length result = perimeter return result
Student: If Jeff has 30 apples and each day he gives away 1/5 of his apples, how many days will it take him to give away all of his apples?
def solve() -> int: apples = 30 fraction = 1/5 days = apples / fraction result = days return result
Lily bough seven shirts from the mall. For every second shirt she wore, she donated three shirts from the remaining ones. How many shirts did she donate?
def solve() -> int: shirts_bought = 7 shirts_donated = 0 for i in range(2, shirts_bought + 1, 2): shirts_donated += 3 result = shirts_donated return result
A factory has 120 machines. After 1 hour, 20% of them had problems. The factory fixed 10 machines while 5 more machines had problems. After 3 hours from the start, the number of machines with problems doubled. If there were 40 machines with problems at the end of the day, how many machines worked perfectly without any ...
def solve() -> int: num_machines = 120 num_problem = round(num_machines * 0.2) num_functional = num_machines - num_problem num_problem -= 10 num_problem += 5 num_problem *= 2 num_functional -= (40 - num_problem) result = num_functional return result
Jordan had $50. She spent $15 on a new jacket and $8 on some accessories. How much, in total, does Jordan have left?
def solve() -> int: original_money = 50 jacket_cost = 15 accessory_cost = 8 result = original_money - jacket_cost - accessory_cost return result
Jamie and Nick have $80 total. Nick has three times as much money as Jamie. How much money does Jamie have?
def solve() -> int: jamies_money = (80/4) result = jamies_money return result
- Leila bought some candles. She bought four vanilla ones that cost $3 each, and some lavender ones that cost $2 each. How many lavender candles did Leila buy if she spent a total of $18 on candles?
def solve() -> int: vanilla_cost = 4 * 3 remaining = 18 - vanilla_cost lavender_number = remaining / 2 result = lavender_number return result
Sarah is on a bus that is 7 and a half hours long. To pass the time, she plays games on her phone for 2 hours and 45 minutes. Then she takes a nap for 45 minutes. Afterwards, she listens to 3 podcasts that are each 30 minutes long. How much time is left before Sarah arrives at her destination?
def solve() -> int: bus_length = 7.5 games_time = 2.75 nap_time = 0.75 podcast_time = 3 * 0.5 total_time = games_time + nap_time + podcast_time remaining_time = bus_length - total_time result = remaining_time return result
A librarian had 700 books in a shelf he was organizing by genre. He sorted 2/7 of the books into fiction and 3/14 of the books into non-fiction. He then moved 1/2 of the fiction books and 1/4 of the non-fiction books to another shelf. How many books did he have left in the original shelf?
def solve() -> int: initial = 700 fiction = initial * 2 / 7 nonfiction = initial * 3 / 14 moved_fiction = fiction / 2 moved_nonfiction = nonfiction / 4 moved = moved_fiction + moved_nonfiction left = initial - moved result = left return result
Tom has a package of 24 cookies. If he eats 8 of them, how many cookies does Tom have left?
def solve() -> int: total_cookies = 24 eaten_cookies = 8 result = total_cookies - eaten_cookies return result
A city has 75 restaurants, of which 50 are Chinese restaurants and 25 are Italian restaurants. How many more Chinese restaurants than Italian restaurants does the city have?
def solve() -> int: num_Chinese = 50 num_Italian = 25 difference = num_Chinese - num_Italian result = 25 return result
Student: Josh has collected 500 quarters, 300 dimes, and 400 nickels. How much money does he have in total?
def solve() -> int: quarter = 25 dime = 10 nickel = 5 quarters_value = quarter * 500 dimes_value = dime * 300 nickels_value = nickel * 400 total_value = quarters_value + dimes_value + nickels_value result = total_value / 100 return result
Student: The cost of 6 packets of rice is $102. If ten identical packets of rice are bought for $170, how much will be saved?
def solve() -> int: cost_of_6 = 102 cost_of_10 = 170 cost_of_1 = cost_of_6 / 6 original_cost_of_10 = cost_of_1 * 10 saved = original_cost_of_10 - cost_of_10 result = saved return result
``` The total area of a square is 144 m². What is the length of the square's side?
def solve() -> int: total_area = 144 side_length = total_area ** 0.5 result = side_length return result
Sofia, Maria, and Isabella ordered 90 tacos from a street vendor. Maria and Isabella each ate five times as many as Sofia. How many did Sofia eat?
def solve() -> int: sofia = 0 maria = 0 isabella = 0 total_tacos = 90 maria = 5 * sofia isabella = 5 * sofia total_eaten = sofia + maria + isabella sofia = total_tacos - total_eaten result = sofia return result
Jake is filling a tank with water from a hose. His tank can hold 500 liters of water and his hose can fill the tank at a rate of 3 liters/minute. How many minutes will it take for Jake to fill the tank?
def solve() -> int: rate = 3 water = 500 min = water/rate result = min return result
A marble factory manufactures 15 marble statues a day, of which 7 are large and 8 are small. How many of each type of statue does the factory make daily?
def solve() -> int: total_statues = 15 large_statues = total_statues * (7 / 15) small_statues = total_statues - large_statues result = large_statues, small_statues return result
A school has 20 students in grade 1, 4 more students in grade 2 than grade 1, and 10 less students in grade 3 than grade 2. How many students are there in grade 3?
def solve() -> int: grade1 = 20 grade2 = grade1 + 4 grade3 = grade2 - 10 result = grade3 return result
Emily spent $60 on 5 identical dresses for a wedding. How much did each dress cost?
def solve() -> int: total_cost = 60 num_dresses = 5 cost_per_dress = total_cost / num_dresses result = cost_per_dress return result
The chances of being accepted into a graduate school start at 30% if you have a GPA of 3.0 and increase 5% for every 0.1 increase in GPA. Tom has a GPA of 3.4. What are his chances of being accepted into the graduate school?
def solve() -> int: gpa = 3.4 base_chance = 30 increase_per_point_one = 5 gpa_difference = gpa - 3.0 increase_percentage = gpa_difference * increase_per_point_one total_chance = base_chance + increase_percentage result = total_chance return result
A cake can be cut into 8 pieces. If 3 people each want 2 pieces, how many pieces are left?
def solve() -> int: total_pieces = 8 num_people = 3 pieces_per_person = 2 result = total_pieces - num_people * pieces_per_person return result
If the stadium was full, how much more money would have been collected compared to 3/4 full?
def solve() -> int: result = 0 capacity = 2000 num_people = 2000 * 3/4 entry_fee = 20 total_fee_collected_3_4 = num_people * entry_fee total_fee_collected_full = capacity * entry_fee difference = total_fee_collected_full - total_fee_collected_3_4 result = difference return r...
In a box, there are 45 apples and 30 pears. If you select 2 apples and 3 pears, how many fruits do you have in total?
def solve() -> int: total_apples = 45 total_pears = 30 apples_selected = 2 pears_selected = 3 total_fruits = apples_selected + pears_selected result = total_fruits return result
Michelle purchased a phone which cost $500 and a laptop which cost $1000. Calculate the total amount Michelle paid for the items after the phone was discounted by 10% and the laptop got a 15% discount.
def solve() -> int: phone_cost = 500 laptop_cost = 1000 discount_rate_phone = 0.1 discount_rate_laptop = 0.15 total_cost = phone_cost + laptop_cost total_discount = (phone_cost * discount_rate_phone) + (laptop_cost * discount_rate_laptop) total_amount = total_cost - total_discount resul...
Olivia is blending a smoothie that's 60% banana, 25% strawberries, and the rest yogurt. If she adds 400 grams of strawberries, how many grams of yogurt does she add?
def solve() -> int: banana_percentage = 60 strawberry_percentage = 25 yogurt_percentage = 100 - banana_percentage - strawberry_percentage strawberry_weight = 400 yogurt_weight = (strawberry_weight / strawberry_percentage) * yogurt_percentage result = yogurt_weight return result
-Use variables and comments in your code to explain your logic. Leila wants to knit a scarf that is 200 cm long. She knits 10 cm on the first day, 15 cm on the second day, and 20 cm on the third day. After that, she knits 5 cm more than the previous day until she finishes the scarf. How many days does it take her to kn...
def solve() -> int: length = 200 knitted = 0 days = 0 while knitted < length: days = days + 1 if days == 1: knitted = knitted + 10 elif days == 2: knitted = knitted + 15 elif days == 3: knitted = knitted + 20 else: knitted = knitted +...
The mudslide carried the Evans' shed and transported it 20 meters downhill before it settled at the base of the hill. In the shed, a rake had been displaced twice the distance of that the shed had been transported. How far, in meters, had the rake been displaced?
def solve() -> int: distance_transport = 20 rake_displaced = distance_transport * 2 result = rake_displaced return result
A box contains 20 black balls and 15 white balls. If one ball is picked randomly, what is the probability of picking a black ball?
def solve() -> int: total_balls = 20 + 15 probability_of_black = 20 / total_balls result = probability_of_black return result
Ted has a bag of marbles that contains 10 red marbles, 8 blue marbles, and 12 green marbles. If he takes out 2 red marbles, 1 blue marble, and 3 green marbles, how many marbles are left in the bag?
def solve() -> int: red_marbles = 10 - 2 blue_marbles = 8 - 1 green_marbles = 12 - 3 total_marbles = red_marbles + blue_marbles + green_marbles result = total_marbles return result
The number of students in a class is twice as much as the number of teachers. If there are 18 people in the class, how many are teachers?
def solve() -> int: total_people = 18 students = total_people / 3 teachers = total_people - students result = teachers return result
In a certain city, a residential building has 60 apartments. During the first week of the year, 12 apartments were rented. In the second week, the number of rented apartments increased by three times more per week. How many apartments were rented in total during the second week?
def solve() -> int: total_apartments = 60 rented_week1 = 12 increase_per_week = 3 rented_week2 = rented_week1 + (increase_per_week * rented_week1) total_rented = rented_week1 + rented_week2 result = total_rented return result
Student: Amy needs to walk around a park. The total length of the path is 2.5 km. If she takes 15 minutes for each kilometer, how long will it take for her to finish the path?
def solve() -> int: total_length = 2.5 time_per_km = 15 total_time = total_length * time_per_km result = total_time return result
Maya has a box of 60 markers. She used 15 of them and gave 10 away to her friends. How many markers does she have left?
def solve() -> int: total_markers = 60 markers_used = 15 markers_given_away = 10 markers_left = total_markers - markers_used - markers_given_away result = markers_left return result
Student: Nicholas wants to buy 3 packs of paper each containing 40 sheets. How many sheets will he need to buy in all?
def solve() -> int: packs = 3 sheets_per_pack = 40 total_sheets = packs * sheets_per_pack result = total_sheets return result
A hiker buys 6 bottles of water and 4 energy bars. Each bottle of water costs 1.5 dollars and each energy bar costs 2 dollars. He then gets a 20% discount on the total order. How much did he pay?
def solve() -> int: total = 6 * 1.5 + 4 * 2 discount = 0.2 * total final = total - discount result = final return result
Student: A train traveled 720 miles in 12 hours. What was its speed in miles per hour?
def solve() -> int: distance = 720 time = 12 speed = distance / time result = speed return result
A phone originally cost $900. John paid $150 for a phone plan that comes with a $150 discount. The phone's value has also decreased by 15%. Calculate the final amount John paid.
def solve() -> int: initial_price = 900 phone_plan = 150 discount = 150 decrease = 0.15 final_price = (initial_price-phone_plan-discount)*(1-decrease) result = round(final_price,2) return result
The value of a car decreases by 10% each year. If a car was worth $25,000 when it was new, and it is now 5 years old, what is the current value of the car?
def solve() -> int: initial_value = 25000 depreciation_rate = 0.1 number_of_years = 5 current_value = initial_value * (1 - depreciation_rate) ** number_of_years result = current_value return result
There are 360 children on one playground. If every fourth child is playing on the monkey bars, and every sixth child is playing tetherball, how many children are not playing on the monkey bars or tetherball?
def solve() -> int: total_children = 360 monkey_bar_ratio = 1 / 4 tetherball_ratio = 1 / 6 monkey_bars = total_children * monkey_bar_ratio tetherball = total_children * tetherball_ratio neither = total_children - (monkey_bars + tetherball) result = neither return result
Student: Andrew has a part-time job and earns $12 per hour. Last week he worked for 4 hours on Monday, 6 hours on Tuesday, 5 hours on Wednesday, and 7 hours on Thursday. How much money did Andrew make last week?
def solve() -> int: hourly_wage = 12 monday_hours = 4 tuesday_hours = 6 wednesday_hours = 5 thursday_hours = 7 total_hours = monday_hours + tuesday_hours + wednesday_hours + thursday_hours result = total_hours * hourly_wage return result
A family wants to take a road trip from New York to California. The total distance is 2900 miles. If they drive at an average speed of 70 miles per hour for 8 hours a day, how many days will it take them to arrive?
def solve() -> int: total_distance = 2900 speed = 70 hours_per_day = 8 days = total_distance / (speed * hours_per_day) result = days return result
Sarah and her classmates went on a field trip. They took a total of 77 pictures. They each deleted 5 bad pictures. How many pictures did they keep?
def solve() -> int: total_pictures = 77 num_students = 6 bad_pictures_per_student = 5 total_bad_pictures = num_students * bad_pictures_per_student total_good_pictures = total_pictures - total_bad_pictures result = total_good_pictures return result
Megan has 94 books, 10 of them are Comics and the rest are Novels. How many Novels does Megan have?
def solve() -> int: total_number_of_books = 94 number_of_comics = 10 number_of_novels = total_number_of_books - number_of_comics result = number_of_novels return result
Tim wants to buy a new phone that costs $500. He currently has $300 in his bank account and he will ask his parents to give him the rest of the money. If his parents agree, how much change will he have left after buying the phone?
def solve() -> int: phone_price = 500 bank_money = 300 total_money = bank_money + (phone_price - bank_money) change = total_money - phone_price result = change return result
In a field, there are 40 trees. Five of the trees are apple trees and five of the trees are orange trees. The rest are peach trees. How many peach trees are in the field?
def solve() -> int: total_trees = 40 apple_trees = 5 orange_trees = 5 peach_trees = 0 for tree in range(total_trees): if tree < apple_trees or tree >= apple_trees + orange_trees: peach_trees += 1 result = peach_trees return result
Every time Caleb made his bed, he earned $1. Caleb's mom said she would give him $10 at the end of every month for vacuuming the living room. At the end of four months, how much money will Caleb have earned?
def solve() -> int: bed_money = 1 mom_money = 10 months = 4 bed_earnings = bed_money * 30 * months mom_earnings = mom_money * months total_earnings = bed_earnings + mom_earnings result = total_earnings return result
Jacob borrowed $150 from his father to start a landscaping business. He has to repay his father $165 as soon as possible. Jacob spent $50 on equipment. He provides his services to a customer for $300. After he pays back his father, how much money does Jacob have left?
def solve() -> int: borrowed_money = 150 repay_money = 165 equipment_cost = 50 service_income = 300 money_left = borrowed_money + service_income - repay_money - equipment_cost result = money_left return result
Judy had $72 to spend on 4 hotdogs and french fries. The hot dogs cost $3 each and the fries cost $5 each. How much money did she have left?
def solve() -> int: remaining_money = 72 - (4 * 3) - ( 4 * 5) result = remaining_money return result
In a class of 30 students, 20 are boys. What percent of the students are girls?
def solve() -> int: total_students = 30 num_boys = 20 num_girls = total_students - num_boys percent_girls = (num_girls / total_students) * 100 result = percent_girls return result
Leo bought 2 pizzas for $12 each and 3 drinks for $2 each. He paid with a $50 bill and received $x as change. What is the value of x?
def solve() -> int: pizza = 12 drink = 2 cost = 2 * pizza + 3 * drink change = 50 - cost result = change return result
Max is a student for a science project. The science project requires 400 hours to finish. The two types of tasks in the project require equal amounts of time, but only one type has been completed so far, taking 160 hours. Max needs to calculate how many hours are needed for the remaining tasks, and he found that the to...
def solve() -> int: total_hours = 400 completed_hours = 160 available_hours = 700 remaining_hours = total_hours - completed_hours one_type_hours = remaining_hours / 2 other_type_hours = available_hours - one_type_hours result = other_type_hours return result
A car travels 120 miles in 2 hours. What is the average speed of the car in miles per hour?
def solve() -> int: distance_traveled = 120 time_taken = 2 average_speed = distance_traveled/time_taken result = average_speed return result
Ryan buys his neighbor's car for $4,800 and pays $1,200 as an initial down payment. He pays the rest with six equal payments with a 4.5% interest rate. What will be the total amount paid?
def solve() -> int: initial_payment = 1200 loan_amount = 4800 - initial_payment rate = 0.045 monthly_interest_payment = loan_amount * rate/12 total_monthly_payment = loan_amount / 6 + monthly_interest_payment total_payment = (total_monthly_payment*6) + initial_payment result = tota...
am runs 2 km every day for 5 days a week. He wants to increase his distance by 10% every week until he reaches 5 km per day. How many weeks does it take him to reach his goal?
def solve() -> int: distance = 2 weeks = 0 while distance < 5: distance = distance * 1.1 weeks = weeks + 1 result = weeks return result
A bakery sells three types of cakes: chocolate, vanilla, and strawberry. A chocolate cake costs $15, a vanilla cake is $13 and a strawberry cake is $12. You want to buy as many cakes as possible for $60. If you want to get at least one chocolate cake, one vanilla cake, and two strawberry cakes, what is the maximum numb...
def solve() -> int: total_money=60 chocolate_cost=15 vanilla_cost=13 strawberry_cost=12 min_chocolate=1 min_vanilla=1 min_strawberry=2 max_chocolate=total_money//chocolate_cost max_vanilla=total_money//vanilla_cost max_strawberry=total_money//strawberry_cost max_cakes=0 f...
On Saturday, Abby cycled for 45 minutes and then cycled for an additional 30 minutes. On Sunday, she cycled for thrice the time she cycled on Saturday and cycled for 20 more minutes than the previous day. How much time does she cycle in the two days?
def solve() -> int: sat_cycling_time = 45 + 30 sun_cycling_time = 3 * sat_cycling_time + 20 total_cycling_time = sat_cycling_time + sun_cycling_time result = total_cycling_time return result
Student: Zoe is a lolly seller, she sells lollies of 3 different sizes - small, medium and large. The prices of each size are $1,$3 and $5 respectively. How much money did she earn if she sold 12 packets of small, 10 packets of medium and 8 packets of large lollies?
def solve() -> int: small_price = 1 medium_price = 3 large_price = 5 small_packets = 12 medium_packets = 10 large_packets = 8 small_earnings = small_price * small_packets medium_earnings = medium_price * medium_packets large_earnings = large_price * large_packets total_earnings =...
Samantha creates and delivers flower bouquets. To make three bouquets she spends $30 on flowers and $5 on packaging for each bouquet. Samantha sells each bouquet for $50. How much money does Samantha make for each bouquet?
def solve() -> int: flowers_cost = 30 packaging_cost = 5 total_cost = flowers_cost + packaging_cost * 3 selling_price = 50 * 3 profit = selling_price - total_cost money_per_bouquet = profit / 3 result = money_per_bouquet return result
Lisa and John were out shopping for their vacation to Hawaii. Lisa was planning to get 16 tops while John was planning to pick up 14 shorts. In total, how many items are they picking up?
def solve() -> int: tops = 16 shorts = 14 total = tops + shorts result = total return result
Mark has 5 bags of candy. Each bag has 25 pieces of candy. If he wants to give each of his 20 friends 2 pieces of candy, how many additional bags of candy will he need to buy?
def solve() -> int: bags_of_candy = 5 pieces_per_bag = 25 friends = 20 pieces_per_friend = 2 total_pieces_needed = friends * pieces_per_friend total_pieces_available = bags_of_candy * pieces_per_bag additional_bags_needed = (total_pieces_needed - total_pieces_available) // pieces_p...
Ali needs to mail a package to his friend. The package weighs 3.5 pounds. The post office charges $1.20 per pound. How much will Ali need to pay for shipping?
def solve() -> int: weight = 3.5 cost_per_pound = 1.20 total_cost = weight * cost_per_pound result = f'Ali will need to pay ${total_cost} for shipping' result = total_cost return result
A classroom has different types of desks. There are ten square desks, five circular desks, and two rectangle desks. In each desk, there are three chairs. Each student has a pencil box. If there are 37 students in the class, what is the total number of chairs in the classroom?
def solve() -> int: num_square_desks = 10 num_circular_desks = 5 num_rectangle_desks = 2 num_chairs_per_desk = 3 total_desks = num_square_desks + num_circular_desks + num_rectangle_desks total_chairs = total_desks * num_chairs_per_desk result = total_chairs ...
Out of 100 balloons, 2/5 are blue and 3/10 are yellow. A quarter of the blue balloons have helium inside and half of the yellow ones are made of rubber. If Andy picks one balloon at random, what's the percentage chance he'll get a yellow rubber balloon?
def solve() -> int: total_balloons = 100 blue_balloons = (2/5) * total_balloons yellow_balloons = (3/10) * total_balloons blue_helium_balloons = (1/4) * blue_balloons yellow_rubber_balloons = (1/2) * yellow_balloons percentage_chance = (yellow_rubber_balloons / total_balloons) * 100 ...
Student: A store sells pens for $1.50 each. If a customer buys 10 pens, what is the total amount he must pay?
def solve() -> int: price_per_pen = 1.50 number_of_pens = 10 total_amount = price_per_pen * number_of_pens result = total_amount return result
Alex drinks a third of a liter of water every hour when he works out. He has a 2-liter bottle of water that he fills up before he goes to the gym. How many hours can Alex work out before he needs to refill his bottle?
def solve() -> int: liters_to_milliliters = 1000 water_per_hour = 333.33 hours = 2 * liters_to_milliliters / water_per_hour result = int(hours) return result
A gardener has 25 meters of fencing material to make a rectangular garden. What is the maximum area of the garden?
def solve() -> int: fencing = 25 length = fencing / 4 width = fencing / 2 - length area = length * width result = area return result
Max has 9 cookies in his jar. Ben has twice as many cookies as Max and Leo has one-third of Ben's cookies. How many cookies do the boys have in total?
def solve() -> int: max = 9 ben = max * 2 leo = ben / 3 total = max + ben + leo result = total return result
James ran for 4 miles at a pace of 8 minutes per mile. How long did it take him to complete the run?
def solve() -> int: miles = 4 pace = 8 time = miles * pace time_result = f'<<<{time}>>>' result = time return result
Alex left home and drove 41 miles in an hour and a half. If he drives at a constant speed, what is the speed limit?
def solve() -> int: speed_limit = 41/1.5 result = 27.333333333333332 return result
Mia has some stickers. She has 5 more glitter stickers than animal stickers and 4 more flower stickers than glitter stickers. If she has 8 animal stickers, how many stickers does she have in total?
def solve() -> int: animal_stickers = 8 glitter_stickers = animal_stickers + 5 flower_stickers = glitter_stickers + 4 total_stickers = animal_stickers + glitter_stickers + flower_stickers result = total_stickers return result
If John has 3 times as many apples as Jane, and Jane has 5 apples, how many apples do they have in total?
def solve() -> int: jane = 5 john = jane * 3 total_apples = jane + john result = total_apples return result
Student: Ms. Smith has 30 boxes of party decorations. Each box contains 8 decorations. How many decorations are there in total?
def solve() -> int: num_boxes = 30 num_decorations_per_box = 8 total_num_decorations = num_boxes * num_decorations_per_box result = total_num_decorations return result
A vending machine contains 40 candy bars, and there are 3 empty slots. What percent of the total slots are occupied by candy bars?
def solve() -> int: candy_bars = 40 empty_slots = 3 total_slots = candy_bars + empty_slots occupied_slots = candy_bars / total_slots percent_occupied = occupied_slots * 100 result = percent_occupied return result
Student: Maya bakes cookies for her friends. She uses one cup of flour for every 12 cookies. She also adds half a cup of chocolate chips for every 24 cookies. How much flour and chocolate chips does she need to make 120 cookies?
def solve() -> int: flour_per_cookie = 1 / 12 chips_per_cookie = 0.5 / 24 total_cookies = 120 flour_needed = flour_per_cookie * total_cookies chips_needed = chips_per_cookie * total_cookies result = (flour_needed, chips_needed) return result
A water tank can hold 300 liters of water. If it is currently filled with 120 liters of water, what percent of the tank's capacity is filled?
def solve() -> int: percent_filled = 120 / 300 * 100 result = percent_filled return result
Rachel is baking cookies when she notices some of the cookies are burnt and some have cracked. She wants to save the burnt cookies to use in a pie crust, throw away the cracked cookies, and keep the good cookies to eat. By her count, a tenth of the cookies are burnt and four more than one tenth are cracked. She made 12...
def solve() -> int: total_cookies = 120 burnt_cookies = total_cookies / 10 cracked_cookies = (total_cookies / 10) + 4 good_cookies = total_cookies - burnt_cookies - cracked_cookies cookies_left = good_cookies result = cookies_left return result
ome possible questions and programs are: One serving of salad has 2 ounces of lettuce, 1 ounce of cheese, and 0.5 ounces of dressing. How many pounds of lettuce, cheese, and dressing combined would be needed for 12 servings?
def solve() -> int: lettuce_pound = 2 / 16 cheese_pound = 1 / 16 dressing_pound = 0.5 / 16 total_pound = lettuce_pound + cheese_pound + dressing_pound result = total_pound * 12 return result
Mia has a jar of candies that contains 40% red candies, 30% blue candies, and 30% yellow candies. She takes out 12 candies every day and eats them. Noah has a jar of candies that contains 25% red candies, 50% blue candies, and 25% yellow candies. He takes out 8 candies every day and eats them. After 10 days, how many m...
def solve() -> int: mia_candies = 100 noah_candies = 100 mia_red = 0.4 * mia_candies noah_red = 0.25 * noah_candies for day in range(10): mia_candies = mia_candies - 12 noah_candies = noah_candies - 8 mia_red = mia_red - 0.4 * 12 noah_red = noah_red - 0.25 * 8 res...
A recipe calls for 3/4 cups of sugar. If you want to make 2.5 times the amount of the recipe, how much sugar do you need?
def solve() -> int: amt_of_sugar = 3/4 multiplier = 2.5 total_sugar = amt_of_sugar * multiplier result = total_sugar return result
Evan, Lily, and Max shared a pizza that had 12 slices. Evan ate 1/4 of the pizza, Lily ate 2 more slices than Evan, and Max ate the remaining slices. How many slices did Max eat?
def solve() -> int: evan_slices = 12 / 4 lily_slices = evan_slices + 2 max_slices = 12 - evan_slices - lily_slices result = max_slices return result
Olivia went to a farmers market and bought apples and pears. She bought 25 apples and 35 pears. If 60% of the apples and 80% of the pears are edible, and 50% of the resulting fruits are smooth, how many smooth fruits will she have?
def solve() -> int: apples = 25 pears = 35 edible_apples = 0.6 * apples edible_pears = 0.8 * pears total_fruits = edible_apples + edible_pears smooth_fruits = 0.5 * total_fruits result = smooth_fruits return result
Liam goes to the beach and notices that half the seashells are round and 1/3 have stripes. If there are 30 round seashells, how many have stripes?
def solve() -> int: round_seashells = 30 total_seashells = round_seashells * 2 striped_seashells = total_seashells / 3 result = striped_seashells return result