question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Bailey bought a computer with a price of $1500 and saved 20% on the original price. How much did Bailey pay for the computer after the discount? Amanda, the painter, spends 3 hours per day on each of her paintings. It takes her 45 minutes to sketch the outline, 1 hour to fill in the colors, and 75 minutes to add detail...
def solve() -> int: original_price = 1500 discount = 0.2 discount_amount = original_price * discount final_price = original_price - discount_amount sketch_time = 45 color_time = 60 detail_time = 75 total_time = sketch_time + color_time + detail_time brush_dry_time = 2 * total_ti...
James has five crates of oranges and 9 loose oranges, while his neighbor has 26 loose oranges. They want to put all of the loose oranges in a crate. If James has a total of 113 oranges, how many more crates do they need?
def solve() -> int: james_crates = 5 james_loose_oranges = 9 neighbor_loose_oranges = 26 total_oranges = 113 total_loose_oranges = james_loose_oranges + neighbor_loose_oranges total_crates_needed = (total_oranges - total_loose_oranges) // 12 result = total_crates_needed return ...
A rectangular yard is twice as long as it is wide. The perimeter of the yard is 120 feet. What are the dimensions of the yard?
def solve() -> int: perimeter = 120 length = (perimeter / 2) - ((perimeter / 2)**2 - (perimeter**2 / 16))**0.5 width = length / 2 result = (length, width) return result
Student: Zach has three $50 bills, five $10 bills, and $2.75 in loose change in his wallet. If he buys a book that costs $22.95, how much money will he have left in his wallet?
def solve() -> int: fifty_bills = 3 ten_bills = 5 change = 2.75 book_cost = 22.95 total_money = fifty_bills * 50 + ten_bills * 10 + change money_left = total_money - book_cost result = money_left return result
Student: You have $200 that you spend on 4 items, with prices of $30, $60, $45, and $70. You want to get a 5% discount for each item. How much money will you save in total?
def solve() -> int: price1 = 30 price2 = 60 price3 = 45 price4 = 70 total_price = 200 discount_rate = 0.05 discounted_price1 = price1 * (1 - discount_rate) discounted_price2 = price2 * (1 - discount_rate) discounted_price3 = price3 * (1 - discount_rate) discounted_price4 = price4...
Student: A child buys 3 toys that cost $5 each and 2 toys that cost $8 each. What is the total cost of their purchase?
def solve() -> int: toys_5 = 3 price_5 = 5 toys_8 = 2 price_8 = 8 cost_5 = toys_5 * price_5 cost_8 = toys_8 * price_8 total_cost = cost_5 + cost_8 result = total_cost return result
A class of 40 students is having a party. 60% of them prefer soda, 25% juice, and 15% don't drink either. How many students prefer juice?
def solve() -> int: total_students = 40 soda_drinkers = total_students * 0.6 juice_drinkers = total_students * 0.25 no_drinkers = total_students * 0.14 juice_lovers = juice_drinkers result = juice_lovers return result
A car travels 250 miles in 5 hours. What is the average speed of the car in miles per hour (mph)?
def solve() -> int: distance = 250 time = 5 speed = distance / time result = speed return result
A contractor charges $150 per hour for their services. If they work for 8 hours per day for 5 days, how much money will they make?
def solve() -> int: hourly_rate = 150 hours_per_day = 8 num_days = 5 total_hours = hours_per_day * num_days total_earnings = hourly_rate * total_hours result = total_earnings return result
Harry wants to buy a new bicycle. He has saved $200 from his allowance and birthday money. The bicycle he likes costs $350. He decides to sell some of his old books and toys to raise more money. He sells 15 books for $2 each and 10 toys for $3 each. How much more money does he need to buy the bicycle?
def solve() -> int: harry_money = 200 bicycle_cost = 350 books_number = 15 books_price = 2 toys_number = 10 toys_price = 3 books_money = books_number * books_price toys_money = toys_number * toys_price selling_money = books_money + toys_money money_needed = bicycle_cost - harry_m...
A train travels 50 miles in 1 hour and 30 minutes. What is the average speed of the train in miles per hour?
def solve() -> int: distance = 50 time = 1.5 speed = distance / time result = speed return result
A recipe for 4 servings of a dish calls for 2 cups of flour. If you want to make 8 servings of the dish, how many cups of flour do you need?
def solve() -> int: servings_recipe = 4 cups_flour_recipe = 2 servings_wanted = 8 cups_flour_wanted = (servings_wanted * cups_flour_recipe)/servings_recipe result = cups_flour_wanted return result
On Monday, Carla paints 3 walls of a room, each wall taking 20 minutes. On Tuesday, Carla paints 2 walls of the same room, each wall taking 25 minutes. On Wednesday, Carla paints the remaining wall of the room, which takes 30 minutes. How many minutes total does Carla spend painting the room from Monday to Wednesday?
def solve() -> int: time_monday = 3 * 20 time_tuesday = 2 * 25 time_total = time_monday + time_tuesday + 30 result = time_total return result
There are 24 students in a class. If there are 16 girls, how many boys are in the class?
def solve() -> int: total_students = 24 num_girls = 16 num_boys = total_students - num_girls result = num_boys return result
Yesterday, Jacob collected 60 marbles while Olivia collected 50 more marbles. Today, Jacob collected 45 marbles while Olivia collected 80 marbles. How many fewer marbles did they collect today than yesterday?
def solve() -> int: yesterday_jacob = 60 yesterday_olivia = yesterday_jacob + 50 today_jacob = 45 today_olivia = 80 difference = (yesterday_jacob + yesterday_olivia) - (today_jacob + today_olivia) result = difference return result
Jeff and David are laying tile for their bathroom. Each tile is 1 dm in width and 0.5 dm in height. How many tiles does Jeff and David need to cover an area of 15 dm²?
def solve() -> int: tile_count = 0 while 15 > tile_count * 0.5: tile_count += 1 result = tile_count return result
Jane has 2 more candy bars than John. John has 4 more candy bars than Sarah. If Sarah has 20 candy bars, how many candy bars do the three have in total?
def solve() -> int: sarah_candybars = 20 john_candybars = sarah_candybars + 4 jane_candybars = john_candybars + 2 result = sarah_candybars + john_candybars + jane_candybars result return result
ven was at the zoo and counted 75 kangaroos, 80 more camels than kangaroos, and 40 fewer zebras than the total number of kangaroos and camels combined. If the number of elephants was twice the number of camels, what was the total number of animals that he counted?
def solve() -> int: kangaroos = 75 camels = kangaroos+80 zebras = camels-40 elephants = camels*2 total = kangaroos+camels+zebras+elephants result = total return result
Mrs. Brown has 150 sheep, where 40% are rams and the rest are ewes. Only half of the ewes give birth to lambs in a season. How many ewes are there in Mrs. Brown's farm?
def solve() -> int: total_sheep = 150 ram_percentage = 40 rams = total_sheep * ram_percentage / 100 ewes = total_sheep - rams ewes_with_lambs = ewes / 2 ewes_without_lambs = ewes - ewes_with_lambs result = ewes_without_lambs return result
A farmer wants to plant crops in a rectangular field which is 20 meters long and 15 meters wide. If the farmer needs to put 5 seeds per square meter, how many seeds does he need to buy?
def solve() -> int: field_length = 20 field_width = 15 seeds_per_square_meter = 5 total_seeds = field_length * field_width * seeds_per_square_meter result = total_seeds return result
Maria is making a quilt that is 5 feet wide and 6 feet long. She wants to add a border that is 6 inches wide. If she needs 1.5 square feet of fabric for every inch of border, how many square feet of fabric does she need for the border?
def solve() -> int: quilt_width = 5 quilt_length = 6 border_width = 6 / 12 fabric_needed_per_inch = 1.5 border_length = quilt_length + 2 * border_width border_width = quilt_width + 2 * border_width total_border_area = border_length * border_width fabric_needed = total_border_a...
Tyler is making a salad and the recipe calls for teaspoons of salt instead of telling him the number. He needs 1 teaspoon in total. He looks up online that a pinch of salt is 1/8 of a teaspoon. How many pinches of salt should he use?
def solve() -> int: total_teaspoons = 1 teaspoon_to_pinch = 8 total_pinches = total_teaspoons * teaspoon_to_pinch result = total_pinches return result
A rectangle has a length of 12 meters and a width of 8 meters. What is the area of the rectangle in square meters?
def solve() -> int: length = 12 width = 8 area = length * width result = area return result
Max wants to make a fruit salad for a picnic. He needs 2 apples, 3 bananas, and 5 oranges. The apples cost $0.8 each, the bananas cost $0.6 each, and the oranges cost $0.4 each. He also needs a large bowl that costs $5. How much money will he spend on the fruit salad?
def solve() -> int: cost_apples = 2 * 0.8 cost_bananas = 3 * 0.6 cost_oranges = 5 * 0.4 cost_fruits = cost_apples + cost_bananas + cost_oranges cost_salad = cost_fruits + 5 result = cost_salad return result
ve has 15 cats and 35 dogs, he feed each dog with 200g of food everyday and each cat with 50g of food every day. If food cost $10 per kg, how much does Steve have to spend on food for his animals in a month?
def solve() -> int: amount_of_food_for_dogs = 35 * 200 amount_of_food_for_cats = 15 * 50 amount_of_food = (amount_of_food_for_dogs + amount_of_food_for_cats) / 1000 cost_in_kg = amount_of_food * 10 result = cost_in_kg * 30 return result
James has 8 packs of pencils with 6 pencils in each pack. How many pencils does James have in total?
def solve() -> int: total = 0 for x in range(8): total+=6 result = total return result
Andy read 20 pages of a book in 30 minutes. Bob read 15 pages of the same book in 20 minutes. Carol read 25 pages of the same book in 40 minutes. If they continued reading at the same rate, how many pages did they read in total in an hour?
def solve() -> int: andy_rate = 20 / 30 bob_rate = 15 / 20 carol_rate = 25 / 40 total = andy_rate * 60 + bob_rate * 60 + carol_rate * 60 result = total return result
When Sophie goes skiing, she wears gloves to keep her hands warm. Each glove warms her hands up by 4 degrees. One day, she wore half of the gloves in her ski bag. How many degrees did the gloves warm Sophie's hands up?
def solve() -> int: total_gloves = 20 worn_gloves = total_gloves / 2 temp_increase = 4 total_temp_increase = worn_gloves * temp_increase result = total_temp_increase return result
Student: Brianna has some apples. She needs to split the them into 5 equal baskets. If she has 32 apples, how many apples will be in each basket?
def solve() -> int: apples = 32 baskets = 5 apples_per_basket = apples // baskets remaining_apples = apples % baskets result = apples_per_basket return result
Ella bakes 4 batches of cookies this week. Each batch makes 24 cookies and each cookie has 110 calories. She gives away half of the cookies to her friends and family. She eats 3 cookies on Monday, 4 cookies on Tuesday, and 2 cookies on Wednesday. She does not eat any cookies on Thursday and Friday. How many calories do...
def solve() -> int: total_cookies = 4 * 24 total_calories = total_cookies * 110 half_cookies = total_cookies / 2 half_calories = half_cookies * 110 mon_to_wed_cookies = 3 + 4 + 2 mon_to_wed_calories = mon_to_wed_cookies * 110 weekend_calories = total_calories - half_calo...
A car rental company charges $20 per day plus $0.25 per mile up to 100 miles/day, and $0.10 per mile after 100 miles/day. If a customer rents a car for 5 days and drives 450 miles, what is the total cost?
def solve() -> int: num_days = 5 num_miles = 450 if num_miles <= num_days*100: cost = num_days*20 + num_miles*0.25 else: cost = num_days*20 + 100*0.25 + (num_miles-100)*0.1 result = cost return result
A class has 30 students. The teacher gives each student 3 pencils. After everyone has their pencils, how many pencils will be left in the teacher's supply box?
def solve() -> int: students = 30 pencils_per_student = 3 total_pencils_given = students * pencils_per_student teacher_pencil_supply = total_pencils_given - total_pencils_given result = teacher_pencil_supply return result
Cindy has a rectangular flower bed that measures 8 feet by 6 feet. She wants to put fencing around the entire border of the flower bed. If each section of fencing is 3 feet long, how many sections of fencing will Cindy need to buy?
def solve() -> int: length = 8 width = 6 perimeter = (length + width) * 2 section_length = 3 sections_needed = perimeter / section_length result = sections_needed return result
Daniel set up a used book store to earn some money. Each book he sold would earn him $2. He spent $80 on 50 used books. He decided to sell each book for $5. He read 2 books while waiting for customers to come. He sold all but 10 books. How much net profit did Daniel earn?
def solve() -> int: num_books = 50 cost_per_book = 80/num_books profit_per_book = 5 - cost_per_book num_read_books = 2 num_sold_books = num_books - num_read_books - 10 total_profit = num_sold_books * profit_per_book result = total_profit return result
A car travels a distance of 200 miles in 4 hours. What is its average speed in miles per hour?
def solve() -> int: distance = 200 time = 4 average_speed = distance/time result = average_speed return result
-Put each new question in a separate line - Bob is making sandwiches. He has 12 slices of ham, 18 slices of cheese, and 24 slices of bread. He uses two slices of bread, one slice of ham, and one slice of cheese for each sandwich. He gives away six sandwiches to his friends. How many sandwiches and how many slices of ea...
def solve() -> int: ham = 12 cheese = 18 bread = 24 sandwiches = 0 while ham > 0 and cheese > 0 and bread > 1: ham -= 1 cheese -= 1 bread -= 2 sandwiches += 1 sandwiches -= 6 ham_left = ham cheese_left = cheese bread_left = bread result...
A bookshelf has 36 books on it. Two-thirds of the books are fiction and the rest are non-fiction. One-fourth of the non-fiction books are biographies. How many biographies are on the bookshelf?
def solve() -> int: books = 36 fiction = books * 2/3 non_fiction = books - fiction biographies = non_fiction * 1/4 result = biographies return result
Maya is saving money for a new business venture. She has decided that she will increase the amount she saves each week by 20 dollars. If she started by saving 50 dollars this week, how much will she have saved in 4 months from now?
def solve() -> int: week_savings = 50 increase_per_week = 20 months = 4 total_savings = week_savings * (months * 4) + increase_per_week * (months * (months - 1) // 2) result = total_savings return result
In three years, John will be three times as old as Maria. If Maria is now 12 years old, how old is John now?
def solve() -> int: maria_age=12 john_age=(3* (maria_age+3))-3 result=john_age return result
Leo has a rectangular garden that is 12 meters long and 8 meters wide. He wants to plant flowers along the perimeter of the garden, leaving 1 meter of space between each flower. How many flowers does he need to buy?
def solve() -> int: length = 12 width = 8 space = 1 perimeter = 2 * (length + width) spaces = perimeter // space flowers = spaces + 1 result = flowers return result
A rectangular garden has a length of 10 meters and a width of 6 meters. If a fence is placed around the garden, how many meters of fencing will be needed?
def solve() -> int: perimeter = 2 * (10 + 6) result = perimeter return result
Olivia is making a necklace with beads. She has 120 beads of different colors. She wants to use 60% of the beads for the necklace, and divide the rest equally among her 3 friends. How many beads will she use for the necklace, and how many beads will each friend get?
def solve() -> int: necklace_beads = int(0.6 * 120) left_beads = 120 - necklace_beads friend_beads = int(left_beads / 3) result = f"Olivia will use {necklace_beads} beads for the necklace, and each friend will get {friend_beads} beads." return result
Student: Lisa saves $20 every week for 3 months to buy a new phone. The phone costs $400. How much does Lisa have saved up?
def solve() -> int: weekly_saving = 20 months = 3 phone_cost = 400 weeks = months * 4 total_saving = weekly_saving * weeks difference = total_saving - phone_cost result = difference return result
Jillian buys a 12-pack of soda for $5.50. Each can of soda normally costs $0.75. She sells each can of soda for $1. What is her profit?
def solve() -> int: cost_per_can = 0.75 soda_pack_size = 12 soda_pack_cost = 5.50 soda_pack_cost_per_can = soda_pack_cost / soda_pack_size income_per_can = 1 profit_per_can = income_per_can - cost_per_can profit_per_pack = (income_per_can * soda_pack_size) - soda_pack_cost result = profi...
Jay has to pack 10 boxes with 100 apples each. He can pack 15 apples every 5 minutes. How long will it take for him to finish packing all the boxes?
def solve() -> int: boxes = 10 apples_per_box = 100 apples_per_minute = 15 minutes_per_batch = 5 total_apples = boxes * apples_per_box total_batches = total_apples / apples_per_minute total_minutes = total_batches * minutes_per_batch result = total_minutes return result
Chinnu has three jars of coins. One jar of pennies, one jar of nickels and one jar of dimes. She has the same amount of pennies as she does nickels. She has four times as many dimes as she does pennies. She has two times as many nickels as she does dimes. If she has 480 pennies, how much money does she have?
def solve() -> int: num_pennies = 480 num_dimes = 480/4 num_nickels = num_dimes*2 total_money = num_pennies*1 + num_nickels*5 + num_dimes*10 result = total_money return result
Mark wants to buy the iPad Pro and it costs $1,200. He already has $600 saved up and he intends to borrow the remaining amount from his parents. His parents want him to pay them back at $30 per week. How many weeks will it take Mark to pay them back in full?
def solve() -> int: total_ipad_cost = 1200 amount_already_saved = 600 weekly_payment = 30 remaining_cost = total_ipad_cost - amount_already_saved number_of_weeks = remaining_cost / weekly_payment result = number_of_weeks return result
Student: There are 150 people on a train, 3/10 of whom are seated while the rest are standing. If there are 10 more standing than seated, how many are standing?
def solve() -> int: total_people = 150 seated_people = total_people * 3/10 standing_people = total_people - seated_people difference = standing_people - seated_people result = standing_people + difference return result
A cake recipe calls for 2 and a half cups of flour to serve six people. How much flour would be needed if it needed to be doubled to serve twelve?
def solve() -> int: flour_needed = 2.5/6*12 result = f'<<<{flour_needed}>>>' result = flour_needed return result
Sarah has 5 candies. Her friend has different types of sweets, which have seven times as many calories as Sarah's candies have. She has one lollipop, one chocolate bar, and the rest are candies. How many candies does her friend own?
def solve() -> int: sarah_candies = 5 calories_per_candy = 7 friend_lollipop = 1 friend_chocolate_bar = 1 friend_candies = (friend_lollipop + friend_chocolate_bar) / (calories_per_candy - 1) total_friend_candies = friend_candies + sarah_candies result = total_friend_candies return r...
A parking lot charges $5 per hour for parking and $10 for a full day. They earned $230 in sales. If there were 25 hourly parkers, how many full day parkers were there?
def solve() -> int: hourly_parkers = 25 hourly_rate = 5 full_day_rate = 10 total_sales = 230 hourly_sales = hourly_parkers * hourly_rate full_day_sales = total_sales - hourly_sales num_full_day_parkers = full_day_sales / full_day_rate result = num_full_day_parkers ...
A school is organizing a field trip and requires a minimum of 32 students and a maximum of 48 students. A bus can carry a maximum of 54 students. How many buses are required if 90 students sign up for the field trip?
def solve() -> int: min_students = 32 max_students = 48 bus_capacity = 54 total_students = 90 students_over_capacity = total_students - max_students buses_required = 1 + students_over_capacity // bus_capacity result = buses_required return result
In Mathland, a tutor charges $30 per hour of tutoring. Kevin spent $120 on his math tutoring. How many hours did Kevin receive tutoring?
def solve() -> int: tutor_rate = 30 total_payment = 120 hours_of_tutoring = total_payment / tutor_rate result = hours_of_tutoring return result
Mark decides to make a vegetable soup. He brings 9 pounds of vegetables and 3 pounds of beef. Vegetables are $1 per pound, and beef is twice as expensive. What is Mark's total expenditure?
def solve() -> int: vegetable_price = 1 beef_price = 2 * vegetable_price vegetable_weight = 9 beef_weight = 3 vegetable_cost = vegetable_price * vegetable_weight beef_cost = beef_price * beef_weight total_expenditure = vegetable_cost + beef_cost result = total_expendi...
A store sells two types of apples, regular and organic. Organic apples cost 50 cents more per pound than regular apples. If Sarah bought 3 pounds of organic apples and 5 pounds of regular apples for $7.50, how much does each type of apple cost per pound?
def solve() -> int: O = 2.00 R = 0.70 result = (O, R) return result
``` A school is fundraising by selling candy bars. Each candy bar costs $2 to make and they sell each candy bar for $5. If they sell 300 candy bars, how much profit do they make after expenses?
def solve() -> int: cost_per_bar = 2 sell_price = 5 bar_amt = 300 total_revenue = sell_price * bar_amt total_expenses = cost_per_bar * bar_amt profit = total_revenue - total_expenses result = profit return result
bought a car for $20,000. After one year, the value of the car depreciates by 20%. What is the value of the car after one year?
def solve() -> int: car_value = 20000 depreciation_percentage = 20 depreciation_value = car_value * depreciation_percentage / 100 value_after_one_year = car_value - depreciation_value result = value_after_one_year return result
arah has 8 green towels and 6 yellow towels. Each green towel weighs 250 grams and each yellow towel weighs 280 grams. How much does Sarah have in total (in grams)?
def solve() -> int: num_green_towels = 8 weight_per_green_towel = 250 total_g_green_towels = num_green_towels * weight_per_green_towel num_yellow_towels = 6 weight_per_yellow_towel = 280 total_g_yellow_towels = num_yellow_towels * weight_per_yellow_towel total_g = total_g_green_t...
During a workout, Michael noticed that the weight he lifted was equal to the number of reps he did in the previous set. If he did 15 reps, how much weight did he lift? The Science Club needs to complete 35 experiments this semester to meet their research requirements. They have already completed 22. If they want to mee...
def solve() -> int: reps = 15 weight = reps total_experiments = 35 completed_experiments = 22 remaining_experiments = total_experiments - completed_experiments result = weight, remaining_experiments return result
Four cubes are arranged so that they have one face touching all other cubes. What is the total surface area of all the cubes?
def solve() -> int: cube_length = 10 cube_surface_area = 6 * cube_length**2 total_surface_area = 4*cube_surface_area result = 2400 return result
A store sells shirts for $20 each and pants for $35 each. If John buys 2 shirts and 3 pants, what is the cost of his purchase?
def solve() -> int: shirt_price = 20 pants_price = 35 number_of_shirts = 2 number_of_pants = 3 total_cost = (number_of_shirts * shirt_price) + (number_of_pants * pants_price) result = total_cost return result
Emma's train takes six less minutes than Grace's bus to reach the airport over the same distance. If the bus takes 45 minutes to cover a distance of 30 miles to the airport, how much time will it take Emma's train to make the round trip?
def solve() -> int: bus_distance = 30 bus_time = 45 emma_time = bus_time - 6 round_trip_time = (emma_time + bus_time) * 2 result = round_trip_time return result
A pencil costs 25 cents, and a pen costs 50 cents. How much money do you need to buy 3 pencils and 4 pens?
def solve() -> int: total_cost = (3 * 25) + (4 * 50) result = total_cost return result
Two numbers have a sum of -17. If one number is 7 times larger than the other, what are the two numbers?
def solve() -> int: sum = -17 diff = 6 larger = (sum + diff) / 8 smaller = sum - larger result = (smaller, larger) return result
A store had 100 shirts. They sold 20 shirts, and received 50 more shirts. How many shirts do they have now?
def solve() -> int: initial_shirts = 100 shirts_sold = 20 shirts_received = 50 final_shirts = initial_shirts - shirts_sold + shirts_received result = final_shirts return result
Ethan's cousin hires him to walk her dog and give it a bath. Walking the dog takes 30 minutes and pays $10. If Ethan wants to make $15/hour working for his cousin, and bath time takes 1 hour, how much should Ethan charge (in total, not per hour) for bathing the dog?
def solve() -> int: walking_time = 30 walking_pay = 10 hourly_rate = 15 bath_time = 60 total_pay = walking_pay + (hourly_rate * (bath_time / 60)) result = total_pay return result
Bob's drone was completely dead, but after being charged for 50 minutes, it has achieved a 70% charge. How much longer must Bob continue charging the drone to reach a full charge of 100%?
def solve() -> int: charge_percentage = 70 charge_time = 50 remaining_percentage = 100 - charge_percentage additional_time = (remaining_percentage / charge_percentage) * charge_time result = additional_time return result
It takes 6 minutes to walk from the corner store to Austin's house. If he walks a total of 35 minutes, how many times does he have to walk from the corner store?
def solve() -> int: total_minutes = 35 time_to_walk = 6 num_walks = total_minutes // time_to_walk result = num_walks return result
Student: Amy bought a dress for $60. The dress was on sale for 20% off. She also had a $5 coupon. What was the final cost of the dress?
def solve() -> int: price = 60 discount = 0.2 coupon = 5 discounted_price = price * (1 - discount) result = discounted_price - coupon return result
There are 28 sweets in a box. Josh and his 4 friends each took 5 sweets. When they were almost done, Josh's two siblings asked for 4 sweets each. How many sweets did Josh have left?
def solve() -> int: total_sweets = 28 num_friends = 4 sweets_taken_by_each_friend = 5 sweets_left = total_sweets - (num_friends * sweets_taken_by_each_friend) num_siblings = 2 sweets_taken_by_each_sibling = 4 sweets_left_for_Josh = sweets_left - (num_siblings * sweets_taken_by_each_sibling) ...
Sarah and her friends want to rent a car for their one-day beach trip that is 120 kilometers away. The first option for a car rental costs $35 per day, without gasoline. The second option is $80 per day including gasoline. A liter of gasoline can cover 17 kilometers and costs $1 per liter. How much will they save if th...
def solve() -> int: distance = 120 gasoline_price = 1 gasoline_coverage = 17 option1_price = 35 option2_price = 80 gasoline_needed = distance / gasoline_coverage gasoline_cost = gasoline_needed * gasoline_price total_cost_option2 = option2_price total_cost_option1 = option1_pric...
John needs to save $1000 in 6 months. If he saves $150 every month, how much does he need to save in the last month?
def solve() -> int: total_savings = 150*5 last_month_saving = 1000-total_savings result = last_month_saving return result
A farmer has two chicken coops. In the first coop, there are 18 chickens and in the second there are 23. If each chicken lays one egg per day, how many eggs are laid in total in 7 days?
def solve() -> int: eggs_per_chicken = 1 days = 7 coop1_chickens = 18 coop2_chickens = 23 total_chickens = coop1_chickens + coop2_chickens total_eggs = total_chickens * eggs_per_chicken * days result = total_eggs return result
Samantha, Rachel, and Claire are going on a trip that is a total of 500 kilometers. Samantha drives 30 kilometers less than four times Rachel's drive, and Rachel drives five times the distance that Claire drives. How many kilometers does Claire drive?
def solve() -> int: rachel_drive = 0 samantha_drive = 0 claire_drive = 0 claire_drive = 500 / (5 + 1) rachel_drive = claire_drive * 5 samantha_drive = (4 * rachel_drive) - 30 result = claire_drive return result
Madison sees three trees in a park and tries to estimate their heights. She knows from a sign that the one in the middle is 50 feet tall. The one on the left looks like it is 70% of the height of the middle one. The one on the right looks 30 feet shorter than if the tree on the left and middle were stacked on top of ea...
def solve() -> int: middle_tree_height = 50 left_tree_height = 0.7 * middle_tree_height right_tree_height = (left_tree_height + middle_tree_height) - 30 result = left_tree_height + middle_tree_height + right_tree_height return result
Student: Bryon bought 10 cookies, which had 4 broken pieces. What is the percentage of broken pieces in the cookies?
def solve() -> int: cookies_bought = 10 broken_pieces = 4 total_pieces = cookies_bought * 4 percentage_broken = (broken_pieces / total_pieces) * 100 result = percentage_broken return result
Emily spent 40 minutes finishing her online quiz, but didn't save it properly and had to redo. Redoing it took 3 times as long. During the final submission, the platform unexpectedly shut down for 5 minutes. If Emily had been studying twice as much as taking online quizzes, how much time did she spend total?
def solve() -> int: first_attempt = 40 second_attempt = 3 * first_attempt final_submission = 5 total_time = first_attempt + second_attempt + final_submission studying_time = 2 * total_time total_spent_time = total_time + studying_time result = total_spent_time ...
A store has a 20% discount on all items. If a bag originally costs $120, how much is the discounted price?
def solve() -> int: original_price = 120 discount_rate = 0.2 discounted_price = original_price * (1 - discount_rate) result = discounted_price return result
Ria needs to get at least 70% on her final exam to pass the course. She has already scored 85% on her midterm and 80% on her assignments, which together count for 60% of her final grade. How many points out of 100 does she need to get on her final exam?
def solve() -> int: final_grade = 70 midterm = 85 assignments = 80 midterm_weight = 0.3 assignments_weight = 0.3 final_exam_weight = 0.4 final_exam = (final_grade - (midterm * midterm_weight) - (assignments * assignments_weight)) / final_exam_weight result = final_exam ret...
A store is having a 20% off sale. If a shirt costs $25 before the sale, how much will it cost during the sale?
def solve() -> int: original_price = 25 discount_percent = 0.2 discount = original_price * discount_percent sale_price = original_price - discount result = sale_price return result
Mike wants to have a class average of 94. He has scored 91 and 95 on the first two tests. What must he score on the third test to achieve his goal?
def solve() -> int: test1 = 91 test2 = 95 average = 94 grade_needed = (average * 3) - (test1 + test2) result = grade_needed return result
A school has 1200 students and 60 teachers. Each teacher teaches 20 students. The school wants to reduce the class size to 15 students per teacher. How many more teachers does the school need to hire?
def solve() -> int: current_classes = 1200 / 20 desired_classes = 1200 / 15 class_difference = desired_classes - current_classes teachers_needed = class_difference result = teachers_needed return result
A pizza place charges $10 for a plain pizza and $1.50 for each topping. If Maria orders a pizza with 3 toppings, how much will she have to pay?
def solve() -> int: plain_pizza_cost = 10 num_toppings = 3 topping_cost = 1.5 total_cost = plain_pizza_cost + num_toppings * topping_cost result = total_cost return result
Amelia manages a bakery that serves three different types of cupcakes, each of which sells for $2. If a total of 520 cupcakes were sold that day, calculate how many of each type were sold.
def solve() -> int: type1 = 0 type2 = 0 type3 = 0 type1 = 520 // 3 type2 = 520 // 3 type3 = 520 - (type1 + type2) result = (type1, type2, type3) return result
If a bike travels at 5 meters per second for 2 minutes, how far will it travel in kilometers?
def solve() -> int: speed = 5 time_in_seconds = 2 * 60 distance_in_meters = speed * time_in_seconds distance_in_km = distance_in_meters / 1000 result = distance_in_km return result
Tom is calculating the number of marbles he owns, but he double-counts 6 marbles and forgets to count 4 more. If Tom thinks he has 50 marbles, how many marbles does he actually have?
def solve() -> int: double_counted = 6 forgotten = 4 total_counted = 50 actual_count = total_counted - double_counted + forgotten result = actual_count return result
Possible questions and programs: Laura can make 12 bracelets and 8 necklaces every week. A bracelet sells for $15 and a necklace sells for $25. She also spends 20 percent of her total earnings on materials. How much is her total profit every week?
def solve() -> int: bracelets = 12 necklaces = 8 bracelet_price = 15 necklace_price = 25 material_cost = 0.2 total_earnings = bracelets * bracelet_price + necklaces * necklace_price total_cost = material_cost * total_earnings total_profit = total_earnings - total_cost result = t...
ome possible questions and python programs are: Mary needs 4 cans of paint to cover the walls of a room. She has 3 rooms to paint, but one of them is only half the size of the others. She also wants to paint the ceiling of each room, which requires 2 cans of paint per room. How many cans of paint does she need in total...
def solve() -> int: wall = 4 half_wall = 2 ceiling = 2 room1 = wall + ceiling room2 = wall + ceiling room3 = half_wall + ceiling total = room1 + room2 + room3 result = total return result
A bicycle is being sold by a store. The store gets to keep 20% of the selling price, and the rest goes to the manufacturer. If the store sold the bicycle for $240, how much did the manufacturer earn?
def solve() -> int: store_percentage = 20 store_profit = 240*(store_percentage/100) manufacturer_profit = 240 - store_profit result = manufacturer_profit return result
In a wedding party with 150 guests, 70 people decided to have some snacks. Later on, 30 more guests joined them. Half of the people who ate snacks left after getting full, followed by 5 more people who joined them. 15 more snack eaters left after getting full. Later on, half of the remaining snack eaters left. How many...
def solve() -> int: total_guests = 150 snack_eaters = 70 snack_eaters += 30 snack_eaters /= 2 snack_eaters += 5 snack_eaters -= 15 snack_eaters /= 2 guests_with_snacks = snack_eaters result = guests_with_snacks return result
Student: Sarah has 4 fewer stickers than Josh, but 3 more stickers than Grace. If Josh gives 5 stickers to Grace and Sarah gives 2 stickers to Grace, how many stickers will Grace have in total?
def solve() -> int: josh_stickers = 0 sarah_stickers = 0 grace_stickers = 0 josh_stickers = sarah_stickers + 4 grace_stickers = sarah_stickers - 3 josh_stickers -= 5 grace_stickers += 5 sarah_stickers -= 2 grace_stickers += 2 result = grace_stickers return result
James went on a road trip for 10 days and it rained for 2 of those days. The amount of rainfall was 7 inches and 2 inches. During the same 10 days, it rained 12 inches in his city. How much less rain did James experience on his road trip than in his city?
def solve() -> int: trip_days = 10 rainy_days = 2 trip_rainfall = 7 + 2 city_rainfall = 12 total_rain = trip_rainfall * rainy_days difference = city_rainfall - total_rain result = difference return result
If Ava is currently 12, and her older brother, Max, is 16 years older than her and 8 years older than their youngest sibling, Leo, how old will Leo be when Ava turns 12?
def solve() -> int: ava_age = 12 max_age = ava_age + 16 leo_age = max_age - 8 years_passed = ava_age - leo_age leo_age_when_ava_turns_12 = leo_age + years_passed result = leo_age_when_ava_turns_12 return result
-The questions can cover different topics such as fractions, decimals, percentages, ratios, proportions, word problems, etc. Example output: Oscar bought 18 packs of juice boxes for a school picnic. Each pack had 24 juice boxes and cost $12. He sold each juice box for 75 cents at the picnic. How much money did Oscar ma...
def solve() -> int: total_juice_boxes = 18 * 24 total_cost = 18 * 12 total_revenue = total_juice_boxes * 0.75 profit = total_revenue - total_cost result = profit return result
If there are 10 yards of fabric in a roll and Sarah needs 6 yards, how much fabric is Sarah left with?
def solve() -> int: remaining_fabric = 10 - 6 result = remaining_fabric return result
Student: Sam earned X dollars per hour working as a tutor, and Y dollars per hour working as a cashier. He worked 12 hours as a tutor and 8 hours as a cashier in a week, and earned a total of $320. If he earned $4 more per hour as a tutor than as a cashier, what is the value of X, in dollars?
def solve() -> int: x = 0 y = 0 tutor_earnings = x * 12 cashier_earnings = y * 8 total_earnings = tutor_earnings + cashier_earnings difference = x - y x = (total_earnings - (difference * 12)) / 20 result = x return result
Sam wants to order a meal subscription box. The box costs $200/month or $50/week. If Sam wants to order for 5 months, each with exactly 4 weeks, how much money does he save by paying monthly?
def solve() -> int: weeks_per_month = 4 months = 5 cost_per_month = 200 cost_per_week = 50 total_cost_monthly = cost_per_month * months total_cost_weekly = cost_per_week * weeks_per_month * months savings = total_cost_weekly - total_cost_monthly result = savings return...
In a class of 30 students, 14 are boys. What percentage of students are girls?
def solve() -> int: girls = 30 - 14 total_students = 30 result = (girls / total_students) * 100 return result
Noah is measuring the length of different fish. He sees that a swordfish is 3 times longer than a trout and a salmon is 1/2 as long as a swordfish. How many times longer is a salmon than a trout?
def solve() -> int: trout_length = 1 swordfish_length = 3 * trout_length salmon_length = 1/2 * swordfish_length salmon_trout_ratio = salmon_length / trout_length result = salmon_trout_ratio return result
Jack drove 200 miles with an average speed of 50 miles per hour. How long did it take him to get there?
def solve() -> int: distance = 200 speed = 50 time = distance/speed result = time return result