question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Mark's suitcase weighs 50 pounds. It gained 15% of its starting weight. If he sells it for $2.50 per pound, how much more is it worth after the weight gain?
def solve() -> int: suitcase_weight = 50 weight_gain_percentage = 15 weight_gain = suitcase_weight * weight_gain_percentage / 100 new_weight = suitcase_weight + weight_gain price_per_pound = 2.50 worth_before_gain = suitcase_weight * price_per_pound worth_after_gain = new_weight * price_per_...
marty Shark knows five times as many facts as Silly Shark. If Silly Shark knows forty-eight facts, how many facts does Smarty Shark know more than Silly Shark?
def solve() -> int: silly_facts = 48 smarty_ratio = 5 smarty_facts = silly_facts * smarty_ratio facts_diff = smarty_facts - silly_facts result = facts_diff return result
Ryan works as a painter. He charges $25 per hour for his labor and $10 for each gallon of paint he uses. He painted a room that took him 4 hours and used 3 gallons of paint. How much did he charge for the job, in dollars?
def solve() -> int: labor_cost = 4 * 25 paint_cost = 3 * 10 total_cost = labor_cost + paint_cost result = total_cost return result
If the perimeter of a square is 36 cm, what is the length of one side of the square?
def solve() -> int: perimeter = 36 side_length = perimeter / 4 result = side_length return result
Student: A classroom has 25 desks, and each desk has 4 chairs. If 50 chairs are broken and replaced with new ones, how many chairs are now in the classroom?
def solve() -> int: desks = 25 chairs_per_desk = 4 broken_chairs = 50 total_chairs = desks * chairs_per_desk new_chairs = total_chairs - broken_chairs + broken_chairs result = new_chairs return result
ve has 137 cookies. He eats 10 of them and gives away 40. How many cookies does he have left?
def solve() -> int: total_cookies = 137 cookies_eaten = 10 cookies_given_away = 40 result = total_cookies - cookies_eaten - cookies_given_away return result
Joe has 480 marbles that he wants to distribute evenly into bags that can hold 20 marbles each. If each bag costs $0.20 to make, how much will be the total cost of the bags?
def solve() -> int: num_marbles = 480 bag_capacity = 20 cost_per_bag = 0.20 num_bags = num_marbles // bag_capacity total_cost = num_bags * cost_per_bag result = total_cost return result
``` Alex wants to buy a bike that costs $150. If he has 250 quarters, how many more quarters does he need to buy the bike?
def solve() -> int: cost_bike = 150 num_quarters = 250 total_dollars = num_quarters * 0.25 remaining_cost = cost_bike - total_dollars num_quarters_needed = round(remaining_cost / 0.25) result = num_quarters_needed return result
A barista makes iced coffee for her customers. Unfortunately, one-tenth of the time, she spills the coffee on herself. However, half of the time, a customer orders an extra large size and she has to make two cups of coffee instead of one. If the barista makes 300 iced coffees, how many times did she spill the coffee on...
def solve() -> int: total_coffees = 300 spill_probability = 1/10 extra_large_probability = 1/2 spill_count = total_coffees * spill_probability extra_large_count = total_coffees * extra_large_probability total_spills = spill_count + extra_large_count result = total_spills ...
Sarah has a yearly bonus that equals 12% of her income. In the previous year, her salary was $55,000, and she received a $6,600 bonus. If this year, she makes $65,000, how much will Sarah earn with her bonus?
def solve() -> int: income_previous_year = 55000 bonus_previous_year = 6600 bonus_percentage = 0.12 bonus_this_year = (bonus_previous_year / income_previous_year) * 65000 result = bonus_this_year return result
Student: Vanessa has a bag of 30 apples. She buys twice that number and 18 extra apples. How many apples does Vanessa have in total?
def solve() -> int: apples_original = 30 apples_bought = apples_original * 2 + 18 apples_total = apples_original + apples_bought result = apples_total return result
Student: If it takes Jake 4 hours to mow a lawn and it takes Alyssa twice the time it takes Jake, how long does it take Alyssa to mow the same lawn?
def solve() -> int: time_jake = 4 time_alyssa = time_jake * 2 result = time_alyssa return result
A bag contains 5 red balls, 6 blue balls and 4 green balls. If a ball is selected at random, what is the probability that it is blue?
def solve() -> int: blue_balls = 6 total_balls = 5 + 6 + 4 probability = blue_balls / total_balls result = probability return result
Student: Jacob is 9 years younger than Samantha. Samantha is thrice as old as Lucy. If Lucy is 15, how old is Jacob?
def solve() -> int: lucy_age = 15 samantha_age = lucy_age * 3 jacob_age = samantha_age - 9 result = jacob_age return result
Maya can bake 24 muffins in 30 minutes. She needs to bake 120 muffins for a school fundraiser. How many batches of muffins does she need to bake and how long will it take her to bake them all?
def solve() -> int: muffins_per_batch = 24 batches_needed = 120 / muffins_per_batch time_per_batch = 30 total_time = batches_needed * time_per_batch result = (batches_needed, total_time) return result
A landscaper is building a retaining wall for a garden. The length of the wall is 30 feet and it will stand 2.5 feet tall. If the width of the wall is 1 foot, how many cubic feet of material will he need?
def solve() -> int: length = 30 height = 2.5 width = 1 volume = length * height * width result = volume return result
Student: 6. Hunter purchased 8 items, each with a 15% discount. If the total price of the items before the discount was $195, what was the price after the discount?
def solve() -> int: items = 8 discount = 0.15 price_before_discount = 195 price_after_discount = price_before_discount * (1 - discount) result = price_after_discount return result
Cindy went out for lunch with her friends and they ordered 3 pizzas and 4 salads. If the total cost of the pizzas was $27 and the total cost of the salads was $18, what is the average cost of a pizza and a salad?
def solve() -> int: pizzas_cost = 27 salads_cost = 18 num_of_pizzas = 3 num_of_salads = 4 total_cost = pizzas_cost + salads_cost average_cost = total_cost / (num_of_pizzas + num_of_salads) result = average_cost return result
Lucas and Emily went to a fair. Lucas won four stuffed animals playing games, while Emily won six goldfish at the ring toss. They both got their faces painted three times. If a stuffed animal costs $5, a goldfish costs $2, and a face painting session costs $8, how much money did they spend in total?
def solve() -> int: stuffed_animals = 4 goldfish = 6 face_painting = 3 stuffed_animals_cost = stuffed_animals * 5 goldfish_cost = goldfish * 2 face_painting_cost = face_painting * 8 total_cost = stuffed_animals_cost + goldfish_cost + face_painting_cost result = t...
Student: Jack bought 10 packages of paper plates, each containing 10 plates. How many paper plates has Jack bought?
def solve() -> int: package_num = 10 plate_num = 10 total_plates = package_num * plate_num result = total_plates return result
Sarah's pet rabbit has a tail that's 40% shorter than its body. Its head takes up 1/10 the length of its body. If the rabbit is 24 inches long, how long is its tail?
def solve() -> int: body_length = 24 tail_length = body_length * 0.4 head_length = body_length * 0.1 total_length = body_length + tail_length + head_length tail_length = total_length * 0.4 result = tail_length return result
A shirt is discounted by 12% from its original price of $85. How much will the shirt cost after the discount?
def solve() -> int: discount_percent = 12 original_price = 85 discounted_price = original_price-(original_price*discount_percent/100) result = discounted_price return result
In a class of 60 students, three-fifths of them like to play soccer while the rest prefer playing basketball. Out of the students who like playing soccer, half of them are boys. If 18 girls prefer playing basketball, how many boys like playing soccer?
def solve() -> int: total_students = 60 soccer_players = total_students * 3/5 basketball_players = total_students - soccer_players soccer_boys = soccer_players * 1/2 soccer_girls = soccer_players - soccer_boys basketball_girls = 18 basketball_boys = basketball_players - basketball_girls ...
Student: John spent 1/3 of his money to buy a tablet, and 2/5 of the remaining money to buy a printer. If he had $600 left in his wallet, how much money did he have at first?
def solve() -> int: money_left = 600 money_at_first = money_left / (1/3 + 2/5) result = money_at_first return result
Olivia went to the stationery store and bought 20 pens and 35 notebooks. To take notes in class, Olivia needs 2 pens and 1 notebook. After taking as many notes as she can with the items she bought, how many pens would she have left over?
def solve() -> int: pens_bought = 20 notebooks_bought = 35 pens_needed_per_note = 2 notebooks_needed_per_note = 1 total_pens_needed = pens_needed_per_note * notebooks_bought total_notebooks_needed = notebooks_needed_per_note * pens_bought if total_pens_needed < pens_bought: ...
A car is being sold for $25,000 with a 10% discount. However, the seller later offers an additional discount of $2,500 to the first buyer who comes to see the car. What is the final sale price including both discounts?
def solve() -> int: original_price = 25000 discount_percentage = 0.1 discount = original_price * discount_percentage price_after_first_discount = original_price - discount price_after_second_discount = price_after_first_discount - 2500 result = price_after_second_discount return result
Karen has 30 candy bars. She gives two fifths of her candy bars to her neighbor. Then she eats one fourth of the remaining candy bars. How many candy bars does Karen have left?
def solve() -> int: karen_candybars = 30 neighbor_candybars = karen_candybars * 2 // 5 karen_new_candybars = karen_candybars - neighbor_candybars eaten_candybars = karen_new_candybars // 4 karen_remaining_candybars = karen_new_candybars - eaten_candybars result = karen_remaining_candybars r...
Peter walks at 5 miles per hour. His friend Jill walks at 4 miles per hour. If Peter has a lead of 1.5 miles, how long will it take for Jill to catch up with him?
def solve() -> int: peter_speed = 5 jill_speed = 4 lead = 1.5 relative_speed = peter_speed - jill_speed time = lead / relative_speed result = time return result
Student: A group of adventurers went on a quest. The number of wizards was half the number of warriors. There were 40 warriors. No warriors were wizards. The total number of rogues was equal to the number of wizards plus ten. How many adventurers were there in total?
def solve() -> int: warriors = 40 wizards = warriors / 2 rogues = wizards + 10 total_adventurers = warriors + wizards + rogues result = total_adventurers return result
Ben has six pairs of socks that he wears once before washing. If he misses two days of laundry, how many days will he have to wear dirty socks?
def solve() -> int: socks_per_pair = 2 pairs_of_socks = 6 days_missed = 2 total_socks = socks_per_pair * pairs_of_socks total_days = total_socks / days_missed result = total_days return result
There are 20 men and 30 women in a company. The average salary of men is $75,000 while the average salary of women is $60,000. What is the average salary of the entire company?
def solve() -> int: num_men = 20 num_women = 30 salary_men = 75000 salary_women = 60000 total_salary = (num_men * salary_men) + (num_women * salary_women) total_people = num_men + num_women avg_salary = total_salary / total_people result = avg_salary return result
Jack and Jill have a combined height of 150 cm. Jill is 4 cm less than triple Jack’s height. How tall is Jill?
def solve() -> int: height_jack = (150-4)/ (1 + 3) height_jill = height_jack * 3 - 4 result = height_jill return result
Student: Jacob bought a shirt for $25 and a pair of jeans for $49. He has a coupon for $15 off his purchase. How much will he have to pay?
def solve() -> int: shirt_price = 25 jeans_price = 49 coupon_value = 15 total_cost = shirt_price + jeans_price amount_to_pay = total_cost - coupon_value result = amount_to_pay return result
A cyclist covers 18 km in 36 minutes. What is his average speed in miles per hour?
def solve() -> int: distance = 18 * 0.621371 time = 36 / 60 speed = distance / time result = round(speed, 2) return result
Question6: On a camping trip, 24 people eat 4 apples each. How many apples were eaten in total?
def solve() -> int: total_apples = 24 * 4 result = total_apples return result
A car rental service charges $100 per day for a car. But if a customer rents the car for more than 5 days, there is a 10% discount on the total cost. If Mr. Jones rented the car for 7 days, what is the total cost of the rental?
def solve() -> int: daily_cost = 100 rental_days = 7 if rental_days > 5: total_cost = (daily_cost * rental_days) * 0.9 else: total_cost = daily_cost * rental_days result = total_cost return result
Every time Max read a chapter in his book, he would reward himself with a cookie. Max's mom said she would give him $3 every day for making his bed. At the end of six weeks, how many cookies can Max buy?
def solve() -> int: days_in_week = 7 weeks = 6 chapters_per_day = 1 cookies_per_chapter = 1 money_per_day = 3 total_days = days_in_week * weeks total_chapters = total_days * chapters_per_day total_cookies = total_chapters * cookies_per_chapter total_money = total_days * money_pe...
A shopkeeper purchased 150 toys for $4500. At what price per toy should the shopkeeper sell them to make a 25% profit?
def solve() -> int: toy_count = 150 purchased_price = 4500 profit_margin = 0.25 profit = purchased_price * profit_margin total_price = purchased_price + profit price_per_toy = total_price / toy_count result = price_per_toy return result
Jason is 6 years younger than his sister Emily. The total of their ages is 15. What is Emily's age?
def solve() -> int: jason_age = 0 emily_age = 0 jason_age = emily_age - 6 total_age = jason_age + emily_age given_total_age = 15 emily_age = (given_total_age + 6) / 2 result = emily_age return result
David has a triangular prism that has a base area of 24 square centimeters and a height of 15 centimeters. He wants to paint the surface of the prism with a paint that costs $0.1 per square centimeter. How much does he need to pay for the paint? Assume that the triangular faces of the prism are equilateral and that the...
def solve() -> int: base_area = 24 height = 15 cost_paint = 0.1 sqrt3 = 3 ** 0.5 side_hexagon = (base_area / (3 * sqrt3 / 2)) ** 0.5 side_triangle = side_hexagon area_triangle = sqrt3 / 4 * side_triangle ** 2 area_lateral = 6 * side_hexagon * height area_total = 2 * ar...
am got a new car with 36 litres tank capacity. He drove for 5 hours and consumed 12 litres of fuel. How many litres of fuel will Sam have left?
def solve() -> int: tank_capacity = 36 hours_driving = 5 consumed_fuel = 12 remaining_fuel = tank_capacity - consumed_fuel result = remaining_fuel return result
In a big box, there are marbles in 4 colors. The number of green marbles is 20% more than the sum of red and blue marbles. The number of yellow marbles is three times that of red. If there are a total of 192 marbles, how many blue marbles are there?
def solve() -> int: num_blue = 0 num_red = 0 num_yellow = 0 num_green = 0 num_yellow = num_red * 3 num_green = (num_red + num_blue) + (num_red + num_blue)*0.2 total_marbles = num_blue + num_red + num_yellow + num_green num_blue = (total_marbles - num_red - num_yellow - num_g...
Jarvis read a 500-page book in 10 days. If he reads 40 pages per hour, how many hours did he spend reading the book?
def solve() -> int: total_pages = 500 pages_per_day = total_pages / 10 hours_per_page = 1 / 40 total_hours = pages_per_day / hours_per_page result = total_hours return result
Maria has $100. She spent 25% on groceries and 50% on rent. How much money does Maria have left?
def solve() -> int: maria_money = 100 groceries_spent = maria_money * 0.25 rent_spent = maria_money * 0.5 money_left = maria_money - groceries_spent - rent_spent result = money_left return result
In a city, 2/5 of the population owns a car, 1/4 of the car owners have a red car, and 3/5 of the non-car owners use public transportation. If there are 200,000 residents in the city, what percent of the residents have a car that is not red and do not use public transportation?
def solve() -> int: car_owners = 0.4 * 200000 red_cars = 0.25 * car_owners non_red_cars = car_owners - red_cars non_car_owners = 200000 - car_owners public_transportation_users = 0.6 * non_car_owners not_red_cars_not_public_transportation = non_red_cars + (non_car_owners - public_transportation_...
A baker wants to make 60 strawberry muffins and 40 blueberry muffins. Each strawberry muffin needs 2 strawberries, and each blueberry muffin needs 3 blueberries. If the baker has 180 strawberries and 240 blueberries, how many muffins can he make?
def solve() -> int: strawberry_muffins = 60 blueberry_muffins = 40 strawberry_per_muffin = 2 blueberry_per_muffin = 3 total_strawberries = strawberry_muffins * strawberry_per_muffin total_blueberries = blueberry_muffins * blueberry_per_muffin if total_strawberries < 180 or total_blueberries ...
A supermarket sells 5 brands of milk. Each brand has a 1-liter and a 500ml size. If a family regularly purchases 3 1-liter brands and 2 500ml brands, how many liters are consumed in a month?
def solve() -> int: num_milk_brands = 5 liter_milk = 1 half_liter_milk = 0.5 monthly_liters = (3 * liter_milk + 2 * half_liter_milk) * 30 result = f'{monthly_liters} liters of milk' result = monthly_liters return result
A recipe calls for 4 cups of flour to make 24 cookies. If you want to make 72 cookies, how many cups of flour will you need?
def solve() -> int: cups_needed = (72/24) * 4 result = cups_needed return result
A company produces 1000 units per day. If it takes 3 workers to produce 1 unit a day, how many workers are needed to produce the 1000 units in a day?
def solve() -> int: units_per_day = 1000 workers_per_unit = 3 total_workers = units_per_day * workers_per_unit result = total_workers return result
A cyclist can ride 15 miles per hour. If the cyclist rode for 2 hours and then took a 1-hour break, and then continued to ride for 3 more hours, how many miles did the cyclist ride in total?
def solve() -> int: speed_mph = 15 hours_riding = 2 + 3 miles_ridden = speed_mph * hours_riding result = miles_ridden return result
It takes Jason 25 steps to walk to his neighbor's house. He takes the same number of steps to walk home. How many steps does Jason take walking to and from his neighbor's house in sixteen days?
def solve() -> int: stepsToNeighborHouse = 25 numberOfDays = 16 totalSteps = stepsToNeighborHouse * 2 * numberOfDays result = totalSteps return result
A pizza restaurant offers a 10% discount on all online orders. If a large pizza costs $20, how much will it cost after the discount on an online order?
def solve() -> int: pizza_cost = 20 discount_percentage = 10/100 discount = pizza_cost * discount_percentage final_price = pizza_cost - discount result = final_price return result
A car travels 250 miles in 4 hours. What is its average speed in miles per hour?
def solve() -> int: distance = 250 time = 4 avg_speed = distance / time result = avg_speed return result
A shop sells 3 types of apples - green, red, and yellow. If there are 20 apples in total and the ratio of green, red, and yellow apples is 3:4:5. How many yellow apples are there?
def solve() -> int: total_apples = 20 yellow_ratio = 5/12 yellow_apples = total_apples * yellow_ratio result = yellow_apples return result
A triangle with sides 6 cm, 8 cm and 10 cm is a right angled triangle. What is its perimeter?
def solve() -> int: a = 6 b = 8 c = 10 perimeter = a+b+c result = perimeter return result
A hospital has 18 nurses and 2 times the number of doctors than nurses. The total number of medical staff members are 60, and the number of paramedics is 3 times the number of nurses. How many more doctors are there than paramedics?
def solve() -> int: nurses = 18 doctors = nurses*2 paramedics = nurses*3 result = doctors-paramedics return result
A truck moving from Miami to Atlanta navigates for 13 hours before reaching the destination. Customs and regulatory processes in Atlanta last 2 hours. Finally, moving the cargo from the port to your urban warehouse takes some time and it always arrives on the fourth hour. How many hours ago should the truck have depart...
def solve() -> int: hours_traveling = 13 customs_time = 2 cargo_time = 4 total_time = hours_traveling + customs_time + cargo_time time_left = 6 departure_time = time_left - total_time result = departure_time return result
A store has a sale of 30% off. If a shirt originally costs $50, what is the sale price of the shirt?
def solve() -> int: original_price = 50 discount_percentage = 30 discount_amount = (discount_percentage/100) * original_price sale_price = original_price - discount_amount result = sale_price return result
A pencil and notebook cost $7.45 in total. The pencil costs $5. What is the cost of a notebook?
def solve() -> int: pencil_cost = 5 total_cost = 7.45 notebook_cost = total_cost - pencil_cost result = f'The cost of the notebook is {notebook_cost}.' result = notebook_cost return result
san wants to buy a new phone, which costs $800. She plans to save 20% of her monthly salary of $2000 for 6 months to buy the phone. How much money will she have saved in total? total_savings =? ? ? John has a monthly income of $5000. He wants to save 30% of his income each month for the first 3 months, and then 40% of ...
def solve() -> int: savings_per_month = 0.2*2000 total_savings = savings_per_month * 6 result = total_savings return result
John buys 10 packs of gum, each pack contains 5 pieces of gum. If he gives away 4 individual pieces of gum, how many packs of gum does he have left?
def solve() -> int: gum_packs = 10 gum_each_pack = 5 total_gum = gum_packs * gum_each_pack individual_pieces_gum = 4 gum_left = (total_gum - individual_pieces_gum)//gum_each_pack result = gum_left return result
Samantha can bake twice as many cookies as Rachel does in an hour. If Samantha bakes 120 cookies and Rachel bakes at the same pace, how many cookies did Rachel bake?
def solve() -> int: samantha_cookies = 120 rachel_cookies = samantha_cookies / 2 result = rachel_cookies return result
Student: An apple costs 75 cents. If you buy 4 apples and pay with a 5-dollar note, how much change will you get back?
def solve() -> int: apple_cost = 0.75 num_apples = 4 payment = 5 total_cost = apple_cost * num_apples change = payment - total_cost result = change return result
Matthew has 10 books on his bookshelf. He bought 3 more books at the bookstore. Then, his sister gave him a set of 4 dozen books. How many books does Matthew have altogether now?
def solve() -> int: books_on_shelf = 10 books_bought = 3 books_from_sister = 4 * 12 total_books = books_on_shelf + books_bought + books_from_sister result = total_books return result
In Town P, there are 5/8 as many dogs as there are in Town Q. In Town R, there are 60 more dogs than in Town Q. If Town R has 300 dogs, what is the total number of dogs in the three towns?
def solve() -> int: dogs_in_town_Q = 300 - 60 dogs_in_town_P = (5/8) * dogs_in_town_Q total_dogs = dogs_in_town_Q + dogs_in_town_P + 300 result = total_dogs return result
``` A recipe calls for 2 and 1/2 cups of flour to make 24 cookies. How much flour is needed to make 36 cookies?
def solve() -> int: flour_per_cookie = 2.5/24 cookies = 36 flour_needed = flour_per_cookie * cookies result = flour_needed return result
Student: A pencil costs $0.75. If you have $5, how many pencils can you buy?
def solve() -> int: pencil_cost = 0.75 money = 5 num_pencils = money // pencil_cost result = num_pencils return result
If Matt needs 8 gallons of paint for an entire wall, and each gallon of paint covers 400 sq. ft. of wall, how many square feet of wall can 8 gallons of paint cover?
def solve() -> int: gallons_of_paint = 8 sqft_covered_by_1_gallon = 400 sqft_can_be_covered = gallons_of_paint * sqft_covered_by_1_gallon result = sqft_can_be_covered return result
A 5-lesson language course is normally $200. The language school is currently running a promotion for 20% off each lesson when signing up for the 5-lesson course. How many dollars cheaper is the promotional course than the normal one? A charity organization decides to distribute a total of $1500 in food packages to the...
def solve() -> int: num_lessons = 5 normal_price = 200 discount_percent = 20 discounted_price = normal_price * (100 - discount_percent) / 100 promotional_price = num_lessons * discounted_price price_difference = normal_price - promotional_price result = price_di...
In a soccer match, the red team scored 3 goals, while the blue team scored 5 goals and the green team scored 2 goals. How many more goals did the blue team score than the other two teams combined?
def solve() -> int: red_goals = 3 blue_goals = 5 green_goals = 2 total_goals = red_goals + blue_goals + green_goals blue_more_goals = blue_goals - total_goals result = blue_more_goals return result
There are 64 crayons in a box. If the crayons are separated equally between 4 kids, how many crayons will each kid get, and how many will be left over?
def solve() -> int: num_crayons = 64 num_kids = 4 crayons_per_kid = num_crayons // num_kids crayons_leftover = num_crayons % num_kids result = (crayons_per_kid, crayons_leftover) return result
Rachel is making pancakes. It takes 1 cup of flour and 1 egg to make four pancakes. Each of her 8 assistants can make 30 batches of pancakes per day and will work for 3 days. How many pancakes can Rachel make, given that the ratio of flour to eggs used is 1:1? Linda brought 75 cupcakes to share with her classmates duri...
def solve() -> int: flour_per_pancake = 0.25 egg_per_pancake = 0.25 pancakes_per_batch = 4 batches_per_assistant = 30 num_assistants = 8 days_worked = 3 total_batches = batches_per_assistant * num_assistants * days_worked total_pancakes = total_batches * pancakes_per_batch total...
A video game console costs $300, and it's currently on sale for 20% off. What is the sale price?
def solve() -> int: original_price = 300 discount = 20 sale_price = original_price - (original_price*(discount/100)) result = sale_price return result
After a big win in the stock market, Michael decided to go out for a fancy meal. He ordered a shrimp cocktail for $12, a lobster tail for $40, had a glass of expensive Pinot Noir for $15, and a slice of key lime pie for $9. He used a coupon for 25% off the price of his wine, but tipped his waitress 30% of what the full...
def solve() -> int: shrimp_cocktail = 12 lobster_tail = 40 pinot_noir = 15 key_lime_pie = 9 full_cost = shrimp_cocktail + lobster_tail + pinot_noir + key_lime_pie discounted_wine = pinot_noir * 0.75 tip = full_cost * 0.3 total_cost = full_cost + tip result = ...
A store sells watermelons. Each watermelon weighs 15 kilograms. If a truck can carry a maximum of 1200 kilograms, how many watermelons can be loaded into the truck?
def solve() -> int: watermelon_weight = 15 maximum_weight = 1200 number_of_watermelons = maximum_weight // watermelon_weight result = number_of_watermelons return result
In his greenhouse, Peter grew 50 tomato plants. Only 12 of them produced fruit, the rest had diseases. Later, he planted 30 more tomato plants, and 22 produced fruit in total. How many tomato plants had diseases in total?
def solve() -> int: tomato_plants = 50 fruit_plants = 12 diseased_plants = tomato_plants - fruit_plants additional_plants = 30 total_plants = tomato_plants + additional_plants total_fruit_plants = 22 new_diseased_plants = total_plants - total_fruit_plants result = diseased...
A rectangular garden is 15 meters long and 10 meters wide. What is the area of the garden in square meters?
def solve() -> int: length = 15 width = 10 area = length * width result = area return result
Lucas decides to save $30 every month. If he saves for 18 months and decides to spend $20 on each trip to the movies, how much money he would have at the end of this period?
def solve() -> int: savings_per_month = 30 number_of_months = 18 total_saving = savings_per_month * number_of_months movie_cost = 20 money_left = total_saving - (movie_cost * number_of_months) result = money_left return result
Liam's reading goal is to read 100 pages. On Monday, Liam was only able to read 40 pages, so he decided that he would make up for the rest on Tuesday. However, he was only able to read 30 pages on Tuesday. How many pages would Liam have to read on Wednesday to meet his minimum goal and make up for the ones he didn't do...
def solve() -> int: goal = 100 monday = 40 tuesday = 30 remaining = goal - monday - tuesday wednesday = remaining result = wednesday return result
ome possible questions and programs are: Lily wants to save money for a trip. She has $500 in her bank account and she deposits $50 every week. However, she also spends $20 every week on groceries and $10 every week on entertainment. How much money will she have after 12 weeks?
def solve() -> int: balance = 500 deposit = 50 spend = 20 + 10 weeks = 12 for i in range(weeks): balance = balance + deposit - spend result = balance return result
Possible new questions and programs are: Max bought a shirt for $12 and a pair of jeans for $25. He paid with a $50 bill and received some change. How much change did he get?
def solve() -> int: shirt = 12 jeans = 25 bill = 50 total = shirt + jeans change = bill - total result = change return result
Ava wants to buy a bike for $200. She already has $80 saved. She plans to sell her old bike to make the rest. If she sells her old bike and still has $120 left after buying the new bike, how much did she sell her old bike for?
def solve() -> int: total_cost = 200 saved_money = 80 money_left = 120 money_needed = total_cost - saved_money - money_left result = money_needed return result
A pharmacy has a supply of 600 tablets of medicine. If a patient takes 2 tablets every day, how many days will the supply of medicine last?
def solve() -> int: num_tablets = 600 tablets_per_day = 2 result = num_tablets / tablets_per_day return result
Mia had 24 roses in her garden. She gave 6 roses to her mom, 4 roses to her grandma, and 3 roses to her teacher. She also planted 12 more roses in her garden. How many roses did Mia have in her garden now?
def solve() -> int: roses_left = 24 - 6 - 4 - 3 roses_total = roses_left + 12 result = roses_total return result
Alex is selling homemade candles. He sells each candle for $6. A bag of wax weighs 10 pounds and costs $12. Each candle needs 0.5 pounds of wax. If Alex makes a profit of $30 from selling candles, how many did he sell?
def solve() -> int: candle_price = 6 wax_price = 12 wax_weight = 10 wax_needed_per_candle = 0.5 profit = 30 total_wax_cost = wax_price / wax_weight candles_sold = profit / (candle_price - total_wax_cost) result = candles_sold return result
Emma had 12 pencils. She broke 2 pencils and then sharpened 4 pencils. Each sharpening reduced the length of a pencil by 10%. How many centimeters of pencils did Emma have in total, if each pencil was originally 15 cm long?
def solve() -> int: pencils = 12 broke = 2 sharpened = 4 original_length = 15 sharpening_reduction = 0.1 pencils_after_breaking = pencils - broke length_lost_by_sharpening = sharpened * sharpening_reduction length_after_sharpening = original_length - length_lost_by_sharpening pencils...
Lisa has 18 cookies that she wants to share equally with her 3 siblings. She gives one cookie to each sibling and then eats one cookie herself. How many cookies does Lisa have left to share?
def solve() -> int: cookies = 18 cookies = cookies - 3 - 1 cookies_per_sibling = cookies / 3 result = cookies_per_sibling return result
Bailey collected 30 seashells. Within those, 12 were small and white, 10 were small and pink, and 16 were pink and white. What is the difference between the number of seashells that were pink versus white?
def solve() -> int: small_white = 12 small_pink = 10 pink_white = 16 pink_seashells = small_pink + pink_white white_seashells = small_white + pink_white difference = pink_seashells - white_seashells result = difference return result
Ella wants to buy a new laptop. If she saves 50 dollars every week for six weeks and 100 dollars the last week, how much will she have in total?
def solve() -> int: week_savings = 50 last_week_savings = 100 total_savings = (week_savings * 6) + last_week_savings result = total_savings return result
Tim and Rick are running a 5km race. Tim ran the first 2/5 of the distance in 14 minutes. He finished the race 3 minutes before Rick did. If Rick finished the race in 25 minutes, how long did it take Tim to run the last 3/5 of the distance?
def solve() -> int: distance = 5 tim_distance = (2/5) * distance tim_time = 14 rick_time = 25 tim_speed = tim_distance / tim_time rick_speed = distance / rick_time tim_last_distance = (3/5) * distance tim_last_time = tim_last_distance / tim_speed result = tim_last_time...
``` Jane was paid 45 dollars per hour for a coding project for 20 hours, but was taxed 10% of her pay. How much did she make in total after tax?
def solve() -> int: pay_rate = 45 hours = 20 pre_tax_earnings = pay_rate * hours taxed_amount = 0.1 * pre_tax_earnings post_tax_earnings = pre_tax_earnings - taxed_amount result = post_tax_earnings return result
Student: Anna hired a magician for her birthday party who charged $150 for the first hour and $100 for each additional hour. She also ordered a pizza for $15 per person for 20 guests. The rest of the party expenses were $500. How much did her birthday party cost?
def solve() -> int: magician_cost = 150 additional_hour_cost = 100 pizza_cost = 15 num_guests = 20 other_expenses = 500 total_magician_cost = magician_cost + additional_hour_cost total_pizza_cost = pizza_cost * num_guests total_cost = total_magician_cost + total_pizza_cost + other_e...
Student: Daniel and Ella shared a pizza that had 12 slices. Daniel ate 2/3 of what Ella ate, and then Ella ate 2 more slices. How many slices of pizza did Daniel eat?
def solve() -> int: slices_total = 12 slices_ella = 0 slices_daniel = 0 slices_ella = slices_total - 2 slices_daniel = slices_ella * 2/3 + 2 result = slices_daniel return result
Marie drives a car for a distance of 100Km in two hours. What is her average speed?
def solve() -> int: distance = 100 time_interval = 2 result = distance/time_interval return result
Antonio buys 18 t-shirts at 18 euros each and 20 coats at 25 euros each. How much money did he spend in total?
def solve() -> int: tshirts_num = 18 tshirts_price = 18 coats_num = 20 coats_price = 25 total_cost = (tshirts_num * tshirts_price) + (coats_num * coats_price) result = total_cost return result
Jack has 10 apples. He gives 3 to his friend. Then he buys 5 more apples. How many apples does Jack have now?
def solve() -> int: apples = 10 gives = 3 buys = 5 result = apples - gives + buys return result
Tom can paint a fence in 6 hours. Jerry can paint the same fence in 5 hours. How long would it take them to paint the fence if they worked together?
def solve() -> int: tom_time = 6.0 jerry_time = 5.0 tom_rate = 1/tom_time jerry_rate = 1/jerry_time combined_rate = tom_rate + jerry_rate time_together = 1/combined_rate result = time_together return result
Student: Kim and Lee are painting a wall. Kim can paint 9 square meters per hour, and Lee can paint 6 square meters per hour. If the wall has an area of 54 square meters, and they start painting at the same time, how long will it take them to finish painting?
def solve() -> int: kim_speed = 9 lee_speed = 6 wall_area = 54 total_time = wall_area / (kim_speed + lee_speed) result = total_time return result
In the baseball game, The Tigers scored 2 runs in the first inning and 3 runs in the second inning. The other team, The Eagles, scored 1 run more than The Tigers in the first inning and 2 runs less than The Tigers in the second inning. What is the total amount of runs both teams scored?
def solve() -> int: tigers_first = 2 tigers_second = 3 eagles_first = tigers_first + 1 eagles_second = tigers_second - 2 total_score = tigers_first + tigers_second + eagles_first + eagles_second result = total_score return result
A restaurant has 60 tables and 24 booths. If 10 tables and 7 booths are reserved, how many tables and booths are left?
def solve() -> int: total_tables = 60 total_booths = 24 reserved_tables = 10 reserved_booths = 7 remaining_tables = total_tables - reserved_tables remaining_booths = total_booths - reserved_booths result = f'{remaining_tables} tables and {remaining_booths} booths are left.' ...