question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A bag of candy contains 30 pieces. If John wants to buy 5 bags of candy, how many pieces of candy will he have?
def solve() -> int: candies_per_bag = 30 num_bags = 5 total_candies = candies_per_bag * num_bags result = total_candies return result
Student: The temperature outside is 35℃, what is the temperature in Fahrenheit?
def solve() -> int: celsius = 35 fahrenheit = (celsius * 9/5) + 32 result = fahrenheit return result
Emily saves 15% of her $500 monthly salary. How much money does she save every month?
def solve() -> int: salary = 500 percent_saved = 15 / 100 amount_saved = salary * percent_saved result = amount_saved return result
John and Sarah are selling candy at the fair. John charges $1 for a piece of candy and Sarah charges $2 for a piece of candy. They earned a total of $180. If they sold 20 pieces of candy in total, how many pieces of candy did each of them sell?
def solve() -> int: total_income = 180 john_price = 1 sarah_price = 2 total_sold = 20 john_sold = (total_income - (sarah_price * total_sold)) / john_price result = [john_sold, total_sold - john_sold] return result
Student: Joey purchased wood and needs to determine how much he spent on the wood. The wood he purchsed was 10 inches wide and 12 feet long and cost \$12 per feet. How much did Joey spend on the wood?
def solve() -> int: width = 10 length = 12 cost_per_feet = 12 total_cost = width * length * cost_per_feet result = total_cost return result
Sarah has 75 pencils. Michael took 10 of Sarah's pencils and still has 30 less pencils than Sarah started with. How many pencils did Michael start with?
def solve() -> int: sarah_pencils = 75 michael_pencils = sarah_pencils - 10 michael_pencils += 30 result = michael_pencils return result
A barrel of apples is 1/3 full. After 16 apples are removed, the barrel becomes 1/2 full. How many apples can the barrel hold when full?
def solve() -> int: difference = 1/2 - 1/3 apples_removed = 16 total_apples = apples_removed / difference result = total_apples return result
A rectangle has a length of 7 and a width of 4. What is the perimeter of the rectangle?
def solve() -> int: length = 7 width = 4 perimeter = (2 * length) + (2 * width) result = perimeter return result
Sarah and Katie want to buy new shoes. Sarah finds a pair she likes for $60 and Katie finds a pair that are 20% more expensive. Katie agrees to pay for two-thirds of the more expensive shoes if Sarah covers the rest and a 15% tip. How much does Sarah need to pay?
def solve() -> int: sarah_shoes = 60 katie_shoes = sarah_shoes * 1.2 katie_payment = katie_shoes * (2/3) sarah_payment = (katie_shoes - katie_payment) * 1.15 total_payment = sarah_shoes + sarah_payment result = total_payment return result
Student: Jessica has two jobs. She makes $10 per hour from her first job and $12 per hour from her second job. She worked 5 hours at her first job and 4 hours at her second job this week. How much money did Jessica make in total?
def solve() -> int: hourly_wage_1 = 10 hourly_wage_2 = 12 hours_worked_1 = 5 hours_worked_2 = 4 total_money_1 = hourly_wage_1 * hours_worked_1 total_money_2 = hourly_wage_2 * hours_worked_2 result = total_money_1 + total_money_2 return result
A restaurant offers a fixed 20 percent discount to all customers and an additional discount of 10 percent to students. If a group of 4 people goes to the restaurant and 2 of them are students, how much do they pay at the end if the total bill is $100?
def solve() -> int: total_bill = 100 discount_percentage_1 = 20 discount_percentage_2 = 10 discount_1 = total_bill * discount_percentage_1 / 100 discounted_price_1 = total_bill - discount_1 discount_2 = (discounted_price_1 / 2) * discount_percentage_2 / 100 discounted_price_2 = discounted_pr...
Student: 10. Alina bought three pairs of shoes which cost $130 each. What will be the total cost if she received a 25% discount?
def solve() -> int: shoes = 3 price = 130 discount = 0.25 total_cost = shoes * price * (1 - discount) result = total_cost return result
arah is baking cookies. She has 4 cups of flour, and each batch of cookies requires 2/3 cups of flour. How many batches of cookies can Sarah make?
def solve() -> int: flour_cups = 4 cookies_per_batch = 2/3 batches = int(flour_cups // cookies_per_batch) result = batches return result
Emma has $120 in her bank account. If she makes a deposit of $40 every month, how much money will she have after 1 year (12 months)?
def solve() -> int: initial_balance = 120 monthly_deposit = 40 num_months = 12 total_deposits = monthly_deposit * num_months final_balance = initial_balance + total_deposits result = final_balance return result
Jackson has to paint his bedroom walls. Each wall is 10 feet tall and 12 feet wide. If he wants to paint all four walls, how many square feet does he need to cover with paint?
def solve() -> int: height = 10 width = 12 num_walls = 4 area_per_wall = height * width total_area = area_per_wall * num_walls result = total_area return result
The minimum number of years of experience required to be considered for a job is 5 years. Mike is interested in applying for the job and will have one-third the years of experience of his colleague in two years. If his colleague currently has 10 years of experience, how long before Mike meets the minimum requirement?
def solve() -> int: colleague_experience = 10 mike_experience = (1/3) * (colleague_experience + 2) - 2 minimum_experience = 5 years_to_meet_requirement = minimum_experience - mike_experience result = years_to_meet_requirement return result
Michael writes a 2-page poem to his 4 friends once a week. How many pages of poems does he write in a month?
def solve() -> int: pages_per_poem = 2 friends = 4 weeks_per_month = 4 pages_per_month = pages_per_poem * friends * weeks_per_month result = pages_per_month return result
In a group of 50 people, 30% are left-handed, 60% are tall, and 25% are both left-handed and tall. What is the probability that a randomly selected person is either left-handed or tall, but not both?
def solve() -> int: prob_left = 0.3 prob_tall = 0.6 prob_only_left = prob_left - 0.25 prob_only_tall = prob_tall - 0.25 result = prob_only_left + prob_only_tall return result
A class of 18 students took a test that had 20 questions. The first 6 students answered 18 questions correctly each. The next 6 students answered 16 questions correctly each. The last 6 students answered 14 questions correctly each. What is the average score per student for the test?
def solve() -> int: total_score = (6 * 18) + (6 * 16) + (6 * 14) average_score = total_score / 18 result = average_score return result
Mark knows that he can only spend $100 on his date and his girlfriend said that they can only go for one activity. He remembers that he spent $40 for the movie tickets and $20 for the dinner. How much can he spend on the second activity?
def solve() -> int: total_budget = 100 movie_tickets = 40 dinner = 20 total_spent = movie_tickets + dinner remaining_budget = total_budget - total_spent result = remaining_budget return result
The ratio of the length to breadth of a rectangular park is 3:2. If the area of the park is 7500 sq. m, find its perimeter.
def solve() -> int: area_of_rectangular_park = 7500 ratio_of_length_to_breadth = 3/2 breadth = (area_of_rectangular_park/ratio_of_length_to_breadth)**0.5 length = ratio_of_length_to_breadth*breadth perimeter = 2*(length+breadth) result = perimeter return result
In a classroom of 90 students, 1/3 of them were absent. If 1/4 of the absent students and 1/5 of the present students failed a test, how many students passed the test?
def solve() -> int: total_students = 90 absent_students = total_students / 3 present_students = total_students - absent_students absent_students_failed = absent_students / 4 present_students_failed = present_students / 5 students_passed = total_students - (absent_students_failed + pres...
Mary has 420 beads. She makes 12 bracelets with equal numbers of beads. She uses three fifths of the beads for blue bracelets, two fifths of the beads for pink bracelets, and the rest of the beads for purple bracelets. How many purple bracelets does Mary make?
def solve() -> int: total_beads = 420 bracelets = 12 blue_fraction = 0.6 pink_fraction = 0.4 beads_per_bracelet = total_beads / bracelets blue_bracelets = bracelets * blue_fraction pink_bracelets = bracelets * pink_fraction purple_bracelets = bracelets - blue_bracelets - pink_bracelets ...
The ratio of Peter's apples to Paul's apples is 3:4. If Peter has 24 apples, how many apples does Paul have?
def solve() -> int: peter_apples = 24 peter_ratio = 3 paul_ratio = 4 paul_apples = (peter_ratio/paul_ratio)*peter_apples result = paul_apples return result
John has $1500. He bought a shirt for $50, 5 books for $20 each and a pencil case for 10% of the total amount he spent on the earlier items. How much money does he have left?
def solve() -> int: total_books_price = 5*20 total_price = 50 + total_books_price + 0.1*(50 + total_books_price) money_left = 1500 - total_price result = money_left return result
Student: David rents a car for a weekend trip and pays $100 for the rental fee, $50 for the insurance, and $20 for the gas. He also pays $15 for the tolls and $12 for the parking. He uses a coupon that gives him 10% off the rental fee and insurance. How much did he spend for the car?
def solve() -> int: rental_fee = 100 insurance = 50 gas = 20 tolls = 15 parking = 12 discount = 0.1 total_cost = rental_fee + insurance + gas + tolls + parking discounted_cost = total_cost - (rental_fee + insurance) * discount final_cost = discounted_cost + (rental_fee + insurance) *...
Mangoes used to cost $2.8 per pound. The price got lowered 12.5%. How much does it cost to buy 0.5 pounds of mangoes for each person in a 2 member family?
def solve() -> int: mango_price = 2.8 discount = 12.5 weight = 0.5 family_members = 2 discounted_price = mango_price - (mango_price * (discount / 100)) total_cost = discounted_price * weight * family_members result = total_cost return result
A carpenter has 10 ft sections of trim wood that 3/4 inch thick and 2 inches wide. If the carpenter needs to trim out a room that is 14 ft long and 10 ft wide with 8 ft ceilings, how many sections of trim wood will they need?
def solve() -> int: room_length = 14 room_width = 10 ceiling_height = 8 surface_area = (room_length + room_width) * 2 * ceiling_height section_length = 10 section_thickness = 3/4 section_width = 2 section_area = section_length * section_thickness * section_width sections_needed = sur...
A pizza place sells large pizzas for $15 and small pizzas for $10. If they sell 20% more small pizzas than large pizzas and they sell 50 pizzas in total, how many of each size did they sell?
def solve() -> int: total_pizzas = 50 small_pizzas_ratio = 1.2 small_pizzas = total_pizzas / (1 + small_pizzas_ratio) large_pizzas = total_pizzas - small_pizzas total_sales = (small_pizzas * 10) + (large_pizzas * 15) result = (small_pizzas, large_pizzas, total_sales) return result
A runner completed a marathon in 3 hours and 45 minutes. The race started at 6 AM, at what time did the runner finish the race?
def solve() -> int: start_time_hours = 6 start_time_minutes = 0 finish_time_hours = start_time_hours + 3 finish_time_minutes = start_time_minutes + 45 if finish_time_minutes >= 60: finish_time_hours += 1 finish_time_minutes -= 60 finish_time = f"{finish_time_hours}:{finish_time_minut...
Student: John has 20 lollipops. He gave 5 lollipops to his sister. How many lollipops does he have now?
def solve() -> int: lollipops_John = 20 lollipops_sister = 5 lollipops_John_now = lollipops_John - lollipops_sister result = lollipops_John_now return result
A movie ticket costs $10 and it is also 20% cheaper than a concert ticket. How much does the concert ticket cost?
def solve() -> int: concert_ticket_price = 10 // (1 - 0.2) result = concert_ticket_price return result
Student: 2. Adam drove around the school looking for parking spots. He noticed that all the parking spots in the student sections were marked as A and all the parking spots for visitors were marked as B. If he counted 30 A spots and 20 B spots, how many total parking spots did he see?
def solve() -> int: A = 30 B = 20 total = A + B result = total return result
Lily shares one-third of a big banana with her monkey every day. A big banana weighs about 1/4 a pound. She can currently buy bananas for $0.50 a pound. How much will she spend so that she and her monkey have enough bananas to last for 1 week?
def solve() -> int: big_banana_weight = 1/4 daily_share = big_banana_weight * 1/3 weekly_share = daily_share * 7 banana_price = 0.50 total_cost = weekly_share * banana_price result = total_cost return result
Olivia and Sophia each receive $10 from their grandfather. Olivia spends twice as much as Sophia and has $2.50 left. Sophia spends $3.75 on a dress and still has $2.50 left. How much did Olivia and Sophia spend altogether, in dollars?
def solve() -> int: grandfather_gift = 10 olivia_spent = (grandfather_gift * 2) - 2.5 sophia_spent = grandfather_gift - 3.75 + 2.5 total_spent = olivia_spent + sophia_spent result = total_spent return result
There are fifty-six apples in a basket. If eight more apples are added, the number of apples in the basket becomes seven times the number of apples in the orchard. How many apples are in the orchard?
def solve() -> int: basket = 56 added_apples = 8 total_apples = basket + added_apples orchard_apples = total_apples / 7 result = orchard_apples return result
Dave has 4 more than half as many books as Jess. If Dave has 28 books, how many books do they have together?
def solve() -> int: books_dave = 28 books_jess = (books_dave - 4) * 2 total_books = books_dave + books_jess result = total_books return result
The sum of the interior angles of a polygon with n sides is 180(n-2) degrees. If the sum of the angles of a polygon is 1080 degrees, how many sides does it have?
def solve() -> int: sum_of_angles = 1080 n = 6 result = n return result
A bakery sells muffins for $2 each. They bake 8 dozen muffins every day and sell out by the afternoon. How much money does the bakery make from muffin sales in a week (7 days)?
def solve() -> int: muffins_per_day = 8 * 12 price_per_muffin = 2 sales_per_day = muffins_per_day * price_per_muffin days_per_week = 7 sales_per_week = sales_per_day * days_per_week result = sales_per_week return result
Student: Maria ate 2/5 of a pizza and gave 1/3 of the remaining pizza to her friend. What fraction of the whole pizza did Maria give to her friend?
def solve() -> int: pizza = 1 maria = 2/5 remaining = pizza - maria friend = 1/3 gave = remaining * friend result = gave return result
A baker uses 6 cups of flour to make one cake. How many cups of flour will the baker need to make 10 cakes?
def solve() -> int: cups_of_flour_per_cake = 6 total_cakes = 10 total_cups_of_flour = cups_of_flour_per_cake * total_cakes result = total_cups_of_flour return result
At a park, a tour bus departs every hour for 7 hours a day. How many tours depart in a weekend?
def solve() -> int: hours_per_day = 7 days_per_weekend = 2 tours_per_hour = 1 tours_per_weekend = hours_per_day * days_per_weekend * tours_per_hour result = tours_per_weekend return result
A college student went out for dinner with friends and spent $26.50, including a 15% tip. What was the cost of the meal before the tip?
def solve() -> int: total_cost = 26.50 tip_percentage = 0.15 cost_before_tip = total_cost / (1+tip_percentage) result = cost_before_tip return result
If there is one coupon for every 5 items purchased, how many coupons are needed for 45 items?
def solve() -> int: items_purchased = 45 coupons = items_purchased/5 result = coupons return result
Marcus always hits the snooze button when waking up 60% of the time. On 10% of the days that he hits the snooze button, he is late for work. What percentage of mornings is Marcus not late for work?
def solve() -> int: snooze_percentage = 0.6 late_percentage = 0.1 not_late_percentage = (1 - snooze_percentage) + (snooze_percentage * (1 - late_percentage)) result = not_late_percentage return result
Alicia has 2 dollars on the first day of the week. Every day she earns double of what she earned the previous day. How many more dollars will Alicia have than John if John will have 126 dollars by the end of the week?
def solve() -> int: days = 7 john_earnings = 126 alicia_earnings = 2 for day in range(2, days+1): alicia_earnings *= 2 difference = alicia_earnings - john_earnings result = difference return result
The perimeter of a rectangle is 26 cm. The width is one-third of the length. What are the length and width?
def solve() -> int: length = 26/10 width = length/3 result = length + width return result
An ice cream shop has 10 different flavor options and 3 different sizes. If a customer can pick one flavor and one size, how many different combinations are possible?
def solve() -> int: flavors = 10 sizes = 3 combinations = flavors * sizes result = combinations return result
A store has a sale where everything is 20% off. If a shirt costs $12, how much is the shirt during the sale?
def solve() -> int: original_price = 12 discount_rate = 0.2 discounted_price = original_price * (1 - discount_rate) result = discounted_price return result
Student: Alex finished his gym membership and the manager gave him a discount of 50%. The original price was $50 per month and if Alex pays for a 6 month membership, how much will it cost him?
def solve() -> int: original_price = 50 discount = 0.5 months = 6 discounted_price = original_price * (1 - discount) total_cost = discounted_price * months result = total_cost return result
``` The price of a football is $30 before tax. If the sales tax is 5%, what is the price of the football after tax?
def solve() -> int: tax_percent = 5 price_before_tax = 30 tax_amount = (tax_percent/100)*price_before_tax price_after_tax = price_before_tax + tax_amount result = price_after_tax return result
Mike ran 5 laps around a track. Each lap took him 2 minutes and 30 seconds. What was his total running time in minutes and seconds?
def solve() -> int: laps = 5 lap_time = "2:30" lap_seconds = int(lap_time.split(":")[0]) * 60 + int(lap_time.split(":")[1]) total_seconds = laps * lap_seconds total_time = str(total_seconds // 60) + " minutes " + str(total_seconds % 60) + " seconds" result = "Mike's total running ...
A rectangle has a length of 10 meters and a width of 5 meters. What is the perimeter of the rectangle?
def solve() -> int: length = 10 width = 5 perimeter = (2 * length) + (2 * width) result = perimeter return result
Jason walks 3 miles every day. His neighbor Paul walks 2 miles more than Jason each day. If they didn't walk any miles on Saturdays during the month of July, and there are 5 Saturdays in July, what is the total number of miles they both walked in July?
def solve() -> int: jason_miles_per_day = 3 paul_miles_per_day = jason_miles_per_day + 2 saturdays_in_july = 5 jason_total_miles = jason_miles_per_day * (31 - saturdays_in_july) paul_total_miles = paul_miles_per_day * (31 - saturdays_in_july) total_miles_in_july = jason_total_miles + p...
A boat travels at a speed of 25 knots for 6 hours and at a speed of 15 knots for 4 hours to reach a destination every day for a week. How far does the boat travel in a week?
def solve() -> int: speed1 = 25 speed2 = 15 time1 = 6 time2 = 4 distance1 = speed1 * time1 distance2 = speed2 * time2 total_distance = distance1 + distance2 result = total_distance * 7 return result
Nikki has 7 horses, 6 zebras and 10 llamas. How many animals does Nikki have in total?
def solve() -> int: animals_count = 0 animals_count += 7 animals_count += 6 animals_count += 10 result = animals_count return result
Tim has to pay $15 per hour for a caretaker for his elderly mother. If the caretaker works 8 hours per day for 5 days a week, how much does Tim spend on caretaker fees in a month?
def solve() -> int: hourly_rate = 15 hours_per_day = 8 days_per_week = 5 weekly_cost = hourly_rate * hours_per_day * days_per_week monthly_cost = weekly_cost * 4 result = monthly_cost return result
There are 27 students in a class. If 16 students like pizza and 7 students like both pizza and burgers, how many students like only burgers?
def solve() -> int: pizza_lovers = 16 pizza_and_burger_lovers = 7 students_in_class = 27 pizza_only = pizza_lovers - pizza_and_burger_lovers burgers_only = (students_in_class - (pizza_lovers + pizza_and_burger_lovers)) result = burgers_only return result
Erica is shopping for a sofa that costs $279.99, a love seat that costs $249.99, and a recliner that costs $399.99. How much will Erica need to pay for the furniture?
def solve() -> int: sofa_cost = 279.99 loveseat_cost = 249.99 recliner_cost = 399.99 total = sofa_cost + loveseat_cost + recliner_cost result = total return result
You have 3 $10 bills and 4 $20 bills. How much money do you have?
def solve() -> int: ten_bill = 10 num_ten_bills = 3 twenty_bill = 20 num_twenty_bills = 4 total_money = (ten_bill * num_ten_bills) + (twenty_bill * num_twenty_bills) result = total_money return result
An amusement park ride has 6 rows of seats, with an aisle running down the middle of the ride, splitting each row into two sections. If each section can seat 2 riders, how many riders can the ride hold?
def solve() -> int: rows = 6 sections_per_row = 2 riders_per_section = 2 total_riders = rows * sections_per_row * riders_per_section result = total_riders return result
Albert had $400 and he spent 3/8 of it on 2 new video games. How much money did he spend on each video game?
def solve() -> int: total_money = 400 percent_spent = 3/8 total_money_spent = total_money * percent_spent cost_per_game = total_money_spent / 2 result = cost_per_game return result
At a jewelry store, 3 jewelers work for 6 hours a day. The owner wants to add a fourth jeweler that works for only 2 hours a day. Each jeweler can make 10 new rings an hour. If each ring is sold for $200, how much can the jewelry store earn in one day?
def solve() -> int: jewelers = 3 hours_per_day = 6 new_jeweler_hours = 2 rings_per_hour = 10 ring_price = 200 total_jewelers = jewelers + 1 total_hours = hours_per_day + new_jeweler_hours total_rings = total_jewelers * total_hours * rings_per_hour total_earnings = total_rin...
A car rental company charges $25 per day to rent a car and an additional $0.15 per mile driven. If someone rents a car for 5 days and drives 300 miles, how much will they be charged?
def solve() -> int: num_days = 5 daily_charge = 25 num_miles = 300 mileage_charge = 0.15 * num_miles total_charge = num_days * daily_charge + mileage_charge result = total_charge return result
Jack went to the pet store and spent €70. He bought a dog bed for €40, a pack of dog toys for €15, and a bag of dog food for €15. How much money does Jack have left?
def solve() -> int: total_money = 70 dog_bed_cost = 40 dog_toys_cost = 15 dog_food_cost = 15 money_spent = dog_bed_cost + dog_toys_cost + dog_food_cost money_left = total_money - money_spent result = money_left return result
At a movie theater, there were 50 adults and 15 more children than adults. Each adult received 2 popcorns and each child received 3 popcorns. If Sarah bought boxes of popcorn where a box contains 12 popcorns and is priced at $6, how much did Sarah spend on popcorns?
def solve() -> int: adults = 50 children = adults + 15 adult_popcorns = adults * 2 child_popcorns = children * 3 total_popcorns = adult_popcorns + child_popcorns boxes = total_popcorns // 12 cost = boxes * 6 result = cost return result
A high school has a budget of $100,000 for sports equipment. If the school plans to buy 50 footballs at $50 each, how much money is left for other equipment?
def solve() -> int: total_cost = 50 * 50 remaining_budget = 100000 - total_cost result = remaining_budget return result
Question Eight: The price of a shirt at the local store is $24.50. If Mrs Jones bought 6 shirts on Sunday for the family, how much did she have to spend in total?
def solve() -> int: shirt_price = 24.5 shirts_bought = 6 total_price = shirt_price * shirts_bought result = total_price return result
A fountain produces 200 liters of water per minute. How much water will the fountain produce in one hour?
def solve() -> int: water_per_minute = 200 minutes_in_hour = 60 water_per_hour = water_per_minute * minutes_in_hour result = water_per_hour return result
A teacher wants to divide 40 pencils equally among the students in a class. If there are 15 students, how many pencils will each student receive?
def solve() -> int: pencils = 40 students = 15 distribution = pencils // students result = distribution return result
If Abby spends a quarter of her income to buy 40 pencils, how much does she spend?
def solve() -> int: income = 100 pencils_bought = 40 fraction_of_income_spent = 0.25 total_spent = fraction_of_income_spent * income * pencils_bought result = total_spent return result
Kevin has 120 stickers in three different colors in equal quantities. Kevin misplaced 4 stickers of the first color, twice as many of the second color; three times as many of the third color as the first color. How many stickers does he have now?
def solve() -> int: first_color = 120 / 3 second_color = 120 / 3 third_color = 120 / 3 first_color -= 4 second_color -= 2 * 4 third_color -= 3 * 4 total_stickers = first_color + second_color + third_color result = total_stickers return result
A rectangle has a perimeter of 46 cm and an area of 120 cm². What are its dimensions?
def solve() -> int: perimeter = 46 area = 120 l = (perimeter + ((perimeter**2)-(16*area))**0.5)/4 b = (perimeter - ((perimeter**2)-(16*area))**0.5)/4 result = (l, b) return result
If Bill bought 10 apples for $12 and 7 oranges for $5 each, how much money did he spend in total?
def solve() -> int: apples_amount = 10 apples_price = 12 oranges_amount = 7 oranges_price = 5 total_money_spent = (apples_amount * apples_price) + (oranges_amount * oranges_price) result = total_money_spent return result
Mary donated 2/3 of her 240 toys to a local charity in the ratio of 3:5. How many toys did the charity receive in total?
def solve() -> int: total_toys = 240 donated_ratio = 2/3 charity_ratio = [3, 5] toys_donated = total_toys * donated_ratio total_ratio = sum(charity_ratio) toys_received = toys_donated * (charity_ratio[1] / total_ratio) result = toys_received return result
Mr. Johnson has a rectangular garden that measures 12 meters by 8 meters. If he wants to put a path around the garden that is 1 meter wide, how much area will the path cover?
def solve() -> int: length = 12 width = 8 path_width = 1 area = (length + (2*path_width)) * (width + (2*path_width)) original_area = length * width total_path_area = area - original_area result = total_path_area return result
A company has 200 pens to distribute among its 50 employees. If each employee can get 3 pens, how many pens will remain after distributing to employees and mistakenly losing 5 pens?
def solve() -> int: pens_available = 200 employees = 50 pens_per_employee = 3 pens_lost = 5 pens_distributed = employees * pens_per_employee pens_remaining = pens_available - pens_distributed - pens_lost result = pens_remaining return result
If Kevin drives at a speed of 50 mph for 3 hours, how far does he travel in total?
def solve() -> int: speed = 50 time_in_hours = 3 distance = speed * time_in_hours result = distance return result
Jason has a pizza that's divided into 8 equal slices. He ate 3 slices. What fraction of the pizza did he eat?
def solve() -> int: fraction = 3/8 result = fraction return result
A school has 500 students and 25 teachers. Each student pays $1000 for tuition and each teacher receives $4000 for salary. The school also spends $10000 for utilities and $5000 for supplies. How much profit or loss does the school make in a year?
def solve() -> int: students = 500 student_tuition = 1000 teachers = 25 teacher_salary = 4000 utilities = 10000 supplies = 5000 total_income = students * student_tuition total_expense = teachers * teacher_salary + utilities + supplies profit_or_loss = total_income - total_expen...
``` A movie theater has 200 seats. If they sell 75% of the seats for a show, how many seats are empty?
def solve() -> int: total_seats = 200 percent_sold = 75 seats_sold = total_seats * percent_sold / 100 seats_empty = total_seats - seats_sold result = seats_empty return result
A coffee shop offers a loyalty program. The regular price of a coffee is $3. If you buy 5 coffees at the regular price, you get the next coffee for free. If a customer bought 10 coffees for $18, how much money have they saved with the loyalty program?
def solve() -> int: cost_of_5_coffees = 5 * 3 cost_of_6_coffees = 6 * 3 cost_of_10_coffees = cost_of_6_coffees + (4 * 3) savings = cost_of_10_coffees - (10 * 3) result = savings return result
Hugh is able to read 8 pages an hour. How many days will it take him to read a 400 page book?
def solve() -> int: pages_per_hour = 8 total_pages = 400 hours_taken = total_pages/pages_per_hour days_taken = hours_taken/24 result = days_taken return result
Student: A car can travel 300 miles on 12 gallons of gas. How far could it travel on 20 gallons of gas?
def solve() -> int: miles = 300 gallons = 12 new_gallons = 20 rate = miles / gallons new_miles = rate * new_gallons result = new_miles return result
Lucy and Amy were selling lemonade and iced tea at a stand. Each cup of lemonade cost 25 cents and each cup of iced tea cost 50 cents. Lucy sold 40 cups of lemonade and 20 cups of iced tea. Amy sold 30 cups of lemonade and 30 cups of iced tea. How much more money did Amy make from selling drinks compared to Lucy?
def solve() -> int: lemonade_price = 0.25 iced_tea_price = 0.5 lucy_lemonade = 40 lucy_iced_tea = 20 amy_lemonade = 30 amy_iced_tea = 30 lucy_money = lucy_lemonade * lemonade_price + lucy_iced_tea * iced_tea_price amy_money = amy_lemonade * lemonade_price + amy_iced_tea * iced_tea_pri...
A book costs $20. If Marie bought 4 books and got a 20% discount on her total purchase, how much did she pay?
def solve() -> int: books = 4 cost_of_book = 20 total_cost_of_books = books * cost_of_book discount = total_cost_of_books * 0.2 total_cost_of_books_after_discount = total_cost_of_books - discount result = total_cost_of_books_after_discount return result
A recipe for 6 cupcakes requires 1/2 cup of sugar. How much sugar is needed to make 24 cupcakes?
def solve() -> int: sugar_needed = 0.5 * 4 result = f"{sugar_needed} cup(s) of sugar is needed to make 24 cupcakes." result = sugar_needed return result
Lisa spent 18 minutes trying to assemble her new desk, but couldn't find the instructions. She had to spend twice as long searching for them to finally find them. During her first work session at the desk, she spilled coffee twice for 3 minutes each time and her computer froze once for 6 minutes. She spent one and a ha...
def solve() -> int: assembling_time = 18 searching_time = 2 * assembling_time interruptions_time = 2 * 3 + 6 working_time = 1.5 * interruptions_time total_time = assembling_time + searching_time + interruptions_time + working_time result = total_time return resu...
The diagonal of a square is equal to the radius of a circle with area 98. What is the area of the square?
def solve() -> int: radius = (98/3.14)**0.5 diagonal = 2*radius side = diagonal/(2**0.5) area_square = side*side result = area_square return result
Anna 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 6 cups of flour, 3 cups of sugar, 12 eggs, and 1 cup of oil in her pantry. How many cakes can she bake with the ingredients she has?
def solve() -> int: flour_needed = 3 sugar_needed = 2 eggs_needed = 4 oil_needed = 0.5 flour_available = 6 sugar_available = 3 eggs_available = 12 oil_available = 1 cakes_by_flour = flour_available // flour_needed cakes_by_sugar = sugar_available // sugar_needed cakes_by_eggs...
Jasmine has $120 and she wants to buy a skirt that costs her $50. How much money does she have left after buying the skirt, and what percentage of her initial money is left?
def solve() -> int: initial_money = 120 skirt_cost = 50 left_money = initial_money - skirt_cost percent_left_money = left_money*100/initial_money result = (left_money, percent_left_money) return result
The perimeter of a square is 24 inches. What is the length of each side?
def solve() -> int: perimeter = 24 side_length = perimeter / 4 result = side_length return result
John's box of chocolates has enough candies to fill three 12-piece boxes. If he gives away two boxes with 8 pieces each, what percentage of chocolates are left in the box?
def solve() -> int: total_chocolates = 3 * 12 given_away = 2 * 8 left_in_box = total_chocolates - given_away percentage_left = (left_in_box / total_chocolates) * 100 result = percentage_left return result
A restaurant has 8 tables. Each table can seat 4 people. How many customers can the restaurant seat at once?
def solve() -> int: num_tables = 8 num_seats_per_table = 4 total_seating_capacity = num_tables * num_seats_per_table result = total_seating_capacity return result
Mary and Tom purchase two tickets for a concert that costs $18 each. Mary uses a $20 bill and Tom uses his credit card to make the purchase. If Mary saves the change and Tom spends $7.50 on parking, how much money did they spend altogether in dollars and cents?
def solve() -> int: ticket_cost = 18 mary_payment = 20 tom_payment = ticket_cost mary_change = mary_payment - ticket_cost tom_spent = tom_payment + 7.5 total_spent = mary_change + tom_spent result = round(total_spent, 2) return result
Samantha cycled at 12 mph for 45 minutes and then took a break for 25 minutes. Afterwards, she biked at 8 mph for 35 minutes. How far did she travel in total?
def solve() -> int: distance_1 = 12 * (45/60) distance_2 = 8 * (35/60) total_distance = distance_1 + distance_2 result = total_distance return result
Over a course of 3 months, Brenda increased the mileage on her car 13 miles each day. How many total miles did Brenda add to her car over those three months?
def solve() -> int: total_miles = 0 days = 3*30 for day in range(days): total_miles += 13 result = total_miles return result
The length of a rectangle is twice its width. If its perimeter is 24 cm, what is its area?
def solve() -> int: perimeter_rectangle = 24 length_rectangle = perimeter_rectangle / 2 + ((perimeter_rectangle / 2) ** 2 - 4 * (perimeter_rectangle / 2)) ** 0.5 / 2 width_rectangle = perimeter_rectangle / 4 area_rec...
Benjamin has a collection of 120 stamps. He gives 20% of his stamps to his sister, 15% to his brother, and 10% to his friend. How many stamps does he have left?
def solve() -> int: stamps_to_sister = 120 * 0.2 stamps_to_brother = 120 * 0.15 stamps_to_friend = 120 * 0.1 remaining_stamps = 120 - stamps_to_sister - stamps_to_brother - stamps_to_friend result = remaining_stamps return result
Kelly has been working as a software engineer for 16 years. 9 years ago, her colleague Lucy had double the experience as Kelly. If Kevin joined the team when Lucy had 8 years of experience, what is the total number of years of software engineering experience between Kelly, Lucy, and Kevin?
def solve() -> int: kelly_experience = 16 lucy_experience_9_years_ago = (kelly_experience - 9) * 2 lucy_experience = lucy_experience_9_years_ago + 9 kevin_experience = lucy_experience - 8 total_experience = kelly_experience + lucy_experience + kevin_experience result = total_experience retur...