question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
If a coffee shop serves two lattes and six cappuccinos for $28.50, and a latte costs $4.75, what is the cost of four lattes and three cappuccinos?
def solve() -> int: latte_price = 4.75 num_lattes = 2 num_cappuccinos = 6 total_price = 28.50 cappuccino_price = (total_price - (num_lattes * latte_price)) / num_cappuccinos four_lattes_price = 4 * latte_price three_cappuccinos_price = 3 * cappuccino_price total_cost ...
If the first cellphone was invented 50 years ago, how many years in the future will it be 15 years before its 100th anniversary of being invented?
def solve() -> int: first_invention_year = 1971 current_year = 2021 anniversary_year = first_invention_year + 100 years_in_future = anniversary_year - current_year - 15 result = years_in_future return result
Paul was playing a video game and wanted to reach the next level. He was told that he needed to collect 450 coins to advance. He already had 250 coins, but needed to collect the remaining coins by completing tasks. How many coins does Paul need to collect to reach the next level?
def solve() -> int: total_coins_needed = 450 coins_already_collected = 250 remaining_coins = total_coins_needed - coins_already_collected result = remaining_coins return result
Student: A box contains 35 apples and each bag can hold 5 apples. How many bags are needed to pack all the apples?
def solve() -> int: num_apples = 35 apples_per_bag = 5 num_bags = num_apples // apples_per_bag result = num_bags return result
Andrew and his friends play a game of Jenga with 35 stacked blocks. They play 3 rounds, where each player removes one block per round. On the fourth round, Andrew's sister goes first and removes a block. Andrew then goes next, removing another block, causing the tower to collapse. How many blocks were in the tower befo...
def solve() -> int: blocks = 35 rounds = 3 blocks_per_round = 1 total_blocks_removed = rounds * blocks_per_round remaining_blocks = blocks - total_blocks_removed remaining_blocks -= 1 remaining_blocks -= 1 result = remaining_blocks return resul...
A bakery sells muffins and cupcakes. Each muffin costs $1.50 and each cupcake costs $2.00. The bakery sold 48 muffins and 36 cupcakes in one day. How much money did the bakery make from selling muffins and cupcakes?
def solve() -> int: muffin_money = 48 * 1.5 cupcake_money = 36 * 2.0 total_money = muffin_money + cupcake_money result = total_money return result
Emily is in the market for a set of free weights. She wants to purchase 7 lb weights, 10 lb weights, and 15 lb weights. How much will her entire set weigh?
def solve() -> int: seven_lb_weight = 7 ten_lb_weight = 10 fifteen_lb_weight = 15 total_weight = (7 * seven_lb_weight) + (10 * ten_lb_weight) + (15 * fifteen_lb_weight) result = total_weight return result
If two-fifths of a gallon of milk cost $1.20, how much would Rachel need to pay to buy one gallon of milk?
def solve() -> int: cost_2fifths = 1.20 cost_1fifth = cost_2fifths / 2 cost_1gallon = cost_1fifth * 5 result = cost_1gallon return result
For every twenty concert tickets a customer buys at Maya's ticket booth, they get one free. If Maya sold $1500 worth of concert tickets and each ticket costs $50, how many free tickets did she give away? Laura and Michael plan to meet at the movie theater. It takes 45 minutes for Laura to get to the theater and it take...
def solve() -> int: tickets_sold = 1500/50 free_tickets = tickets_sold // 20 laura_arrival = 2.5 + 0.75 michael_travel = 2 * 0.75 michael_departure = laura_arrival - michael_travel result = free_tickets return result
Kevin wants to buy a $500 gift card for his friend. If there is a 5% gift card fee, how much will the gift card cost?
def solve() -> int: gift_card_value = 500 gift_card_fee = 0.05 total_cost = gift_card_value + (gift_card_value * gift_card_fee) result = f'<<<{total_cost}>>>' result = total_cost return result
In the city of Damon, there are 180 runners. Half of the city's runners have never run less than 5 kilometers in a single session. How many runners in Damon have run less than 5 kilometers in a single session, at least once?
def solve() -> int: total_runners = 180 runners_never_less_than_5km = total_runners / 2 runners_less_than_5km = total_runners - runners_never_less_than_5km result = runners_less_than_5km return result
In a spelling bee, Amy spelled 18 words correctly and got 2 points for each word. Ben spelled 25 percent fewer words correctly than Amy and got 3 points for each word. Cam spelled twice as many words correctly as Ben and got 1 point for each word. Compared to Amy, how many more or fewer points did Cam get?
def solve() -> int: ben_words = 18 * 0.75 cam_words = ben_words * 2 amy_points = 18 * 2 ben_points = ben_words * 3 cam_points = cam_words * 1 difference = cam_points - amy_points result = difference return result
Ed can read a book in 36 minutes while Mitchell can read the same book in 24 minutes. How long will it take both of them to read 6 books?
def solve() -> int: minutes_per_book_ed = 36 minutes_per_book_mitchell = 24 total_books = 6 time_for_both = total_books * (minutes_per_book_ed + minutes_per_book_mitchell) result = time_for_both return result
A company produces 50 units of product A per day and sells each unit for $10. What is the company's daily revenue from product A?
def solve() -> int: units = 50 price_per_unit = 10 daily_revenue = units * price_per_unit result = daily_revenue return result
Student: If Shantanu has 4 fewer letters than Kaleem and the two names together have 14 letters, how many letters are in Kaleem's name?
def solve() -> int: shantanu_letters = 0 kaleem_letters = 0 total_letters = 14 kaleem_letters = total_letters - shantanu_letters shantanu_letters = kaleem_letters - 4 result = kaleem_letters return result
Sarah doesn't eat orange Skittles due to an allergy and takes them out from each pack. In her first pack, she removes 8 orange Skittles. In the second, she removes 11. In the third and fourth pack, she takes out 4 orange Skittles each. In her fifth pack, she only takes out 1 orange Skittle. What is the average number o...
def solve() -> int: pack1 = 8 pack2 = 11 pack3 = 4 pack4 = 4 pack5 = 1 total_oranges = pack1 + pack2 + pack3 + pack4 + pack5 num_packs = 5 average_oranges = total_oranges / num_packs result = average_oranges return result
Anna reads 15 pages of a novel every day. In 3 months, she has read half of the novel. How many pages are there in the novel?
def solve() -> int: pages_per_day = 15 months = 3 days = months * 30 pages_read = pages_per_day * days total_pages = pages_read * 2 result = total_pages return result
A town has a water tower that holds 180,000 liters of water. On Monday, the town used 30,000L of water. On Tuesday, the town used 60,000L of water. If 0.8L costs 8 cents, how much money was spent on Tuesday?
def solve() -> int: liters = 80000 cost_per_liter = 0.08 total_cost = liters * cost_per_liter result = total_cost return result
Student: Veronica can only buy cherries in packs of 2 pounds. How many packs of cherries does she need to buy to make 5 pies?
def solve() -> int: pounds_needed = 5 * 2 packs_needed = pounds_needed / 2 packs_needed = round(packs_needed) result = packs_needed return result
Michael is competing in a hotdog eating contest. Each hotdog is 6 inches in length. Last year's winner ate 72 inches worth of hotdogs. How many hotdogs does Michael have to eat to beat last year's record?
def solve() -> int: hotdog_length = 6 record_length = 72 hotdogs_to_beat_record = record_length / hotdog_length result = hotdogs_to_beat_record return result
A local artist paints on canvas with a brush. Each canvas takes him 8 hours to paint. His fee for painting the canvas increases by 50% if he uses a bigger brush instead. How many hours now does it take him to finish a canvas?
def solve() -> int: time_increase_percent = 50 time_increase = 8 * time_increase_percent/100 new_time = 8 + time_increase result = new_time return result
A school has a total of 600 students. If 40% of the students are girls and 60% boys, how many girls are there in the school?
def solve() -> int: total_students = 600 percentage_girls = 40 percentage_boys = 100 - percentage_girls girls = total_students * percentage_girls / 100 result = girls return result
A store has a sale where all prices are discounted by 15%. If an item was originally priced at $80, what is the new price?
def solve() -> int: original_price = 80 discount_percent = 15 discount_amount = original_price * discount_percent / 100 new_price = original_price - discount_amount result = new_price return result
A group of 12 students are going on a field trip to the museum. The museum charges $5 for each student and $10 for each adult. The group has one teacher and two parent volunteers. How much money does the group need to pay for the entrance fee?
def solve() -> int: students = 12 adults = 1 + 2 student_fee = students * 5 adult_fee = adults * 10 total_fee = student_fee + adult_fee result = total_fee return result
A coffee shop is tracking its sales for the week. They sold 120 cups of coffee at $2.5 each, 80 cups of tea at $2 each, and 60 pastries at $1.5 each. In dollars, how much money did the coffee shop make throughout the week?
def solve() -> int: coffee = 120 coffee_price = 2.5 tea = 80 tea_price = 2 pastry = 60 pastry_price = 1.5 coffee_revenue = coffee * coffee_price tea_revenue = tea * tea_price pastry_revenue = pastry * pastry_price total_revenue = coffee_revenue + tea_revenue + pastry_revenue ...
In a forest, there are 65 elks, 30 moose, and 55 deer. What percentage of animals is not moose?
def solve() -> int: elks = 65 moose = 30 deer = 55 total_animals = elks + moose + deer percentage_of_non_moose = ((elks + deer) / total_animals) * 100 result = percentage_of_non_moose return result
A store sells oranges for 75 cents each. How much does it cost to buy a dozen oranges?
def solve() -> int: orange_cost = 0.75 dozen_cost = 12 * orange_cost result = dozen_cost return result
``` Jessica has 60 pencils. 5 more pencils than a third of the pencils are pink, and 10 less than half of the remaining pencils are green. How many pencils are green?
def solve() -> int: pencils = 60 pink = (pencils / 3) + 5 leftover = pencils - pink green = (leftover / 2) - 10 result = green return result
A forest covers an area of 120,000 square kilometers. Calculate how many square meters of land the forest covers.
def solve() -> int: sq_km_area = 120000 sq_m_area = sq_km_area * 10 ** 6 result = 1200000000 return result
Student: In a store, there are some apples and pears. There are 5 times as many pears as apples. If there are 35 apples, how many pears are there?
def solve() -> int: apples = 35 pears = apples * 5 result = pears return result
A library has 500 books in the fiction section. One flood destroys one-third of the books. After being replenished with new books, there are 320 books left. How many more books were in the section before the flood than after?
def solve() -> int: fiction_books_before_flood = 500 fraction_destroyed = 1/3 fiction_books_after_flood = fiction_books_before_flood * (1 - fraction_destroyed) fiction_books_replenished = fiction_books_after_flood - 320 books_difference = fiction_books_before_flood - fiction_books_after_flood ...
A bag of popcorn costs $1.50 and a bottle of soda costs $2.50. If Emily spent a total of $18 purchasing 8 bags of popcorn and 6 bottles of soda, how many more bags of popcorn than bottles of soda did she purchase?
def solve() -> int: popcorn_cost = 1.5 soda_cost = 2.5 total_cost = 18 popcorn_qty = 8 soda_qty = 6 difference = popcorn_qty - soda_qty price_total = popcorn_qty * popcorn_cost + soda_qty * soda_cost result = difference return result
A recipe requires 2 eggs to make 12 pancakes. How many eggs are needed to make 45 pancakes?
def solve() -> int: eggs_for_12_pancakes = 2 num_pancakes = 45 result =... return result
Ryan has $800 for his laptop repair expenses. He spends $200 on repairing the laptop. His brother gives him $100 for the birthday gift. Ryan then spends $500 on purchasing a new printer. How much money is Ryan remaining with now?
def solve() -> int: remaining_money = 800 repair_cost = 200 gift_money = 100 printer_cost = 500 remaining_money -= repair_cost remaining_money += gift_money remaining_money -= printer_cost result = remaining_money return result
A wall has a height of 3 meters and a length of 5 meters. How many tiles measuring 20cm x 20cm are needed to cover the wall?
def solve() -> int: wall_height = 3 wall_length = 5 tile_width = 0.2 tile_area = tile_width ** 2 wall_area = wall_height * wall_length tiles_needed = wall_area / tile_area result = tiles_needed return result
In a year-long art course, a student can miss up to 9 classes without affecting their grade. If Victor has missed 5 classes already, how many more can he miss and still get a passing grade?
def solve() -> int: total_classes = 365 allowed_misses = 9 missed_classes = 5 remaining_classes = total_classes - missed_classes remaining_allowed_misses = allowed_misses - missed_classes passing_grade = remaining_classes - remaining_allowed_misses result = passing_grade return...
A box contains 96 chocolates. If 1/6 of the candies are eaten and another 1/8 of them are expired, how many chocolates can be eaten now?
def solve() -> int: chocolates = 96 eaten_chocolates = chocolates // 6 chocolates_left = chocolates - eaten_chocolates expired_chocolates = chocolates_left // 8 chocolates_left -= expired_chocolates result = chocolates_left return result
Mary has 27 pencils. She wants to put them in equal groups with each group having 3 pencils. How many groups can she make?
def solve() -> int: pencils = 27 per_group = 3 num_groups = pencils // per_group result = num_groups return result
Jenny had $1500 in her savings account, but then she withdrew $200 for a new bike. After that, she made a deposit of 25% of her current savings, plus an additional $250. How much is in her account now?
def solve() -> int: account_balance = 1500 withdrawal_amount = 200 new_balance = account_balance - withdrawal_amount new_deposit_percent = new_balance *.25 additional_deposit = 250 final_balance = new_balance + new_deposit_percent + additional_deposit result = final_balan...
Possible math questions and python programs are: Anita wants to make mini pizzas for her friends. She has 12 slices of cheese, 24 pepperoni slices, and 6 tortillas. She needs 2 slices of cheese and 4 pepperoni slices for each mini pizza. How many mini pizzas can she make and how many ingredients will she have left over...
def solve() -> int: cheese_pizzas = 12 // 2 pepperoni_pizzas = 24 // 4 tortilla_pizzas = 6 mini_pizzas = min(cheese_pizzas, pepperoni_pizzas, tortilla_pizzas) cheese_left = 12 - 2 * mini_pizzas pepperoni_left = 24 - 4 * mini_pizzas tortilla_left = 6 - mini_pizzas result =...
Jason needs to buy 3 notebooks and 5 pencils. Notebooks cost $4 each and pencils cost $2 each. How much money will he need?
def solve() -> int: numNotebooks = 3 numPencils = 5 priceNotebook = 4 pricePencil = 2 totalCost = priceNotebook * numNotebooks + pricePencil * numPencils result = totalCost return result
Will, Xara, and Yara rode bikes. Will rode 20 miles, but Xara rode 8 more miles than Will. If Yara rode 5 less miles than half the number of miles Xara rode, how many miles did Yara ride?
def solve() -> int: will = 20 xara = will + 8 yara = xara / 2 - 5 result = yara return result
The sum of Alvin's and his wife's age is twice the age of their son. If their son is now 12 years old, and Alvin is 40 years old, how old is his wife?
def solve() -> int: son_age = 12 alvin_age = 40 wife_age = (son_age * 2) - alvin_age result = wife_age return result
A bag has 5 red balls, 3 blue balls and 2 white balls. If one ball is picked randomly, what is the probability that it will be a red ball?
def solve() -> int: red_balls = 5 total_balls = 10 probability_of_red = red_balls / total_balls result = probability_of_red return result
A music store owner raises the price of a record he is selling by $6 every time someone new buys it. Six people buy records and the price goes from $10 to $46 before all of the records are sold. How many times did each person buy a record?
def solve() -> int: price_increase = 6 initial_price = 10 final_price = 46 total_increase = final_price - initial_price num_of_records_sold = total_increase / price_increase result = num_of_records_sold return result
A store is offering a 20% discount on all items. If an item originally costs $100, what is the final price of the item?
def solve() -> int: original_price = 100 discount = 0.2 final_price = original_price - (original_price * discount) result = final_price return result
Ben is making cookies for his friends. He has enough ingredients to make 36 cookies. He wants to make 3 batches of cookies, each with a different flavor. How many cookies can he make for each flavor if he wants to distribute them equally among the batches?
def solve() -> int: total_cookies = 36 batches = 3 cookies_per_batch = total_cookies // batches result = cookies_per_batch return result
A man traveled for 3 hours at 60 mph and then traveled for 4 more hours at 80 mph. What is the total distance traveled by the man?
def solve() -> int: speed_1 = 60 time_1 = 3 distance_1 = speed_1 * time_1 speed_2 = 80 time_2 = 4 distance_2 = speed_2 * time_2 total_distance = distance_1 + distance_2 result = total_distance return result
Two years ago, Rachel was three times as old as John. If John will be 21 in three years, how old is Rachel now?
def solve() -> int: john_age_two_years_ago = 21 - 3 rachel_age_two_years_ago = 3 * john_age_two_years_ago rachel_age_now = rachel_age_two_years_ago + 2 result = rachel_age_now return result
Student: If a restaurant has 30 tables and each table has 4 chairs, how many total chairs does the restaurant have?
def solve() -> int: tables = 30 chairs_per_table = 4 total_chairs = tables * chairs_per_table result = total_chairs return result
A delivery company has 15 trucks that can carry 40 packages each, and 20 vans that can carry 30 packages each. How many packages can be delivered in a day when all vehicles are utilized?
def solve() -> int: trucks = 15 trucks_capacity = 40 vans = 20 vans_capacity = 30 total_trucks_capacity = trucks * trucks_capacity total_vans_capacity = vans * vans_capacity total_packages_delivered = total_trucks_capacity + total_vans_capacity result = total_packages_deli...
Julia purchases a bottle of wine. Each glass is 3 ounces. If the bottle is 0.8 ounces less than a half-gallon, how many glasses can she have before it runs out?
def solve() -> int: bottle_size = 0.5 * 128 glass_size = 3 bottle_size -= 0.8 glasses = bottle_size // glass_size result = glasses return result
The width of a rectangle is half its length, and the perimeter is 24. What is the length of the rectangle?
def solve() -> int: perimeter = 24 width = perimeter/6 length = 2*width result = length return result
A toy store sells toys for $10 each. If they buy the toys for $5 each and sell 100 of them, what is their profit margin?
def solve() -> int: toy_buy_cost = 5 toy_sell_price = 10 num_toys = 100 revenue = num_toys * toy_sell_price total_cost = num_toys * toy_buy_cost profit = revenue - total_cost profit_margin = profit / revenue result = profit_margin return result
If 40% of a group of 120 individuals like coffee, and out of those that like it, 70% drink it with sugar, how many people in the group drink coffee with sugar?
def solve() -> int: coffee_likers = 120 * 0.4 coffee_sugar = coffee_likers * 0.7 result = coffee_sugar return result
Student: A bag contains 6 red balls, 8 blue balls, and 4 green balls. Three balls are drawn at random without replacement. What is the probability that all three balls will be red?
def solve() -> int: red_balls = 6 blue_balls = 8 green_balls = 4 total_balls = red_balls + blue_balls + green_balls prob_3_red_balls = red_balls / total_balls * (red_balls - 1) / (total_balls - 1) * (red_balls - 2) / (total_balls - 2) result = prob_3_red_balls return result
ally needs to do her laundry. It takes her 5 minutes to load the washing machine, 60 minutes for a full load to wash, and another 60 minutes to dry. If she has 3 hours and 15 minutes of free time available, what time will it be when she finishes drying her laundry?
def solve() -> int: time_load = 5 time_wash = 60 time_dry = 60 free_time = 195 total_time = time_load + time_wash + time_dry time_left = free_time - total_time finish_time = "3:" + str(15 + total_time) result = finish_time return result
Emma has 40 apples. She gives 5 apples to each of her 4 friends and keeps the rest for herself. How many apples does Emma have?
def solve() -> int: apples_friends = 5 * 4 apples_emma = 40 - apples_friends result = apples_emma return result
Student: There are 32 boxes. The weight of each box is 4 kilograms. How many kilograms of boxes are there?
def solve() -> int: number_of_boxes = 32 weight_of_each_box = 4 total_weight = number_of_boxes * weight_of_each_box result = total_weight return result
A restaurant has 80 tables that need to be cleaned. It takes 10 minutes to clean each table. How many hours will it take to clean all the tables if they have 5 cleaners working 6 hours a day?
def solve() -> int: num_tables = 80 time_per_table = 10 cleaners = 5 hours_per_day = 6 total_time = num_tables * time_per_table total_time /= 60 total_time /= cleaners total_days = total_time / hours_per_day result = total_days * 24 return result
To celebrate her birthday, Carmen decided to buy herself a designer handbag that cost $350. She saved $5 a week for a year to be able to afford it. How many weeks are in a year?
def solve() -> int: total_savings = 350 savings_per_week = 5 weeks_in_year = total_savings / savings_per_week result = weeks_in_year return result
A hotel is organizing its room types. There are 12 standard rooms in a row and behind each of these are 5 deluxe rooms. There are three times as many suites as deluxe rooms scattered around the hotel. The standard rooms hold 2 guests, the deluxe rooms hold 4 guests and the suites hold 6 guests. If these are the only ro...
def solve() -> int: standard_rooms = 12 deluxe_rooms = standard_rooms * 5 suites = deluxe_rooms * 3 standard_capacity = standard_rooms * 2 deluxe_capacity = deluxe_rooms * 4 suite_capacity = suites * 6 total_capacity = standard_capacity + deluxe_capacity + suite_capacity r...
A recipe requires 3/4 cup of flour but you only have a 1/3 measuring cup. How many scoops do you need to make up the total amount of flour?
def solve() -> int: required_amount = 0.75 scoop_size = 1/3 num_scoops = required_amount / scoop_size result = num_scoops return result
If there are 15 pizzas, each with eight slices, how many total slices of pizza are there?
def solve() -> int: pizzas = 15 slices_per_pizza = 8 total_slices = pizzas * slices_per_pizza result = total_slices return result
Cindy buys a pack of gum for 75 cents every day for 15 days. She pays with a dollar bill and saves the change in a jar. David buys a chocolate bar for 60 cents every 2 days for 30 days. He pays with a dollar bill and saves the change in a jar. Eddie buys a soda for 80 cents every 3 days for 27 days. He pays with a doll...
def solve() -> int: cindy = (100 - 75) * 15 david = (100 - 60) * (30 / 2) eddie = (100 - 80) * (27 / 3) result = cindy + david + eddie return result
George goes running 4 km every day for 2 weeks. How many kilometers does he run in total?
def solve() -> int: number_weeks = 2 distance_per_day = 4 total_distance = number_weeks * distance_per_day result = total_distance return result
A number is increased by 20% and then decreased by 25%. If the result is 300, what was the original number?
def solve() -> int: result = 300 percent_increase = 20 percent_decrease = 25 multiplier_increase = 1 + (percent_increase / 100) multiplier_decrease = 1 - (percent_decrease / 100) original_number = result / multiplier_decrease / multiplier_increase result = round(original_number) return r...
Student: If a pair of shoes that was originally worth $120 has a 20% discount, what would be the new cost of the shoes?
def solve() -> int: original_cost = 120 discount = original_cost * 0.2 new_cost = original_cost - discount result = new_cost return result
Possible new questions and python programs: Jeremy joined a fundraising campaign that rewarded him $10.00 for every donation he collected. He also received a bonus of $50.00 if he collected more than 20 donations in a week. He collected 15 donations on Monday, 8 donations on Wednesday, and 12 donations on Friday. How m...
def solve() -> int: donations = 0 money = 0 donations = donations + 15 money = money + 15 * 10 donations = donations + 8 money = money + 8 * 10 donations = donations + 12 money = money + 12 * 10 if donations > 20: money = money + 50 result = money return...
Tina's garden had 12 rows of carrots, each with 15 plants. Tim's garden had 10 rows of carrots, each with 18 plants, and Tom's garden had 8 rows of carrots, each with 21 plants. If Tina, Tim, and Tom each harvested half of their carrot plants and sold them at the market for $0.25 per plant, how much more money, in doll...
def solve() -> int: rows_tina = 12 plants_tina = 15 rows_tim = 10 plants_tim = 18 rows_tom = 8 plants_tom = 21 harvested_tina = (rows_tina * plants_tina) / 2 harvested_tim = (rows_tim * plants_tim) / 2 harvested_tom = (rows_tom * plants_tom) / 2 price = 0.25 revenue...
Student: Sam has $60. He wants to buy a $25 shirt and a $18 pair of jeans. How much money will he have left?
def solve() -> int: shirt_price = 25 jeans_price = 18 initial_money = 60 total_price = shirt_price + jeans_price money_left = initial_money - total_price result = money_left return result
A store has a sale where the price of a $10 item is reduced by 20%, what is the new price of the item?
def solve() -> int: discounted_price = 10 * 0.8 result = discounted_price return result
If a TV costs 400 dollars with a discount of 10%, what is the discounted price?
def solve() -> int: discount_percentage = 10 original_price = 400 discounted_price = original_price - (discount_percentage/100)*original_price result = discounted_price return result
Francis has a jar with 30 marbles, half of which are blue and the other half are red. How many red marbles does Francis have in the jar?
def solve() -> int: jar_marble = 30 blue_marble = jar_marble // 2 red_marble = jar_marble - blue_marble result = red_marble return result
``` Alex has a monthly car payment of $200. If he makes a one-time payment of $2000, how many months will he save in paying off the car loan?
def solve() -> int: monthly_payment = 200 one_time_payment = 2000 car_cost = 5000 num_months_without_payment = car_cost / monthly_payment num_month_saved = (car_cost - one_time_payment) / monthly_payment result = num_months_without_payment - num_month_saved return result
John tosses 12 nickels into the wishing fountain. Emily flips 3 quarters into the fountain. Daniel throws in 9 dimes. Mariah then drops 80 pennies in. If Emily dips his hand into the fountain and pulls out a quarter, how much money, in cents, did they put into the fountain?
def solve() -> int: nickels = 12 quarters = 3 dimes = 9 pennies = 80 total_money = (nickels * 5) + (quarters * 25) + (dimes * 10) + (pennies * 1) total_money -= 25 result = total_money return result
Student: Mary's car travelled 276 km from city A to city B. How many meters did Mary travel?
def solve() -> int: km = 276 m_per_km = 1000 m = km * m_per_km result = m return result
A company has 200 employees and they want to give a 500 dollar bonus to each employee. If the company has 25,000 dollars to spend on bonuses, how much money will be left over?
def solve() -> int: employees = 200 bonus = 500 total_bonus = employees * bonus remaining_money = 25000 - total_bonus result = remaining_money return result
Hugo dug three ponds. He put twice as many fishes in the first pond as in the second pond, and put four times as many fishes in the third pond as in the second pond. If there were 48 fishes in total, how many fishes were in the third pond?
def solve() -> int: total_fishes = 48 fishes_in_second_pond = total_fishes/2/4 fishes_in_third_pond = fishes_in_second_pond * 4 result = fishes_in_third_pond return result
Student: Leila wants to bake a cake for her friend's birthday. She needs 3 cups of flour, 2 cups of sugar, 4 eggs, and 1/2 cup of oil. She has 10 cups of flour, 6 cups of sugar, 12 eggs, and 2 cups of oil in her pantry. How many cakes can she bake with the ingredients she has?
def solve() -> int: flour = 10 sugar = 6 eggs = 12 oil = 2 flour_needed = 3 sugar_needed = 2 eggs_needed = 4 oil_needed = 0.5 cakes = min(flour // flour_needed, sugar // sugar_needed, eggs // eggs_needed, oil // oil_needed) result = cakes return result
Olivia has 50 stickers. She gives 10 stickers to her brother and then receives 20 more from her friend. If she puts 4 stickers on each of her belongings, how many stickers does Olivia have left?
def solve() -> int: stickers = 50 stickers -= 10 stickers += 20 stickers_left = stickers stickers_left %= 4 result = stickers_left return result
Student: A company purchased 50 items. The company paid $20 for each item in the first 10 items, for each of the next 20 items, the company paid $25, and for the remaining 20 items, the company paid $30. What is the total cost of all 50 items?
def solve() -> int: num_items = 50 price_1 = 20 price_2 = 25 price_3 = 30 cost_1 = num_items * price_1 cost_2 = 20 * price_2 cost_3 = 20 * price_3 result = cost_1 + cost_2 + cost_3 return result
A family of four went to a restaurant for dinner. The parents ordered two meals for $15 each and the children ordered two meals for $8 each. They also shared a dessert for $6 and left a 15% tip. How much was the total bill?
def solve() -> int: subtotal = (15 * 2) + (8 * 2) + 6 tip = subtotal * 0.15 total = subtotal + tip result = total return result
The distance between town A and town B is 120 miles. Juan drove from A to B at a speed of 40 miles per hour, how long did it take him to reach town B?
def solve() -> int: distance = 120 speed = 40 time = distance/speed result = time return result
Student: In a pizza box, there are 24 slices of pizza, 15 slices of chicken wings, and 18 pieces of garlic bread. Joy and Anne shared the food, so Joy got twice as much as Anne. How many pieces of food did Anne get?
def solve() -> int: pizza_slices = 24 chicken_wings = 15 garlic_bread = 18 joy_food = 2 * pizza_slices + 2 * chicken_wings + 2 * garlic_bread anne_food = joy_food / 2 result = anne_food return result
The length of a rectangle is twice its width. The perimeter of the rectangle is 24. What are the dimensions of the rectangle?
def solve() -> int: width = 3 length = width * 2 result = width, length return result
7. Joe and Ashley bought 2liters of soda for the class picnic. After pouring the soda in individual glasses, there are 120 mL of soda left. How much soda did Joe and Ashley pour into the glasses?
def solve() -> int: total_soda = 2000 leftover_soda = 120 soda_poured = total_soda - leftover_soda result = soda_poured return result
A rectangular pool measures 25 feet by 12 feet. If the depth of the pool is 8 feet, how many cubic feet of water will it hold?
def solve() -> int: length = 25 width = 12 depth = 8 cubic_feet = length * width * depth result = cubic_feet return result
A train covers 240 miles in 4 hours and a car covers the same distance in 6 hours. How long will it take for the train to overtake the car if the train starts 30 minutes after the car?
def solve() -> int: time_to_meet = 1.2 result = round(time_to_meet, 2) return result
Student: There are 30 apples in a basket. 20% of them are rotten. How many apples are NOT rotten?
def solve() -> int: num_apples = 30 percent_rotten = 20 num_rotten = num_apples * (percent_rotten/100) num_not_rotten = num_apples - num_rotten result = num_not_rotten return result
Student: Mary bought 80 marbles. She gave away 10 of them and then sold 40 of them for twice the price she bought them for. If Mary had bought the marbles for 25 cents each, how much money did she make?
def solve() -> int: marbles_bought = 80 price_per_marble = 0.25 marbles_given_away = 10 marbles_sold = 40 price_per_marble_sold = price_per_marble * 2 total_money_made = marbles_sold * price_per_marble_sold result = total_money_made return result
A box contains 540 LEGO bricks. 30% of the bricks are red. How many red bricks are there in the box?
def solve() -> int: total_bricks = 540 percentage_red = 30 red_bricks = (total_bricks * percentage_red) / 100 result = red_bricks return result
A square has an area of 36 square meters. What is the length of each side?
def solve() -> int: area = 36 side = area ** 0.5 result = side return result
-------------- Possible math questions and programs: Jennie swims 15 laps every day in the pool. Each lap is 50 meters long. How many kilometers does she swim in 6 weeks?
def solve() -> int: laps_per_day = 15 lap_length = 50 days_per_week = 7 weeks = 6 total_laps = laps_per_day * days_per_week * weeks total_meters = total_laps * lap_length total_kilometers = total_meters / 1000 result = total_kilometers return result
A football stadium has a total of 50,000 seats. 30% of the seats are empty and 2,000 tickets are sold at the gate. What's the total number of people at the stadium?
def solve() -> int: total_seats = 50000 empty_seats = total_seats * 0.3 tickets_sold = 2000 occupied_seats = int(total_seats - empty_seats + tickets_sold) result = occupied_seats return result
Alex has read 5 articles, with an average reading time of 10 minutes per article. He has spent 8 minutes on a 6th article. How much longer can he spend reading the 6th article to ensure that his average reading time per article doesn't exceed 12 minutes? Kate buys a new car, but it needs three major repairs, which cost...
def solve() -> int: time_first_five = 5 * 10 total_time = time_first_five + 8 total_articles = 6 max_time = (total_articles * 12) - total_time result = max_time return result
Lucy is wrapping a gift box. The gift box measures 12 inches by 10 inches by 6 inches. If she wants to wrap the entire gift box, what is the total area of the wrapping paper she needs to use?
def solve() -> int: length = 12 width = 10 height = 6 left_side_area = height * width right_side_area = height * width front_side_area = height * length back_side_area = height * length top_area = length * width bottom_area = length * width total_wrapping_paper = left_s...
Student: A train traveled at 50 mph for the first 3 hours, then slowed to 30 mph for the next 2 hours. What was the train's average speed over the entire trip?
def solve() -> int: speed_1 = 50 time_1 = 3 speed_2 = 30 time_2 = 2 distance_1 = speed_1 * time_1 distance_2 = speed_2 * time_2 total_distance = distance_1 + distance_2 total_time = time_1 + time_2 average_speed = total_distance / total_time result = average_speed return...
Student: A car is traveling at a speed of 60 km/h. How many meters does it travel in 2 minutes?
def solve() -> int: speed = 60 speed_m_s = speed * 1000 / 3600 distance = speed_m_s * 2 * 60 result = distance return result
A recipe calls for 3 1/2 cups of flour to make 12 muffins. How many cups of flour are needed to make 18 muffins?
def solve() -> int: flour_per_muffin = 3.5 / 12 flour_for_18 = flour_per_muffin * 18 result = flour_for_18 return result