question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Sarah and her two friends decided to split the cost of 4 liters of soda. Sarah's sister went to the grocery and bought the 4 liters of soda, 2 bags of chips that cost $2 each, and a box of candy that costs $5. If Sarah's sister paid a total of $25 for the grocery, how much should Sarah and her two friends pay each for ...
def solve() -> int: soda_liters = 4 num_friends = 2 total_cost = 25 chips_cost = 2 * 2 candy_cost = 5 grocery_cost = total_cost - chips_cost - candy_cost soda_cost = grocery_cost / 4 cost_per_person = soda_cost / (num_friends + 1) result = cost_per_person return result
At a clothing store, a shirt costs $20 and is on sale for 30% off. A customer has a coupon that takes an additional $5 off the final price. If the customer plans to buy 4 shirts, what is the final cost of their purchase?
def solve() -> int: original_price = 20 discounted_price = original_price * 0.7 final_price = discounted_price - 5 total_price = 4 * final_price result = total_price return result
Helen had $18. She spent 1/5 of her money on sports items and 4/5 of the remaining money on art supplies. How much is left of Helen's money?
def solve() -> int: amount = 18 sports_items = amount * 1/5 remaining_amount = amount - sports_items art_supplies = remaining_amount * 4/5 result = remaining_amount - art_supplies return result
Dan can drive a car and go 255 miles in 4 hours. How far can he go in 6 hours?
def solve() -> int: time = 6 rate = 255 / 4 distance = time * rate result = distance return result
Stacey leaves her house at 5:00 to go to the beach. She drives at a speed of 65 miles per hour. Half an hour later, her friend realizes that Stacey has forgotten her sunscreen. Her friend drives to catch Stacey and gives her the sunscreen. If her friend drives at a speed of 60 miles per hour, how long does her friend s...
def solve() -> int: stacey_speed = 65 stacey_time = 0.5 stacey_distance = stacey_speed * stacey_time friend_speed = 60 catch_up_time = stacey_distance / (friend_speed - stacey_speed) catch_up_time_minutes = catch_up_time * 60 result = catch_up_time_minutes ...
- Possible questions and programs are: Jenny collects four times as many stamps as Bobby, and Tony collects twenty more than half as many stamps as Jenny. If Bobby has 36 stamps, how many stamps do they have in total?
def solve() -> int: jenny = 4 * 36 tony = 20 + (jenny / 2) total = jenny + tony + 36 result = total return result
Student: A train is travelling from Boston to Washington DC, which is 450 miles away. If the train travels at a speed of 60 miles per hour, how long will it take to reach Washington DC?
def solve() -> int: distance = 450 speed = 60 time = distance / speed time_minutes = time * 60 time_rounded = round(time_minutes) result = time_rounded return result
Question5: Sammy filled his car with gas. It cost $5.00 for the first liter, and every additional liter cost $2 more than the previous one. How much did he pay in total?
def solve() -> int: liter_price = 5 total_price = 0 for i in range(5): total_price += liter_price liter_price += 2 result = total_price return result
Heather bought a new running shoes and ended up running 45 miles in total with them. She had 3 days of rest, before running 15 miles on day 4, and then 16 miles on day 5. Before starting an additional 5 miles on day 6, she wanted to wait for the shoes to be completely used up. If she has a total running miles limit of ...
def solve() -> int: total_miles = 45 running_days = 3 miles_on_day_4 = 15 miles_on_day_5 = 16 miles_on_day_6 = 5 limit = 80 additional_miles = limit - total_miles - miles_on_day_4 - miles_on_day_5 - miles_on_day_6 dividen_miles_on_day = additional_miles // 5 additional_day...
Oliver had $200 in his pocket. He made a deal with his classmate Emma that she would get 7 times the amount of money Oliver had in his pocket if she correctly guessed how much money he had. If Emma was correct, what was the total amount of money she received?
def solve() -> int: oliver_money = 200 emma_money = 7 * oliver_money result = emma_money return result
If 18 people attended the first party and 6 more people attended the second party, how many people were at both parties combined?
def solve() -> int: first_party = 18 second_party = 6 combined = first_party + second_party result = combined return result
Janna got a new dog that weighs 8.5kg. After two months, the dog weighed 11.3kg. How much did the dog gain in the two months?
def solve() -> int: w1 = 8.5 w2 = 11.3 result = w2 - w1 return result
Sarah has 7 kittens more than Michael. Kaitlyn has twice as many kittens as Sarah. How many kittens do they have in all if Kaitlyn has 32 kittens?
def solve() -> int: michael_kittens = (32-7)/3 sarah_kittens = michael_kittens + 7 kittens_total = michael_kittens + sarah_kittens + 32 result = kittens_total return result
In a café, John and his colleague each ordered a sandwich and a coffee. They also shared a piece of cake that costs $6. If a sandwich costs $8 and a coffee costs $4 each and they spent 90% of their combined money, how much money did John's colleague bring if John brought $30?
def solve() -> int: john_sandwich = 1 john_coffee = 1 john_money = 30 john_spent = john_sandwich * 8 + john_coffee * 4 + 6 total_spent = john_spent * 10 / 9 colleague_spent = total_spent - john_spent colleague_money = colleague_spent / 2 result = colleague_money return resu...
While having a picnic with his boyfriend Daniel, Peter saw a group of 15 people having a BBQ nearby. If there were also 2 kids playing tag, how many people are in the park?
def solve() -> int: people_at_bbq = 15 kids_playing_tag = 2 people_in_park = people_at_bbq + kids_playing_tag result = people_in_park return result
A restaurant offers a discount of 20% on all meals during a special event. If a meal normally costs $50, what is the discounted price?
def solve() -> int: meal_price = 50 discount = 0.2 discounted_price = meal_price * (1 - discount) result = discounted_price return result
Deborah has $995 in her wallet. Shedonates three-fourths of that to her favorite charity. How much money does she have left in her wallet?
def solve() -> int: amount_in_wallet = 995 amount_donated = (3/4)*amount_in_wallet amount_left = amount_in_wallet - amount_donated result = amount_left return result
Jane decides to save up for a $500 camera. She spends $40 each week on her hobby. To the nearest whole number, how many weeks will it take for her to save up enough money?
def solve() -> int: weekly_savings = 40 camera_cost = 500 weeks_to_save = camera_cost // weekly_savings + 1 result = weeks_to_save return result
If Maya can get to class in 15 minutes by taking the shorter route X, but it takes 35 minutes by taking the longer route Y, how many minutes will she save if she takes route X both ways?
def solve() -> int: shorter_route_X = 15 longer_route_Y = 35 time_saved = longer_route_Y - shorter_route_X result = time_saved return result
A group of eight friends are going to a concert that costs $320 for their tickets. If they want to split the cost equally, how much will each person need to pay?
def solve() -> int: tickets_cost = 320 num_friends = 8 cost_per_person = tickets_cost / num_friends result = cost_per_person return result
Bob and Rose planned a picnic and brought 10 sandwiches and 5 fruits. How many items did they each get?
def solve() -> int: sandwiches = 10 fruits = 5 people = 2 items_per_person = (sandwiches + fruits)//people result = items_per_person return result
John is planning to paint his rectangular-shaped bedroom that is 15 feet long, 12 feet wide, and 9 feet tall. If he buys a can of paint that can cover 400 square feet, how many cans of paint does he need to buy to cover all four walls, the ceiling, and the floor?
def solve() -> int: length = 15 width = 12 height = 9 area_ceiling = length * width area_floor = area_ceiling area_walls = 2 * height * (length + width) total_area = area_ceiling + area_floor + area_walls paint_can_coverage = 400 num_cans = total_area/paint_can_coverage result = ...
Q6: Roger wants to save up for his retirement. He decides to put aside $3000 every year from his 20th birthday till his 40th birthday. How much did Roger save after 20 years?
def solve() -> int: total = 0 start_year = 20 end_year = 40 saving_per_year = 3000 for year in range(start_year, end_year + 1): total += saving_per_year result = total return result
A car drives at a constant speed of 60 kilometers per hour. How long will it take for the car to travel 240 kilometers?
def solve() -> int: speed = 60 distance = 240 time = distance / speed result = time return result
Mary's phone battery can last up to 10 hours. She wants to make sure to stay 30% under that time for safety. If she has already used her phone for 4 hours, for how many more hours will her battery last?
def solve() -> int: battery_life = 10 safety_percentage = 0.3 used_hours = 4 remaining_hours = battery_life - used_hours safety_hours = remaining_hours * (1 - safety_percentage) result = safety_hours return result
John goes to the grocery store to buy some vegetable. He buys a kg of onions for $2.50, a kg of tomatoes for $3.20 and a kg of potatoes for $1.90. If he gets a discount of 10%, what is the total amount he needs to pay?
def solve() -> int: total_price = 2.5 + 3.2 + 1.9 discount = total_price * 0.1 final_price = total_price - discount result = final_price return result
If 4 friends go out to dinner, and the total bill is $75, how much should each person pay if they want to split the bill equally?
def solve() -> int: num_friends = 4 total_bill = 75 result = total_bill / num_friends return result
It takes a shuttle driver 1 hour to transport 10 passengers to their destination. Working 6 hours a day from Monday to Thursday, and 8 hours a day from Friday to Sunday, how many passengers can he transport in 5 weeks?
def solve() -> int: rate = 10 working_time = 6*4 + 8*7*4 result = rate * working_time return result
Lily has $300 to buy books for her kids. She buys three alphabet books at $8 each, two more math books than alphabet books at $12 each, and half as many storybooks as math books at $10 each. If she also buys coloring books, how much money did she spend on them?
def solve() -> int: alphabet_books = 3 math_books = alphabet_books + 2 story_books = math_books / 2 alphabet_price = 8 math_price = 12 story_price = 10 total_money = 300 alphabet_cost = alphabet_books * alphabet_price math_cost = math_books * math_price story_cost = story_bo...
At the Pizza Palace, Ryan ordered one large pizza for $12, four garlic breads at $3 each, and a two-liter soda for $5. If he left a 18% tip, what was the total cost of Ryan's meal, including tax?
def solve() -> int: pizza_price = 12 garlic_bread_price = 3 num_garlic_breads = 4 soda_price = 5 tip_percent = 18 subtotal = pizza_price + (garlic_bread_price * num_garlic_breads) + soda_price tip_amount = subtotal * (tip_percent / 100) total_cost = subtotal + tip_amount re...
If 6 more than twice a number is 20, what is the number?
def solve() -> int: value = 20 number = (value-6)/2 result = number return result
Roxy bought a package of 12 markers for $6.25. How much does one marker cost?
def solve() -> int: package_cost = 6.25 number_of_markers = 12 cost_per_marker = package_cost / number_of_markers result = 0.52 return result
Sophia is making spaghetti for her family. The recipe calls for garlic. To make the spaghetti, Sophia is going to mince 3 cloves of garlic. First, she peels the garlic and then minces them. How many minced garlic pieces will Sophia have?
def solve() -> int: cloves_of_garlic = 3 minced_garlic_pieces_per_clove = 2 minced_garlic_pieces = cloves_of_garlic * minced_garlic_pieces_per_clove result = minced_garlic_pieces return result
A rectangle has a length of 24 cm and a width of 16 cm. What is the perimeter of the rectangle?
def solve() -> int: length = 24 width = 16 perimeter = 2*(length+width) result = perimeter return result
Student: A swimming pool can be filled in 6 hours with both the inlet and outlet valves open. If the outlet valve were closed, it would take 10 hours to fill the pool with the inlet valve open. How long would it take the outlet valve to empty the full pool if the inlet valve were closed?
def solve() -> int: inlet_open_fill = 6 inlet_closed_fill = 10 rate_fill = 1 / inlet_open_fill rate_empty = rate_fill * (inlet_closed_fill / inlet_open_fill) time_empty = 1 / rate_empty result = time_empty return result
A store is offering a 10% discount on all products. If a product has a pre-discount price of $80.00, what is the discount and how much does the product cost after the discount is applied, in dollars and cents?
def solve() -> int: price_before_discount = 80.00 percent_off = 10 amount_off = price_before_discount * percent_off / 100 price_after_discount = price_before_discount - amount_off result = price_after_discount return result
Ben is paid at a rate of $18 per hour. Last week, he worked 45 hours but he had to give 10% back to his union. How much did Ben earn?
def solve() -> int: hours_worked = 45 pay = 18 * hours_worked union_dues = pay * 0.1 take_home_pay = pay - union_dues result = take_home_pay return result
Aaron spends $150 per month on his phone bill and $75 on his internet bill. He wants to save $500 per month aside from his bills. If he earns $3000 every month, how much money does he have left for groceries and leisure activities?
def solve() -> int: income = 3000 phone_bill = 150 internet_bill = 75 savings_goal = 500 groceries_leisure = income - phone_bill - internet_bill - savings_goal result = groceries_leisure return result
Leo has 4 bags of candy. Each bag contains 12 pieces of candy. He wants to share the candy equally with his 3 friends and himself. How many pieces of candy does each person get?
def solve() -> int: total_candy = 4 * 12 people = 4 candy_per_person = total_candy // people result = candy_per_person return result
At a hardware store, every hammer costs $12, every wrench $8, and a box of nails $6. How much do you need to pay for two boxes of nails, five wrenches, and three hammers?
def solve() -> int: nails_price = 6 wrench_price = 8 hammer_price = 12 nails_quantity = 2 wrench_quantity = 5 hammer_quantity = 3 total_cost = (nails_price * nails_quantity) + (wrench_price * wrench_quantity) + (hammer_price * hammer_quantity) result = total_cost retur...
Student: A train travels at a speed of 50 mph for 2 hours, then it increases its speed to 75 mph for 3 hours. What is the total distance traveled by the train?
def solve() -> int: speed1 = 50 time1 = 2 speed2 = 75 time2 = 3 distance1 = speed1 * time1 distance2 = speed2 * time2 result = distance1 + distance2 return result
Chloe goes on a hike and brings 6 water bottles and three times as many energy bars as water bottles. When she returns to camp, she realizes she only has 8 water bottles and twice the number of energy bars. How many items did she lose?
def solve() -> int: water_bottles_initial = 6 energy_bars_initial = 3 * water_bottles_initial water_bottles_final = 8 energy_bars_final = 2 * water_bottles_final lost_water_bottles = water_bottles_initial - water_bottles_final lost_energy_bars = energy_bars_initial - energy_bars_final ...
Alex has a weekly allowance of $50. After 5 weeks, his allowance increased by 25%. How much is his total allowance after 2 years?
def solve() -> int: weeks_in_a_year = 52 total_weeks = 2 * weeks_in_a_year weekly_allowance = 50 increased_allowance = weekly_allowance + (weekly_allowance * 0.25) total_allowance = total_weeks * increased_allowance result = total_allowance return result
A car travel 5 miles in 5 minutes. How long will it take a car to travel 20 miles?
def solve() -> int: dist = 20 time = 5 speed = dist/time time_travel = dist/speed result = time_travel return result
The perimeter of a rectangle is 60 meters and its length is 4 times its width. What are the dimensions of the rectangle?
def solve() -> int: perimeter = 60 length = 0 width = 0 for i in range(1, 31): if (30 - i) * 2 + i * 2 == perimeter: length = 4 * i width = i break result = f'Length={length}, Width={width}' return result
arah had 75 coins and she gave her brother 15 of them. Later, Sarah gave her other brother 8 coins. How many coins does Sarah have left?
def solve() -> int: coins_sarah = 75 coins_given1 = 15 coins_given2 = 8 coins_left = coins_sarah - (coins_given1 + coins_given2) result = coins_left return result
Rachel walks past 3 benches on her way to the beach. The distance between the first bench and the second bench is half a mile. The distance between the second bench and the third bench is 1 and 1/3 times longer than the distance between the first two benches. The distance from her house to the first bench and the last ...
def solve() -> int: distance_first_second = 0.5 distance_second_third = 1.333 * distance_first_second distance_house_first = 2 distance_last_bench_beach = 2 total_distance = distance_first_second + distance_second_third + distance_house_first + distance_last_bench_beach result = total_...
Student: Zoe is buying 3 pencils with different prices, $1.50, $2 and $1. How much will she need to pay for all 3 pencils?
def solve() -> int: pencil1 = 1.50 pencil2 = 2 pencil3 = 1 total_cost = pencil1 + pencil2 + pencil3 result = total_cost return result
Student: Sam is 5 feet, 7 inches tall. He jumps 8 inches off the ground. How high is the top of his head from the ground, in inches?
def solve() -> int: feet = 5 inches = 7 jump_height = 8 feet_to_inches = feet * 12 total_height = feet_to_inches + inches result = total_height + jump_height return result
In a city there are 7 hospitals. If each hospital has 225 beds, how many beds are there in total?
def solve() -> int: hospitals = 7 beds_per_hospital = 225 total_beds = hospitals * beds_per_hospital result = total_beds return result
A room has a length of 12 feet and a width that is half of its length. What is the total length of the walls in the room?
def solve() -> int: room_length = 12 room_width = room_length/2 total_length = 2*room_length + 2*room_width result = total_length return result
Jane paints 4 rooms in 8 hours. She can paint a room in 2 hours. Assuming she paints the same amount every day, how many rooms can she paint in 10 hours?
def solve() -> int: rooms_painted_per_hour = 1 / 2 rooms_painted_in_8_hours = rooms_painted_per_hour * 8 rooms_painted_in_10_hours = rooms_painted_per_hour * 10 result = rooms_painted_in_10_hours return result
A store is having a sale where everything is 20% off the original price. If a shirt costs $25, what is the sale price?
def solve() -> int: original_price = 25 discount = original_price * 0.2 sale_price = original_price - discount result = sale_price return result
In a school, the number of participants in the 2018 Science Quiz Bowl was 120. There were 24 more than twice the number of participants in 2019 as there were in 2018 and the number of participants in 2020 was 10% less than the number of participants in 2019. How many participants were there in 2020?
def solve() -> int: total18 = 120 increase18to19 = 24 total19 = total18 + increase18to19 decrease19to20 = total19 * 0.10 total20 = total19 - decrease19to20 result = total20 return result
A computer store sells laptops at a discount of 12% on the marked price of $1200. A customer gets a further discount of 8% on the reduced price. What is the price of the laptop sold to the customer?
def solve() -> int: marked_price = 1200 discount1 = 0.12 price_after_discount1 = marked_price * (1 - discount1) discount2 = 0.08 price_after_discount2 = price_after_discount1 * (1 - discount2) result = price_after_discount2 return result
Student: A girl takes 10 minutes to climb the stairs to her apartment. Currently, the apartment building has 7 floors. How long, in minutes, will it take her to go up all the floors?
def solve() -> int: time_per_floor = 10 num_floors = 7 total_time = time_per_floor * num_floors result = total_time return result
Cindy has 10% fewer pencils than David. David has 15 more pencils than Eric. Eric has 20% of the pencils that Frank has. If Frank has 200 pencils, how many pencils does Cindy have?
def solve() -> int: eric_pencils = 200 / 0.2 david_pencils = eric_pencils + 15 cindy_pencils = david_pencils * 0.9 result = cindy_pencils return result
A box contains 15 apples, 10 oranges, and 5 lemons. If you want to make the same number of fruit baskets and each basket contains only apples, oranges, or lemons, what is the maximum number of fruit baskets you can make?
def solve() -> int: maxFruitBaskets = 5 result = f'<<<{maxFruitBaskets}>>>' result = maxFruitBaskets return result
Jake and Lily each had 700 books in their collections. Jake donated one-seventh of his books to a library and then bought another 100 books from a bookstore. Lily sold one-tenth of her books online and then received one-eighth of Jake's books as a gift. How many books does Lily have left after the gift?
def solve() -> int: jake = 700 jake -= jake // 7 jake += 100 lily = 700 lily -= lily // 10 lily += jake // 8 result = lily return result
The recipe for brownies calls for 2 1/4 cups of flour, 2 cups of sugar, 3/4 cup of cocoa powder, 1 teaspoon of baking powder, 1 teaspoon of salt, 1 cup of vegetable oil, 4 eggs, and 1 tablespoon of vanilla extract. How many teaspoons of ingredients does the recipe require in total?
def solve() -> int: flour = 2.25 * 48 sugar = 2 * 48 cocoa_powder = 0.75 * 48 baking_powder = 1 * 3 salt = 1 * 3 vegetable_oil = 1 * 48 eggs = 4 * 3 vanilla_extract = 1 * 3 total_tsp = flour + sugar + cocoa_powder + baking_powder + salt + vegetable_oil + eggs + vanilla_extract re...
Student: - Kevin is selling lemonade for 50 cents per cup. He spent $10 to buy the ingredients and cups. He wants to make a profit of at least $15. How many cups of lemonade does he need to sell?
def solve() -> int: price_per_cup = 0.5 cost = 10 profit = 15 total_revenue = cost + profit total_cups = total_revenue / price_per_cup result = total_cups return result
Mary has 6 dimes and 5 nickels. How much money does Mary have?
def solve() -> int: dimes = 6 nickels = 5 dime_value = 10 nickel_value = 5 total_money = dimes * dime_value + nickels * nickel_value result = total_money return result
Student: A rectangle has a length that is four times the width. The perimeter of the rectangle is 140 cm. Find the length and width of the rectangle.
def solve() -> int: length = 0 width = 0 perimeter = 140 length = (140 - 4*width)/2 width = (140 - 2*length)/4 length = (140 - 4*width)/2 result = (length, width) return result
Malik is a freelancer and has $750 in his account from previous work. He is currently working for five clients, the first and second clients each pays him 3/4 of what the third, fourth and fifth clients pay him altogether. If the last three clients give Malik $900, how much will he get from the first two clients togeth...
def solve() -> int: clients_lastthree = 900 clients_firsttwo = clients_lastthree/4 * 3 result = clients_firsttwo * 2 return result
Here are some possible questions and programs: Anna has 20 yards of fabric to make some masks. She can make one mask with 0.5 yard of fabric and she sells each mask for $8. She donates 30% of her revenue to a local hospital. How much money does she donate?
def solve() -> int: masks = 20 / 0.5 revenue = masks * 8 donation = revenue * 0.3 result = donation return result
There are 12 students in a classroom and they need to share equally for a new set of books. The cost for the books is $1,150, if they already collected $580, how much more does each student have to contribute to cover the cost of the books?
def solve() -> int: total_students = 12 total_cost = 1150 amount_collected = 580 remaining_cost = total_cost - amount_collected each_contribution = remaining_cost / total_students result = each_contribution return result
a has 110 friends. 70% of her friends are boys and the remaining are girls. How many more boys does Seena have than girls?
def solve() -> int: total_friends_seena = 110 percentage_boy_friends_seena = 70 percentage_girl_friends_seena = 100 - 70 number_boy_friends_seena = total_friends_seena * (percentage_boy_friends_seena / 100) number_girl_friends_seena = total_friends_seena * (percentage_girl_friends_seena / 100) d...
A pack of pencils contains 12 pencils. Each pencil costs 25 cents. Bob buys 3 packs of pencils and pays with a 10 dollar bill. How much change does he get back?
def solve() -> int: total_cost = 3 * 12 * 0.25 change = 10 - total_cost result = change return result
Sam sells lemonade at a roadside stand. He buys lemons for $0.25 each and sugar for $0.5 per cup. He uses 4 lemons and 1 cup of sugar to make one pitcher of lemonade, which he sells for $3. If he sold 20 pitchers of lemonade in one day, what was his profit?
def solve() -> int: total_cost = 4 * 0.25 * 20 + 0.5 * 20 total_revenue = 3 * 20 profit = total_revenue - total_cost result = profit return result
If the coffee shop is open every weekday from 7 am to 5 pm, and on Saturdays from 9 am to 2 pm, how many hours is the coffee shop open in a week?
def solve() -> int: weekday_open = 7 weekday_close = 17 saturday_open = 9 saturday_close = 14 weekday_hours = weekday_close - weekday_open saturday_hours = saturday_close - saturday_open total_hours = (weekday_hours * 5) + saturday_hours result = total_hours return res...
Peter sells laptops and out of his 1000 customers, 35% of them end up returning their laptops. His laptops cost $800 each. What is his total profit after the returns?
def solve() -> int: num_customers = 1000 return_rate = 0.35 num_kept = num_customers * (1 - return_rate) laptop_cost = 800 total_revenue = num_kept * laptop_cost total_cost = num_customers * laptop_cost total_profit = total_revenue - total_cost result =...
``` Two airplanes, one flying at 600 km/h and the other at 700 km/h, started traveling towards each other from airports which are 2600 km apart. Find how long it will take for them to meet?
def solve() -> int: distance_apart = 2600 plane_1_speed = 600 plane_2_speed = 700 closing_speed = plane_1_speed + plane_2_speed time_to_meet = distance_apart/ closing_speed result = time_to_meet return result
7. A family wants to buy 3 cartons of ice cream and 4 packets of wafers. Each carton costs $12 and each packet of wafers cost $2. How much do they need to pay in total?
def solve() -> int: cost_of_carton = 12 num_cartons = 3 cost_of_wafers = 2 num_wafers = 4 cost_of_cartons = cost_of_carton * num_cartons cost_of_wafers = cost_of_wafers * num_wafers total_cost = cost_of_cartons + cost_of_wafers result = total_cost return result
3. Arthur bought 20 chocolates from a candy shop. He spent $4 for 3 chocolates and $3 for 6 chocolates. How much money did Arthur spend altogether?
def solve() -> int: total = 0 cost_of_3Choco = 4 num_of_3Choco = 3 cost_of_6Choco = 3 num_of_6Choco = 6 for choco in range(num_of_3Choco): total += cost_of_3Choco for choco in range(num_of_6Choco): total += cost_of_6Choco result = 22 return result
Student: In a geography competition, Akbar's score is 54 points. The difference in the scores between Akbar and Baba's score in the competition is 33 points. What is the sum of their scores, assuming Baba's score is higher than Akbar's?
def solve() -> int: akbar_score = 54 score_difference = 33 baba_score = akbar_score + score_difference total_score = akbar_score + baba_score result = total_score return result
A recipe calls for 1/4 cup of olive oil for 4 people. How much olive oil is needed for 12 people?
def solve() -> int: num_people = 12 olive_oil_per_person = 1/4/4 total_olive_oil = olive_oil_per_person * num_people result = total_olive_oil return result
A store sells 200 pens every week. If each pen costs 1 dollar, how much money does the store earn in a week from selling pens?
def solve() -> int: pens_sold = 200 cost_per_pen = 1 total_earned = pens_sold * cost_per_pen result = total_earned return result
It takes 20 minutes for Molly to walk to the gym. From the gym, she has to run back to the Sports Complex and it takes her 5 minutes. When she arrives there, she will have been gone from the Sports Complex 35 minutes altogether. If she had jogged to the football field first from the Sports Complex before running to the...
def solve() -> int: time_to_gym = 20 time_back_to_complex = 5 total_time_away = 35 time_to_field = total_time_away - (time_to_gym + time_back_to_complex) result = time_to_field return result
A box contains 20 marbles of different colors. There are 5 red, 6 blue, 4 green, and 5 yellow marbles. What is the probability of picking a green marble at random from the box?
def solve() -> int: total_marbles = 5 + 6 + 4 + 5 green_marbles = 4 probability = green_marbles / total_marbles result = probability return result
A box of cookies has 24 cookies. If Bob eats 2 cookies a day, how many days will the cookies last?
def solve() -> int: cookies_per_box = 24 cookies_eaten_per_day = 2 days_cookies_last = cookies_per_box // cookies_eaten_per_day result = days_cookies_last return result
The sum of two numbers is 78 and their difference is 10. What are the two numbers?
def solve() -> int: total = 78 diff = 10 num2 = (total - diff) / 2 num1 = total - num2 result = (num1, num2) return result
In a class of 30 students, 18 students like chocolate, 20 students like vanilla, and 10 students like both chocolate and vanilla. How many students do not like either chocolate or vanilla?
def solve() -> int: either = 18 + 20 - 10 neither = 30 - either result = neither return result
A rectangle has length of 40 cm and width of 20 cm. What is the perimeter of this rectangle?
def solve() -> int: length_cm = 40 width_cm = 20 perimeter_cm = 2 * (length_cm + width_cm) result = perimeter_cm return result
If a painter charges $400 to paint four walls of a room, how much would it cost to paint twelve walls?
def solve() -> int: numWalls = 12 costPerFourWalls = 400 totalCost = costPerFourWalls * (numWalls/4) result = 1200 return result
At a baseball game, there were 300 fans. 60% of the fans were rooting for the home team and the rest were rooting for the away team. How many fans were rooting for the away team?
def solve() -> int: total_fans = 300 home_team_fans = total_fans * 0.6 away_team_fans = total_fans - home_team_fans result = away_team_fans return result
Student: Chris has 3 times as many marbles as Jack. If Jack has 24 marbles, how many marbles do they have in total?
def solve() -> int: jack_marbles = 24 chris_marbles = jack_marbles * 3 total_marbles = jack_marbles + chris_marbles result = total_marbles return result
A vendor sells hot dogs and pretzels. On day 1, the vendor sells 12 hot dogs and 8 pretzels for a total of 50 dollars. On day 2, the vendor sells 10 hot dogs and 10 pretzels for a total of 48 dollars. What is the cost of a hot dog and a pretzel?
def solve() -> int: hot_dogs_day1 = 12 pretzels_day1 = 8 total_day1 = 50 hot_dogs_day2 = 10 pretzels_day2 = 10 total_day2 = 48 cost_of_hotdog = (total_day1 - (pretzels_day1 * 2)) / hot_dogs_day1 cost_of_pretzel = (total_day1 - (hot_dogs_day1 * cost_of_hotdog)) / pretzels_day1 result ...
Phil ran 2.2 laps on a 400m track in 7 minutes, what was his average speed in meters per second?
def solve() -> int: trackLength = 400 numberOfLaps = 2.2 time = 7 finalDistance = trackLength*numberOfLaps result = finalDistance/(time*60) return result
David bought 1 sweater at $40 and 2 pairs of jeans at $50 each. If David had $200, how much money does he have left after his purchases?
def solve() -> int: sweater_cost = 40 num_jeans = 2 jean_cost = 50 total_spent = sweater_cost + (num_jeans * jean_cost) total_money_left = 200 - total_spent result = total_money_left return result
Jack and Olivia met on a trip to Europe 8 years ago. They started dating 3 years after that and got married 5 years after they began dating. When did they meet each other?
def solve() -> int: years_ago = 8 dating_years_after_meeting = 3 marriage_years_after_dating = 5 current_year = 2021 year_they_started_dating = current_year - marriage_years_after_dating - dating_years_after_meeting - years_ago result = year_they_started_dating return result
In a class of twenty-five people, two-five of them have brown eyes and one-half of them have blonde hair. How many students have both brown eyes and blonde hair?
def solve() -> int: total_students = 25 students_brown_eyes = total_students * 0.8 students_blonde_hair = total_students * 0.5 students_brown_eyes_blonde_hair = students_brown_eyes * students_blonde_hair / total_students result = students_brown_eyes_blonde_hair return result
Matt is a stamp collector. He has 200 stamps in 4 different countries. He has five times more British stamps than American stamps and 10 Canadian postage stamps. Given that he has only one tenth as many French stamps as American stamps, how many stamps does he have from other countries?
def solve() -> int: american_stamps = 200 / 4 / 6 british_stamps = 5 * american_stamps canadian_stamps = 10 french_stamps = american_stamps / 10 other_stamps = british_stamps + canadian_stamps + french_stamps result = other_stamps return result
Student: Five bakeries donated some pastries to a homeless shelter. Boudin Bakery donated 48 croissants; La Brea Bakery donated four times the number of muffins than the number of croissants donated by Boudin Bakery; Panera Bread donated two times the number of croissants that Boudin Bakery donated; Corner Bakery donat...
def solve() -> int: boudin_croissants = 48 la_brea_muffins = 4 * boudin_croissants panera_croissants = 2 * boudin_croissants corner_muffins = la_brea_muffins / 4 sprinkles_cupcakes = boudin_croissants + 20 total_pastries = boudin_croissants + la_brea_muffins + panera_croissants + corner_muf...
Jacob has 8 bags of chips, each bag has 11 chips. He tastes every chip and sets 7 chips aside. How many chips are left with Jacob?
def solve() -> int: total_bags = 8 chips_per_bag = 11 total_chips = total_bags * chips_per_bag total_chips_tasted = total_chips total_chips_set_aside = 7 total_chips_left = total_chips - total_chips_set_aside result = total_chips_left return result
The perimeter of a square is 48 cm. What is the area of the square?
def solve() -> int: perimeter = 48 side_length = perimeter / 4 area = side_length ** 2 result = area return result
Tom drives his car at a speed of 45 mph for 45 minutes and then doubles his speed but slows down his time by a fifth. How far did he drive in total?
def solve() -> int: speed1 = 45 time1 = 0.75 speed2 = speed1 * 2 time2 = time1 * 0.8 distance1 = speed1 * time1 distance2 = speed2 * time2 total_distance = distance1 + distance2 result = total_distance return result
A science museum has 1000 visitors. If 40% of them are children, and of the remaining, 65% are local residents, how many non-local adults came to the museum?
def solve() -> int: total_visitors = 1000 children = int(total_visitors * 0.4) adults = total_visitors - children local_residents = int(adults * 0.65) non_local_adults = adults - local_residents result = non_local_adults return result
Sara has 24 stickers and she wants to share them equally with her 3 friends. How many stickers will each person get?
def solve() -> int: stickers = 24 people = 4 stickers_per_person = stickers // people result = stickers_per_person return result
Maria is climbing a steep staircase. For every 4 steps she climbs, she increases her elevation by 3 feet. If Maria starts at an elevation of 50 feet and wants to reach an elevation of 300 feet, how many steps will she have to climb?
def solve() -> int: num_steps = (300-50)*4/3 result = int(num_steps) return result
A pizza parlor charges $12 for a pizza with no toppings, and $2 for each topping. A customer orders a pizza with 4 toppings. How much will he pay in total?
def solve() -> int: base_price = 12 num_toppings = 4 topping_price = 2 total_price = base_price + (num_toppings * topping_price) result = total_price return result