question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
The school cafeteria had 7 pies to share with the 30 students and the principal, Mr. Brown. If each pie had 12 slices and the students and Mr. Brown each had 2 slices, how many slices were left?
def solve() -> int: pies = 7 people = 31 slices_per_pie = 12 slices_per_person = 2 total_slices = pies * slices_per_pie slices_eaten = people * slices_per_person slices_left = total_slices - slices_eaten result = slices_left return result
(See below for a sample python program solving the original question) Possible new questions and python programs are: Alice loves to collect stickers, but she needs to organize them in a new album. She has 4 packs of animal stickers, 3 packs of flower stickers, and 2 packs of star stickers. If a pack contains 5 sheets ...
def solve() -> int: animal_packs = 4 flower_packs = 3 star_packs = 2 sheets_per_pack = 5 stickers_per_sheet = 12 total_stickers = (animal_packs + flower_packs + star_packs) * sheets_per_pack * stickers_per_sheet result = total_stickers return result
A delivery company charges a base fee of $5.50 plus $0.75 for each mile driven. How much would the delivery of a package cost if it has to be delivered 20 miles away?
def solve() -> int: base_fee = 5.50 per_mile_fee = 0.75 distance = 20 delivery_cost = base_fee + per_mile_fee * distance result = delivery_cost return result
A school is holding a fundraiser and needs 1000 candy bars for the first week and 1500 candy bars per week after that. If each box of candy bars comes with 20 bars, how many boxes of candy bars will they need until the fundraiser is over?
def solve() -> int: num_weeks = 4 num_candybars_first_week = 1000 num_candybars_per_week = 1500 num_candybars_total = num_candybars_first_week + (num_weeks - 1) * num_candybars_per_week num_boxes = num_candybars_total / 20 result = num_boxes return result
Student: Aiko and Richard went to the toy store. Aiko spent $28 on a toy and Richard spent $11 on a different toy. How much did they spend altogether?
def solve() -> int: aiko_spent = 28 richard_spent = 11 total_spent = aiko_spent + richard_spent result = total_spent return result
Katie has 20 strawberry plants, each of which produces 5 strawberries per day. She sells 10 strawberries for $3. How many days will it take Katie to earn $120 if she sells all her strawberries?
def solve() -> int: daily_strawberries = 20 * 5 daily_sales = daily_strawberries // 10 daily_revenue = daily_sales * 3 days = 120 // daily_revenue result = days return result
John picked 20 apples from the orchard yesterday and gave 45% of them to his neighbor. How many apples does John have left?
def solve() -> int: apples_picked = 20 percentage_given = 45 apples_given = (percentage_given / 100) * apples_picked apples_left = apples_picked - apples_given result = apples_left return result
How many candies does Anna have if she has four less than double the number of candies that Bob has? Bob has 15 candies.
def solve() -> int: bob_candies = 15 double_bob_candies = bob_candies * 2 anna_candies = double_bob_candies - 4 result = anna_candies return result
A sum of $800 is invested in an account with an annual interest rate of 5%. If the interest is compounded monthly, what is the value of the investment after 2 years?
def solve() -> int: principal = 800 interest_rate = 0.05/12 years = 2 n_periods = 12*years interest = principal*((1+interest_rate)**n_periods - 1) result = interest + principal return result
A store is offering a 15% discount on all items. A customer wants to buy a shirt that costs $40 and a tie that costs $25. How much will the customer save with the discount?
def solve() -> int: shirt_cost = 40 tie_cost = 25 discount_rate = 0.15 total_cost = shirt_cost + tie_cost discounted_cost = total_cost * (1-discount_rate) total_savings = total_cost - discounted_cost result = total_savings return result
Jason and his sister Danielle each received a $50 gift card for their favorite store. They want to buy new shoes, which cost 2/5 of their total gift card amount. Afterwards, they go to the movies. Tickets are $10 each and they get the same amount as each other. If they leave with $4 in change each, how many tickets did...
def solve() -> int: gift_card_amount = 50 shoe_cost = (2/5) * gift_card_amount total_spent_on_shoes = 2 * shoe_cost money_left_for_movies = gift_card_amount - total_spent_on_shoes ticket_cost = 10 change_left = 4 money_spent_on_tickets = money_left_for_movies - (2 * change_left) num_tick...
James has $200 and wants to save up for a toy that costs $500. If he saves $20 per week, how many weeks will it take him to save enough money?
def solve() -> int: starting_money = 200 toy_price = 500 weekly_savings = 20 savings_needed = toy_price - starting_money weeks_to_save = savings_needed // weekly_savings if savings_needed % weekly_savings!= 0: weeks_to_save += 1 result = weeks_to_save return result
Sarah has a rectangular garden that is 10 meters long and 5 meters wide. She wants to put a path around the garden that is 2 meters wide. What is the area of the path?
def solve() -> int: garden_area = 10 * 5 path_area = (10+2+2)*(5+2+2) - garden_area result = f'{path_area} square meters' result = path_area return result
Student: Olivia works at a retail store and earns $9 per hour. She worked 28 hours this week and received a bonus of $25. How much did she earn this week in total?
def solve() -> int: hourly_wage = 9 hours_worked = 28 bonus = 25 total_earnings = hourly_wage * hours_worked + bonus result = total_earnings return result
The perimeter of a rectangle is 54 meters, and the length is four times the width. What is the area of the rectangle?
def solve() -> int: perimeter = 54 length_width_ratio = 5 width = perimeter / length_width_ratio length = width * 4 area = length * width result = area return result
Possible new questions and programs are: Amy has a collection of colorful beads that she uses to make bracelets. She has 15 red beads, 10 blue beads, 8 green beads, and 12 yellow beads. She wants to make a bracelet that has 3 red beads, 2 blue beads, 1 green bead, and 1 yellow bead in a repeating pattern. How many bead...
def solve() -> int: red = 15 blue = 10 green = 8 yellow = 12 pattern = 3 + 2 + 1 + 1 patterns = min(red // 3, blue // 2, green // 1, yellow // 1) result = patterns * pattern return result
A store sells 30 pairs of shoes each day. If each pair of shoes costs $50, how much money does the store make in a month (30 days)?
def solve() -> int: pairs_of_shoes = 30 price_per_pair = 50 days_in_month = 30 total_money_made = pairs_of_shoes * price_per_pair * days_in_month result = total_money_made return result
Student: Last week, Tak ate 8 apples, 2 pears, and 4 plums for breakfast. This week, he is planning to have 5 times as many apples as last week, four times as many pears, and 3 more plums than last week. How many fruits will Tak have eaten in total?
def solve() -> int: apples_last_week = 8 pears_last_week = 2 plums_last_week = 4 apples_this_week = apples_last_week * 5 pears_this_week = pears_last_week * 4 plums_this_week = plums_last_week + 3 total_fruits = apples_this_week + pears_this_week + plums_this_week result = total_fruits ...
Ethan went shopping and bought 2 pairs of shoes and 4 t-shirts for a total of $80. If each pair of shoes cost $25, how much does each t-shirt cost?
def solve() -> int: shoes = 2 tshirts = 4 total_cost = 80 shoe_cost = 25 shoe_total_cost = shoes * shoe_cost tshirt_total_cost = total_cost - shoe_total_cost tshirt_cost = tshirt_total_cost / tshirts result = tshirt_cost return result
A car dealer sold a car for $36,000 and made a profit of 20%. What was the cost price of the car?
def solve() -> int: selling_price = 36000 profit_percentage = 20 cost_price = selling_price / (1 + (profit_percentage / 100)) result = cost_price return result
Student: Leo is cycling around a circular track with a radius of 100 meters. He cycles at a speed of 20 meters per second. He wants to cycle for 30 minutes. How many times does he complete a full lap around the track?
def solve() -> int: radius = 100 speed = 20 time = 30 time_in_seconds = time * 60 distance = speed * time_in_seconds laps = distance / (2 * 3.14 * radius) result = round(laps) return result
Zoe had 72 cookies to share with her classmates. She baked 24 chocolate chip cookies and 48 oatmeal raisin cookies. She gave 2 chocolate chip cookies and 3 oatmeal raisin cookies to each classmate. How many classmates did she have and how many cookies did she have left?
def solve() -> int: total_cookies = 72 chocolate_cookies = 24 oatmeal_cookies = 48 cookies_per_classmate = 2 + 3 classmates = total_cookies // cookies_per_classmate cookies_left = total_cookies % cookies_per_classmate result = f"She had {classmates} classmates and {cookies_l...
Olivia has a bookshelf filled with books. Yesterday, she had half as many fiction books as non-fiction books. Today, she added 8 more non-fiction books to her collection. If she now has a total of 72 non-fiction books, how many fiction books does she have?
def solve() -> int: non_fiction_books_yesterday = 72 - 8 fiction_books_yesterday = non_fiction_books_yesterday / 2 result = fiction_books_yesterday return result
Student: A rectangle has a length of 15 centimeters and a width of 10 centimeters. If the length is increased by 20% and the width is decreased by 10%, what is the new area of the rectangle?
def solve() -> int: length = 15 width = 10 length_increase = length * 0.2 length_new = length + length_increase width_decrease = width * 0.1 width_new = width - width_decrease area = length_new * width_new result = area return result
Jacob and Emily are entering a competition. They have a total of 10 apples. If Emily has two more apples than Jacob, how many apples does Jacob have?
def solve() -> int: jacob = 0 emily = 0 total_apples = 10 emily = jacob + 2 jacob = total_apples - emily result = jacob return result
Q4: Martha and Terry get a 10% discount on their total bill. After the discount, how much money do they need to pay? Assume that before the discount, their total bill was $68.
def solve() -> int: total = 68 discountRate = 10/100 discount = total * discountRate totalPay = total - discount result = totalPay return result
Sarah wants to buy 3 books that cost $15.00 each and a notebook that costs $5.00. How much money does Saran need?
def solve() -> int: book_price = 15.00 number_of_books = 3 notebook_price = 5.00 money_needed = (book_price * number_of_books) + notebook_price result = money_needed return result
An airplane traveled 800 miles in 2 hours with the wind, and the same distance in 3 hours against the wind. What is the speed of the airplane, and what is the speed of the wind?
def solve() -> int: distance = 800 time_with_wind = 2 time_against_wind = 3 speed_difference = (distance / time_with_wind) - (distance / time_against_wind) airplane_speed = (distance / ((time_with_wind + time_against_wind) / 2)) wind_speed = abs(speed_difference / 2) result = (airplane_sp...
Last night's baseball game was between the New York Yankees and the Boston Red Sox, and the final score was 8-6, with the Yankees winning. If a home run is worth 4 points and a single is worth 1 point, how many home runs did the Yankees hit if they also made 2 single hits during the game?
def solve() -> int: yankess_score = 8 red_sox_score = 6 single_hit_points = 1 home_run_points = 4 yankess_total_points = yankess_score * home_run_points + 2 * single_hit_points home_runs = (yankess_total_points - 2 * single_hit_points) / home_run_points result = home_runs ...
Mason and his friend Liam want to buy a new mountain bike that is worth $700. To earn the money, they started selling their old books for $5 each. How many books will they need to sell for both to be able to afford the new mountain bike?
def solve() -> int: books_price = 5 bike_price = 700 total_money = 0 while total_money < bike_price: total_money += books_price * 2 result = total_money // books_price return result
Student: Mia has 6 red balloons and 4 blue balloons. She gives away 2 red balloons and 1 blue balloon to her friends. Then she buys 3 more green balloons. How many balloons does she have left?
def solve() -> int: red_balloons = 6 blue_balloons = 4 red_balloons -= 2 blue_balloons -= 1 green_balloons = 3 result = red_balloons + blue_balloons + green_balloons return result
A home improvement store is selling paint for $25 per gallon. If a room is 12ft by 16ft with 8-ft ceilings and needs two coats, how many gallons of paint does Jerry need to buy?
def solve() -> int: room_area = 12*16*2 + 16*8*2 + 12*8*2 paint_needed = room_area / 350 * 2 result = paint_needed return result
Ben is collecting stickers for his album. He needs 100 stickers to complete the album. He has 40 stickers and buys a pack of 12 stickers every week. How many weeks does he need to buy packs of stickers to complete the album?
def solve() -> int: needed = 100 have = 40 pack = 12 weeks = 0 while have < needed: weeks = weeks + 1 have = have + pack result = weeks return result
Anna likes to bake cookies for her friends. She uses a recipe that makes 12 cookies with 2 cups of flour. She wants to make 36 cookies for a party. How many cups of flour does she need?
def solve() -> int: ratio = 12 / 2 cups = 36 / ratio result = cups return result
Emily had 70 toys in her collection that she intended to donate to charity. While packing them, one toy fell and broke. After packing, she gave 25 toys away and bought 15 new ones from the toy store. How many toys does Emily have now?
def solve() -> int: toys_initial = 70 toys_broken = 1 toys_packed = toys_initial - toys_broken toys_donated = 25 toys_after_donation = toys_packed - toys_donated toys_bought = 15 toys_now = toys_after_donation + toys_bought result = toys_now return result
John has 20 pens. He wants to distribute them equally among his 4 friends. How many pens will each of John's friend get?
def solve() -> int: pens_john = 20 num_friends = 4 pens_each = pens_john / num_friends result = pens_each return result
If the average lifespan for a certain animal is 15 years, and a particular animal is currently 3 years old, how many more years does it have to live before it reaches the end of its natural life?
def solve() -> int: avg_lifespan = 15 current_age = 3 years_left = avg_lifespan - current_age result = years_left return result
Maria bought a pack of 12 cupcakes for a party. She ate one before the party and gave two to her friend. How many cupcakes are left for the party guests?
def solve() -> int: cupcakes_left = 12 - 1 - 2 result = cupcakes_left return result
Hannah was shopping online and found a shirt she wanted to buy for $30. When she went to check out, there was a 20% off coupon available. How much did Hannah save?
def solve() -> int: shirt_price = 30 discount = shirt_price * 0.2 savings = discount result = savings return result
Emma is reading a book that has 240 pages. She reads 15 pages a day and has already read 90 pages. How many more days does she need to finish the book?
def solve() -> int: pages_left = 240 - 90 days_left = pages_left / 15 result = days_left return result
A recipe for cookies calls for 3 cups of flour, 2 teaspoons of baking soda, and 1 cup of sugar. If the recipe makes 24 cookies, how much flour is needed to make 48 cookies?
def solve() -> int: num_cookies1 = 24 num_cookies2 = 48 flour_per_cookie = 3/24 flour_needed = flour_per_cookie * num_cookies2 result = flour_needed return result
Dylan wants to buy apples. They come in 8-packs with an equal number of red, green, and yellow apples. How many packs does he need to buy if he wants 32 red apples?
def solve() -> int: red_apples_per_pack = 8 total_red_apples_needed = 32 packs_needed = total_red_apples_needed / red_apples_per_pack result = packs_needed return result
There are 6 red, 5 blue, and 4 green balls. If you pick a ball at random, what is the probability that it's not green?
def solve() -> int: total_balls = 6 + 5 + 4 green_balls = 4 non_green_balls = total_balls - green_balls probability = non_green_balls / total_balls result = probability return result
Student: A store increases the price of a product by 20%. If the original price was $60, what is the new price?
def solve() -> int: original_price = 60 percentage_increase = 20 amount_increase = original_price * percentage_increase / 100 new_price = original_price + amount_increase result = new_price return result
A bird-watcher is planning a birding expedition. She knowsProfessor Smith purchased four books and a set of highlighters for a total of $320. If all four books were of the same price and the highlighters were twice as expensive as any one book, then how much was the cost of a single book?
def solve() -> int: book_price = 0 highlighter_price = 0 total_cost = 320 book_price = total_cost / 8 result = book_price return result
Leo wants to buy a video game console for $200. He already has $60 in savings. He earns $25 every week from his part-time job, but also spends $7 every weekend hanging out with friends. How many weeks will he have to wait until he can gather enough money to buy the console?
def solve() -> int: initial_savings = 60 console_cost = 200 weekly_earning = 25 weekend_expense = 7 savings_per_week = weekly_earning - weekend_expense amount_needed = console_cost - initial_savings weeks_to_wait = amount_needed // savings_per_week if amount_needed % savings_pe...
Student: If 4 trees can be planted in 3 hours by 5 people, how many trees can be planted in 8 hours by 12 people?
def solve() -> int: trees = 4 hours = 3 people = 5 trees_per_hour = trees / (hours * people) result = trees_per_hour * 8 * 12 return result
7. June has four times as many pens as Nick. If Nick has 8 more pens than Nat, and Nat has 7 pens, how many pens does June have?
def solve() -> int: nat_pens = 7 nick_pens = nat_pens + 8 june_pens = nick_pens * 4 result = june_pens return result
John wants to decrease his fuel consumption. Currently, he uses 50 liters of petrol per week. If he reduces his usage by half every week, how long will it take him to use only 6.25 liters of petrol per week?
def solve() -> int: current_usage = 50 target_usage = 6.25 weeks = 0 while current_usage > target_usage: current_usage /= 2 weeks += 1 result = weeks return result
Student: If a solver flips a coin 65 times and gets a tail on 28 of them, how many more heads than tails did he get?
def solve() -> int: tails = 28 heads = 0 heads = 65 - tails result = heads - tails return result
Student: Q9. A professor drew 9-letter words from a bag of letters, and distributed them to her 9 students. She kept for herself the same amount of words as she gave away. How many words did the professor keep for herself?
def solve() -> int: letters = 9 words = 9 students = 9 words_given = words * students words_kept = words_given result = words_kept return result
Student: A company has 5 employees who earn $800, $900, $1200, $1100 and $1000 per week respectively. If the company wants to increase the total payroll by 15%, how much more money should they distribute among the employees?
def solve() -> int: employee1 = 800 employee2 = 900 employee3 = 1200 employee4 = 1100 employee5 = 1000 total_payroll = employee1 + employee2 + employee3 + employee4 + employee5 increase = total_payroll * 0.15 distribution = increase / 5 new_total_payroll = total_payroll + increase ...
If five dogs can dig seven holes in two hours, how long would it take three dogs to dig ten holes?
def solve() -> int: dogs_1 = 5 holes_1 = 7 time_1 = 2 dogs_2 = 3 holes_2 = 10 rate = holes_1 / (dogs_1 * time_1) time_2 = holes_2 / (dogs_2 * rate) result = time_2 return result
Laura has 15 cupcakes and wants to share them equally with her 4 friends. How many cupcakes will each person get if they also give 3 cupcakes to their teacher as a gift?
def solve() -> int: cupcakes_left = 15 - 3 cupcakes_each = cupcakes_left / (4 + 1) result = cupcakes_each return result
Kelly is painting a mural on a wall. The wall is 10 meters long and 4 meters high. She needs 0.5 liters of paint for every square meter of the wall. She also wants to leave a 1 meter wide border around the wall unpainted. How much paint, in liters, does Kelly need for the mural?
def solve() -> int: wall_length = 10 wall_height = 4 paint_per_square = 0.5 border_width = 1 wall_area = wall_length * wall_height border_area = border_width * (wall_length + wall_height) * 2 mural_area = wall_area - border_area paint_needed = mural_area * paint_per_square result = p...
Tim has 4 identical cups of fruit juice. Each cup contains 12 fluid ounces of fruit juice. How many fluid ounces of fruit juice does Tim have in total?
def solve() -> int: number_of_cups = 4 fluid_ounces_per_cup = 12 total_fluid_ounces = number_of_cups * fluid_ounces_per_cup result = total_fluid_ounces return result
Student: A pizza has 8 slices. If 2 slices are eaten, and the remaining pizza is split equally between 3 people, how many slices of pizza does each person get?
def solve() -> int: slices_total = 8 slices_eaten = 2 people = 3 slices_remaining = slices_total - slices_eaten slices_each = slices_remaining / people result = slices_each return result
Lara spends 15 minutes on Instagram every day. Her friend Zoe spends 5 minutes more than her each day. If they both reduced their Instagram time by 10 minutes per day starting from June 1st, and there were 30 days in June, how many hours did they both save in total in that month?
def solve() -> int: lara_daily = 15 zoe_daily = lara_daily + 5 days_in_june = 30 before = (lara_daily + zoe_daily) * days_in_june after = (lara_daily - 10 + zoe_daily - 10) * days_in_june reduction = before - after hours = reduction / 60 result = round(hours, 2) retur...
Here are some possible math questions: A cake recipe calls for 3 cups of flour, 2 cups of sugar, and 4 eggs. How many eggs are needed to make 2.5 times the recipe?
def solve() -> int: factor = 2.5 eggs = 4 scaled_eggs = eggs * factor scaled_eggs = round(scaled_eggs) result = scaled_eggs return result
Gracie has a total of 24 stickers. If she decided to give away 25% of it to her classmates and each student gets 2 stickers, how many classmates did Gracie give stickers to?
def solve() -> int: total_stickers = 24 percentage_given_away = 25 stickers_given_away = (percentage_given_away / 100) * total_stickers stickers_per_student = 2 classmates_given_to = stickers_given_away / stickers_per_student result = classmates_given_to return result
A car travels 400 miles in 8 hours. What is the average speed of the car?
def solve() -> int: average_speed = 400/8 result = average_speed return result
After buying 150 apples, John had 300 apples left. What was the percentage of apples that John bought?
def solve() -> int: apples_total = 300 + 150 percentage_bought = 150 / apples_total * 100 result = percentage_bought return result
A car starts from rest and accelerates uniformly at 4 m/s^2. What is the speed of the car after 10 seconds?
def solve() -> int: acceleration = 4 time = 10 initial_velocity = 0 final_velocity = initial_velocity + acceleration*time result = final_velocity return result
Andrew bought five packs of cookies for his family picnic. Each pack cost $2. Andrew found a better quality of cookies that he wants to get, but it costs $2.50 more per pack. How much more money will Andrew need to spend in the new purchase?
def solve() -> int: cost_old = 5*2 cost_new = 5*2.50 difference = cost_new - cost_old result = difference return result
Student: A group of friends shared a pizza with 8 slices. Each person had 2 slices. How many people were in the group?
def solve() -> int: slices = 8 slices_per_person = 2 people = slices // slices_per_person result = people return result
A recipe for a smoothie calls for 2 bananas, 1/2 cup of milk and 1/4 cup of ice cream. If you want to make the recipe but only have 1/2 banana, how much milk and ice cream do you need?
def solve() -> int: bananas_needed = 2 milk_needed = 0.5 ice_cream_needed = 0.25 bananas_available = 0.5 milk_per_banana = milk_needed/bananas_needed ice_cream_per_banana = ice_cream_needed/bananas_needed milk_available = milk_per_banana*bananas_available ice_cream_available = ice_cream_...
Mr. and Mrs. Smith have 12 pears. Their neighbor has different types of fruits, which are half the number of pears the Smiths have. He has one orange, one grapefruit, and the rest are fruits. How many fruits does their neighbor have?
def solve() -> int: pears = 12 fruits = (pears / 2) - 2 result = fruits return result
Peter buys 7 packs of hot dogs for his family. His cousins and uncle also bring hot dogs for the party. If they need 20 packs of hot dogs for the party, and his cousin brings only 1 pack, how many packs will his uncle bring?
def solve() -> int: peter_packs = 7 cousin_packs = 1 total_packs = 20 uncle_packs = total_packs - peter_packs - cousin_packs result = uncle_packs return result
Student: A company has 12 employees for every 9 salespeople. If the company has 54 salespeople, how many employees does it have?
def solve() -> int: salespeople = 54 employees_per_salesperson = 12/9 employees = salespeople * employees_per_salesperson result = employees return result
A baseball team has a win-loss record of 32-18 after the first 50 games of the season. If they maintain this winning percentage, how many more games do they need to win in order to reach 100 wins?
def solve() -> int: wins_so_far = 32 total_games = 100 winning_percentage = wins_so_far / 50 remaining_games = total_games - 50 additional_wins_needed = (total_games * winning_percentage) - wins_so_far result = round(additional_wins_needed) return result
John’s laptop battery can run for 8 hours on a full charge. John has used a quarter of its battery up, and he is about to take a four-hour test that will require his laptop the whole time. How many hours of battery will John’s laptop have left?
def solve() -> int: battery_life = 8 used_battery = battery_life / 4 remaining_battery = battery_life - used_battery test_time = 4 remaining_battery -= test_time result = remaining_battery return result
Seven years from now, Stephanie will be five times as old as Rachel. If Rachel is 18 years old now, how old was Stephanie three years ago?
def solve() -> int: rachel_age = 18 stephanie_age = (5 * rachel_age) - 7 stephanie_age_three_years_ago = stephanie_age - 3 result = stephanie_age_three_years_ago return result
If a person drinks 6 cups of water per day for a week, how many cups of water did they drink in total?
def solve() -> int: total_cups = 6 * 7 result = total_cups return result
A group of 50 students took a math exam. 30 students passed the exam. What percentage of the students passed?
def solve() -> int: total_students = 50 students_passed = 30 percent_passed = (students_passed/total_students)*100 result = percent_passed return result
Rudy mows the lawn every 3 weeks. If he mows the lawn 15 more times, how many weeks will Rudy have mowed the lawn in total?
def solve() -> int: times_mowing = 3 additional_times = 15 result = times_mowing + (additional_times/3) return result
Out of 200 students, 40% passed their history exam while 30% of those who failed didn't show up to take the test. If 25 students got below a D on their final, how many students passed their history exam and showed up?
def solve() -> int: num_students = 200 passed_history = num_students * 40/100 failed_history = num_students - passed_history failed_and_didnt_show = failed_history * 30/100 passed_and_showed = passed_history * (100 - failed_and_didnt_show) / 100 result = passed_and_showed return result
Lucas buys 30 cans of soda from the store. If he has thrice as many nephews as nieces, and he has 2 nieces, how many sodas can he give to each of his siblings and nephews if he wants to give out the entire 30 cans while giving each the same number?
def solve() -> int: nieces = 2 nephews = 3 * nieces total_siblings = nieces + nephews sodas_per_person = 30 // total_siblings result = sodas_per_person return result
Ava has a water tank that can hold 1,200 liters of water. She has already filled 60% of the tank. If she fills the rest of the tank in four equal parts, how many liters of water will she add in each part of the tank?
def solve() -> int: tank_capacity = 1200 filled_percentage = 60 filled_liters = (filled_percentage / 100) * tank_capacity remaining_liters = tank_capacity - filled_liters liters_per_part = remaining_liters / 4 result = liters_per_part return result
Ryan wants to make enough sandwiches for his picnic. He has 8 guests coming and each person needs 2 slices of bread. The loaf of bread he buys has 16 slices in it. If he wants to make the least amount possible, how much bread will be left over?
def solve() -> int: num_guests = 8 slices_per_guest = 2 slices_per_loaf = 16 total_slices_needed = num_guests * slices_per_guest num_loaves_needed = total_slices_needed // slices_per_loaf slices_leftover = total_slices_needed % slices_per_loaf result = slices_leftover retu...
Zoe collects stamps and has 84 stamps in her album. She buys 3 packs of stamps, each containing 12 stamps, but she realizes that 20% of them are duplicates of the ones she already has. How many stamps does Zoe have in her album after removing the duplicates?
def solve() -> int: initial_stamps = 84 packs = 3 stamps_per_pack = 12 duplicate_rate = 0.2 stamps_bought = packs * stamps_per_pack duplicates = duplicate_rate * stamps_bought stamps_after = initial_stamps + stamps_bought - duplicates result = stamps_after re...
Some possible new questions are: Kim is making a tower of paper cups for a game. She starts with a base of 12 cups arranged in a circle, then puts another circle of 11 cups on top of them, and so on, decreasing the number of cups by one in each circle. How many cups does she need to make a tower that is 10 circles high...
def solve() -> int: total = 0 n = 12 for i in range(10): total = total + n n = n - 1 result = total return result
Student: To make a pitcher of lemonade, Jessa needs 2 cups of lemon juice, 3 cups of sugar, and 10 cups of water. She has 6 cups of lemon juice, 4 cups of sugar, and 30 cups of water. How many pitchers of lemonade can she make?
def solve() -> int: lemon_juice_needed = 2 sugar_needed = 3 water_needed = 10 lemon_juice_available = 6 sugar_available = 4 water_available = 30 num_pitchers = min(lemon_juice_available // lemon_juice_needed, sugar_available // sugar_needed, water_available // water_needed) resul...
A car travels from city A to city B at an average speed of 60 miles per hour. The same car returns from city B to city A at an average speed of 40 miles per hour. If the distance between city A and city B is 240 miles, what is the average speed of the car for the entire trip?
def solve() -> int: total_time = 240/60 + 240/40 total_distance = 2*240 avg_speed = total_distance/total_time result = avg_speed return result
A package of markers costs $12 and contains 8 markers. What is the cost per marker?
def solve() -> int: cost = 12 num_markers = 8 cost_per_marker = cost/num_markers result = cost_per_marker return result
Tara wants to sell 20 erasers, if each eraser costs 15 cents, how much money will she make in total?
def solve() -> int: eraser_cost = 0.15 no_erasers = 20 total_cost = eraser_cost*no_erasers result = total_cost return result
Carla and Dan sell candles at a craft fair. Carla sells small candles for 3 dollars each and large candles for 6 dollars each. Dan sells small candles for 2 dollars each and large candles for 5 dollars each. Carla sells 50 small candles and 20 large candles. Dan sells half as many small candles as Carla, but twice as m...
def solve() -> int: carla_small = 50 carla_large = 20 dan_small = carla_small / 2 dan_large = carla_large * 2 carla_money = 3 * carla_small + 6 * carla_large dan_money = 2 * dan_small + 5 * dan_large difference = carla_money - dan_money result = difference retur...
Imran and Jake are buying candies from a store that sells 5 types of candies: A, B, C, D, and E. Each candy costs 10 cents, and the store has 20 candies of each type. Imran buys 2 candies of type A, 3 candies of type B, and 4 candies of type C. Jake buys 1 candy of each type. How much money do they spend in total?
def solve() -> int: imran_candies = 2 + 3 + 4 jake_candies = 5 total_candies = imran_candies + jake_candies cost = total_candies * 10 result = cost / 100 return result
In a toy-making competition, Lily produced three times the number of toys as Max, who made twice as many as 3 more toys made by Alice. If Alice made 8 toys, how many toys did Lily make?
def solve() -> int: alice_toys = 8 max_toys = (alice_toys + 3) * 2 lily_toys = max_toys * 3 result = lily_toys return result
Samantha can bike 14 miles in an hour. How long will it take her to bike 35 miles?
def solve() -> int: speed = 14 distance = 35 time = distance / speed result = time return result
Student: Gabriella plants 145 pea seeds in her garden. 65% of her seeds germinate and she decides to give away 8 of them. What is the number of pea plants remaining in her garden?
def solve() -> int: seeds = 145 germinate_percentage = 0.65 germinate_number = seeds * germinate_percentage give_away = 8 result = germinate_number - give_away return result
If Michael has 12 cats and each cat has 4 legs, how many legs do his cats have in total?
def solve() -> int: num_cats = 12 legs_per_cat = 4 total_legs = num_cats * legs_per_cat result = total_legs return result
A restaurant offers a $5 discount coupon if the meal costs over $20. If a family of four had a total meal cost of $60, how much did they pay after the discount?
def solve() -> int: total_meal_cost = 60 discount_threshold = 20 discount = 5 if total_meal_cost > discount_threshold: total_meal_cost -= discount result = total_meal_cost return result
Alex wants to throw a party. He needs to buy drinks which cost $3/can and food which costs $50. Additionally, he wants to rent tables and chairs for $100. He also needs to pay $20 for decorations. How much money will Alex spend in total if he invites 20 guests and the rental fee includes delivery cost?
def solve() -> int: drinks_cost = 3 * 20 food_cost = 50 rental_cost = 100 decorations_cost = 20 total_cost = drinks_cost + food_cost + rental_cost + decorations_cost result = total_cost return result
Emma and Michael are solving a puzzle. Emma is ahead by 20 pieces when she places 5 more. Michael places 12 more pieces. By how many pieces is Emma still ahead?
def solve() -> int: emma_pieces = 0 michael_pieces = 0 emma_pieces += 20 emma_pieces += 5 michael_pieces += 12 pieces_ahead = emma_pieces - michael_pieces result = pieces_ahead return result
Ethan has seven pages to memorize. He can memorize one page in 10 minutes. If he has 1.5 hours to study, how many times can he memorize all seven pages?
def solve() -> int: pages_to_memorize = 7 time_per_page = 10 total_time = 1.5 * 60 total_pages_memorized = total_time // (time_per_page * pages_to_memorize) result = total_pages_memorized return result
Tom is going on a ski trip with his buddies. For the first 4 days, they stay in a cabin that costs $80 per night. On the fifth day, they decide to splurge and stay at a luxury lodge for $300 for the night. How much did Tom spend on lodging during the ski trip?
def solve() -> int: cabin_cost_per_night = 80 luxury_lodge_cost = 300 cabin_nights = 4 luxury_lodge_nights = 1 total_cost = (cabin_cost_per_night * cabin_nights) + (luxury_lodge_cost * luxury_lodge_nights) result = total_cost return result
John and his friends went to a restaurant and ordered 4 large pizzas, 3 salads, and 5 drinks. If each large pizza costs $10, each salad costs $5, and each drink costs $2, how much did they spend in total?
def solve() -> int: pizza_cost = 10 salad_cost = 5 drink_cost = 2 num_pizzas = 4 num_salads = 3 num_drinks = 5 total_cost = num_pizzas * pizza_cost + num_salads * salad_cost + num_drinks * drink_cost result = total_cost return result
Ben has a turtle that eats 4 lettuce leaves a day and 2 snails that each eat 2 lettuce leaves a day. He also has 6 hermit crabs that each eat half a lettuce leaf a day. How many lettuce leaves per day does Ben need to buy?
def solve() -> int: turtle = 1 snails = 2 hermit_crabs = 6 lettuce_per_turtle = 4 lettuce_per_snail = 2 lettuce_per_hermit_crab = 0.5 lettuce_per_day = turtle * lettuce_per_turtle + snails * lettuce_per_snail + hermit_crabs * lettuce_per_hermit_crab result = lettuce_per_day ...
Emily drives 50 miles per day, except on Mondays when she drives twice as much. Mike drives half as much as Emily, except on Mondays when he drives twice as much as Emily. How many fewer miles does Mike drive than Emily in a week?
def solve() -> int: emily_daily_miles = 50 mike_daily_miles = emily_daily_miles / 2 emily_monday_miles = emily_daily_miles * 2 mike_monday_miles = emily_monday_miles * 2 emily_weekly_miles = emily_daily_miles * 6 + emily_monday_miles mike_weekly_miles = mike_daily_miles * 6 + mike_mond...
Student: - A store sells pencils for 25 cents each and pens for 75 cents each. Lisa buys 4 pencils and 3 pens. How much change does she get if she pays with a 5 dollar bill?
def solve() -> int: pencil_price = 0.25 pen_price = 0.75 num_pencils = 4 num_pens = 3 total_cost = num_pencils * pencil_price + num_pens * pen_price change = 5 - total_cost result = round(change, 2) return result