question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
John and Anna are going to a movie. The admission for John's ticket is 8.50 dollars and Anna's ticket is 5.00 dollars. How much money did they pay in total?
def solve() -> int: john_ticket = 8.50 anna_ticket = 5.00 result = john_ticket + anna_ticket return result
Student: John wants to purchase a new laptop. The laptop he wants costs $800 and is on sale for 15% off. If he also has a $100 coupon, how much will he have to pay for the laptop?
def solve() -> int: laptop_price = 800 discount_rate = 0.15 coupon_value = 100 discount_amount = laptop_price * discount_rate discounted_price = laptop_price - discount_amount final_price = discounted_price - coupon_value result = final_price return result
Student: Jesse can run around a track in 75 seconds. If the track is 800 meters, what is Jesse's average speed in meters per second?
def solve() -> int: time = 75 distance = 800 speed = distance / time result = speed return result
Possible questions and programs: Derek's bike has a flat tire that leaks 10% of its air every hour. If he starts with 100 psi of air pressure in the tire and rides for 3 hours, how much air pressure will be left in the tire?
def solve() -> int: air_pressure = 100 leak_rate = 0.1 hours = 3 for i in range(hours): air_pressure = air_pressure * (1 - leak_rate) result = air_pressure return result
If James needs to fill up a circular swimming pool 8 meters in diameter, how many liters of water does he need?
def solve() -> int: diameter_m = 8 radius_m = diameter_m / 2 radius_cm = radius_m * 100 pool_volume_in_liters = 3.14 * radius_cm * radius_cm * radius_cm / 1000 result = pool_volume_in_liters return result
Rachel saved $1200 and invested 20% of it in mutual funds. She lost 30% of her investments in the stock market. What percentage of her original savings is remaining after the loss?
def solve() -> int: savings = 1200 invested = savings * 0.2 remaining = invested * 0.7 percentage_remaining = remaining / savings * 100 result = percentage_remaining return result
Michael has 18 toy cars in his room. During a move, he lost 8 of them. Later, 1/5 of the remaining cars had missing wheels. How many toy cars does he have left in his room?
def solve() -> int: toy_cars = 18 lost_cars = 8 remaining_cars = toy_cars - lost_cars missing_wheels_cars = remaining_cars / 5 cars_left = remaining_cars - missing_wheels_cars result = cars_left return result
David drives 40 miles to work on Monday and 50 miles on Wednesday. He takes public transportation on Tuesday and Thursday. On Friday, he drives 25 miles to a meeting. If he is paid $0.50 per mile for transportation, how much does he earn this week?
def solve() -> int: distance_worked = 40 + 50 + 25 pay = distance_worked * 0.5 result = pay return result
Student: In twelve years, Sofia will be twice as old as Alex is now. If Alex is 18, what is 7 years less than their average age?
def solve() -> int: alex_age = 18 sofia_age = alex_age * 2 + 12 average_age = (alex_age + sofia_age) / 2 result = average_age - 7 return result
A farmer has 35 chickens. If each chicken lays 5 eggs per week, how many eggs do the chickens lay in 3 weeks?
def solve() -> int: num_chickens = 35 eggs_per_chicken_per_week = 5 weeks = 3 total_eggs = num_chickens * eggs_per_chicken_per_week * weeks result = total_eggs return result
A movie theater charges $10 for a ticket and popcorn cost is $8. If John spent $42, how many tickets did he buy?
def solve() -> int: total_cost = 42 cost_of_popcorn = 8 ticket_price = 10 number_of_tickets = (total_cost - cost_of_popcorn) / ticket_price result = number_of_tickets return result
A construction company has completed 6 out of 10 projects and spent $250,000 so far. If the remaining projects have an average budget of $80,000, how much additional money does the company need to finish all the projects within their original budget of $1,000,000?
def solve() -> int: completed_projects = 6 total_projects = 10 total_budget = 1000000 spent_money = 250000 average_budget = 80000 remaining_projects = total_projects - completed_projects remaining_budget = total_budget - spent_money additional_money_needed = (remaining_projects...
Juan is a waiter at a restaurant that serves breakfast, lunch, and dinner. On average he serves 100 customers each day. One-fourth of these customers order breakfast. Of the remaining orders, one-third are for lunch and the rest are for dinner. Ten customers order steak, which is twice the number of customers who order...
def solve() -> int: total_customers = 100 breakfast_orders = total_customers / 4 remaining_orders = total_customers - breakfast_orders lunch_orders = remaining_orders / 3 dinner_orders = remaining_orders - lunch_orders steak_orders = 10 fish_orders = steak_orders / 2 vegetarian_orde...
John has $5000 in his bank account and wants to save for a new phone that costs $900. If he saves $100 per week, how many weeks will it take him to save for the phone?
def solve() -> int: current_money = 5000 phone_cost = 900 savings_per_week = 100 weeks_to_save = (phone_cost - current_money) / savings_per_week result = weeks_to_save return result
Lucy's company is sued for damages after a faulty product caused a customer to suffer injuries. The customer asks for $100,000 in medical bills and $50,000 in lost wages, and the court decides to award 70% of the requested amount. How much money should Lucy's company pay the customer?
def solve() -> int: medical_bills = 100000 lost_wages = 50000 requested_amount = medical_bills + lost_wages award_percentage = 0.7 amount_awarded = requested_amount * award_percentage result = amount_awarded return result
A hotel charges $100 per night for a room. If a guest stays for 5 nights, how much will they have to pay after being charged a 15% tax?
def solve() -> int: nightly_rate = 100 tax_percent = 0.15 nights_stayed = 5 subtotal = nightly_rate * nights_stayed total = subtotal * (1 + tax_percent) result = total return result
She wants to finish the remaining 10 books in her shelf before the end of the year. How many weeks does she have to read them all?
def solve() -> int: books_per_week = 3/4 remaining_books = 10 weeks_in_year = 52 weeks_needed = remaining_books / books_per_week weeks_left = weeks_in_year - weeks_needed result = weeks_left return result
Ashley is planting a garden. She plants 3 rows of tomatoes with 4 plants in each row, and 2 rows of cucumbers with 6 plants in each row. How many plants did she plant in total?
def solve() -> int: tomato_rows = 3 tomato_plants_per_row = 4 cucumber_rows = 2 cucumber_plants_per_row = 6 total_tomato_plants = tomato_rows * tomato_plants_per_row total_cucumber_plants = cucumber_rows * cucumber_plants_per_row total_plants = total_tomato_plants + total_cucumber_...
Harry needed to buy some items from the store. He purchased 17 items which had a prices of $3 each. He paid with cash and received a 5% discount. How much was the total cost of his items?
def solve() -> int: total_cost = 3 * 17 discount = total_cost * 0.05 final_cost = total_cost - discount result = final_cost return result
-if you are not sure how to use sympy, please read the documentation before attempting the question. https://docs. sympy.org/latest/tutorial/index. html Possible new questions and programs: There were 32 students in a class. A third of the students liked science, but only two-fifths of the science lovers participated i...
def solve() -> int: science_likers = 32 * (1/3) science_participants = science_likers * (2/5) result = science_participants return result
Susan bought 15 boxes of chocolates, each box has 24 pieces. She gave 3 boxes to her friends and ate 2 pieces from each box she kept. How many chocolates does Susan have left?
def solve() -> int: pieces_in_box = 24 boxes_bought = 15 boxes_given = 3 pieces_eaten = 2 * (boxes_bought - boxes_given) chocolates_left = pieces_in_box * (boxes_bought - boxes_given) - pieces_eaten result = chocolates_left return result
What is the value of y if 5y - 7 = 23?
def solve() -> int: equation = '5y - 7 = 23' lhs, rhs = equation.split('=') lhs = lhs.strip() rhs = rhs.strip() const = int(rhs) terms = lhs.split('y') coef = int(terms[0]) y = (const + 7)/coef result = y return result
Every time he goes fishing, Jack catches a fish. After he gets them, he uses the fish to make a sculpture. The sculpture needs 300 fish to finish it. He goes fishing twice a week. If the sculpture is 10% complete, how many weeks has Jack been collecting fish for?
def solve() -> int: total_fish_needed = 300 fish_caught_per_week = 1 weeks_passed = 0 sculpture_completion = 0.1 fish_needed = total_fish_needed * sculpture_completion while fish_needed > 0: fish_needed -= fish_caught_per_week weeks_passed += 1 result = weeks_p...
In an art class, 80 students are trying their hand at painting. Of those 80, 85% also enjoy sketching. Of the students who enjoy sketching, 75% also enjoy sculpting. How many students enjoy painting, sketching, and sculpting?
def solve() -> int: students_total = 80 painting_percentage = 0.85 students_enjoy_painting_and_sketching = students_total * painting_percentage students_enjoy_painting_sketching_and_sculpting = students_enjoy_painting_and_sketching * 0.75 result = students_enjoy_painting_sketching_and_sculpting ...
Ava wants to count the number of trees on her street. It takes her on average 2 minutes to count one tree. She has been counting for 1 hour and 10 minutes. If she got distracted and forgot the number of trees on 4 houses she counted, how many more minutes does she need to finish counting the trees?
def solve() -> int: trees_counted = 0 time_taken = 70 trees_counted = (time_taken / 2) - 4 remaining_time = (trees_counted + 4) * 2 - time_taken result = remaining_time return result
A toy car is priced at $15. If a store sells 3/4 of its inventory, how much revenue did they make?
def solve() -> int: price = 15 inventory = 100 revenue = price * (3/4) * inventory result = revenue return result
In a company, the ratio of male to female employees is 4:3. If there are 84 female employees, how many male employees are there?
def solve() -> int: female_ratio = 3 female_count = 84 male_ratio = 4 male_count = (4/3) * female_count result = male_count return result
Mary has $84 to use for back-to-school shopping. She buys a backpack that costs $24, four notebooks for $8 each, and two pens for $1 each. How much money does Mary have left?
def solve() -> int: total_spent = 24 + (8*4) + (1*2) amount_left = 84 - total_spent result = amount_left return result
Kevin had 9 stickers, 6 magnets, and 3 cards in his collection. He traded 3 stickers, 2 magnets, and 1 card for 4 stickers, 3 magnets, and 2 cards with his friend. He also bought 2 stickers, 1 magnet, and 3 cards at the store. How many items did he have in his collection after the trade and the purchase?
def solve() -> int: before = 9 + 6 + 3 traded_away = 3 + 2 + 1 traded_for = 4 + 3 + 2 bought = 2 + 1 + 3 after = before + traded_for + bought - traded_away result = after return result
Student: Noah sells books, and he earns $2 commission per book. On Monday, he sold 5 books. On Tuesday, he sold 50% more books than on Monday. On Wednesday, he sold 25% less books than on Tuesday. How much commission did he earn in three days?
def solve() -> int: commission = 2 monday = 5 tuesday = monday * 1.5 wednesday = tuesday * 0.75 total = commission * (monday + tuesday + wednesday) result = total return result
Chris has $50 and spends three-fifths of his money on some games. He then spends one-third of the remaining money on buying a console and the remaining money on batteries. How much did the console cost?
def solve() -> int: total_amount = 50 three_fifths = total_amount * 3/5 remaining_amount = total_amount -three_fifths one_third = remaining_amount/3 console_cost = remaining_amount - one_third result = console_cost return result
Student: Stefan earns $10 for every hour he works in the bakery. If he works for 90 hours, how much did he make in total?
def solve() -> int: hours_worked = 90 hourly_wage = 10 total_amount = hours_worked * hourly_wage result = total_amount return result
Student: Nina runs a pottery workshop and charges $15.00 for a two-hour session. If 12 people sign up for the morning session and 8 people sign up for the afternoon session, how much money does she make?
def solve() -> int: charge = 15.00 morning = 12 afternoon = 8 total_income = charge * (morning + afternoon) result = total_income return result
A garden is 5 meters wide and 10 meters long. How much area does the garden cover?
def solve() -> int: width = 5 length = 10 area = length * width result = area return result
Laura has 10 clementines and 4 watermelons. The clementines have 4 seeds per fruit and the watermelons have 11 seeds per fruit. What percentage of Laura's seeds come from the clementines?
def solve() -> int: num_seeds_clementines = 10*4 num_seeds_watermelons = 4*11 total_seeds = num_seeds_clementines + num_seeds_watermelons percentage_clementines = num_seeds_clementines / total_seeds * 100 result = percentage_clementines return result
``` A train goes from New York city to Miami, a distance of 1500 miles. If the train travels at a speed of 60 miles per hour, how long will the journey take in hours?
def solve() -> int: distance = 1500 speed = 60 time = distance/speed result = round(time, 1) return result
Ben is building a fence. He needs 16 wooden planks for each section of the fence. Each plank is 2.5 meters long. He has a 50-meter tape measure. How many sections of the fence can he measure with the tape measure before he has to rewind it?
def solve() -> int: section_length = 16 * 2.5 sections = 50 // section_length result = sections return result
In a class of 30 students, 2/3 of them passed an exam. How many students passed?
def solve() -> int: total_students = 30 passed_percent = 2/3 passed_students = total_students * passed_percent result = passed_students return result
A school has 100 students in the first year, and each year the number of students increases by 10%. How many students are there in the school after 5 years?
def solve() -> int: students = 100 growthRate = 0.1 for i in range(5): students = students + (students * growthRate) result = round(students) return result
Eric gets $90 every day for walking his neighbor's dog. If he saves all the money, how many days does he need to save $900?
def solve() -> int: money_per_day = 90 total_money = 900 days_to_save_all = total_money / money_per_day result = days_to_save_all return result
Student: In the chess tournament, David got five times as many points than Alex, and Alex got twice as many points than Sean. If Sean got 25 points, how many points did David get?
def solve() -> int: sean_points = 25 alex_points = 2 * sean_points david_points = 5 * alex_points result = david_points return result
Cindy collected some seashells from the beach. She found 12 seashells on the first day and 8 more seashells on each of the next three days. She gave 10 seashells to her sister and kept the rest for herself. How many seashells did Cindy have in the end?
def solve() -> int: result = 36 - 10 return result
Charlotte bought 3 items at the store, each costing $23. If Charlotte pays with a credit card that charges 9% interest, how much would her total be?
def solve() -> int: price1 = 23 price2 = 23 price3 = 23 total_price = price1 + price2 + price3 interest = total_price * 0.09 total = total_price + interest result = total return result
Sophia has 30 pencils. She gives away 2 pencils to each of her classmates, until she only has 6 pencils left. How many classmates does Sophia have?
def solve() -> int: pencils = 30 pencils_given = 2 pencils_left = 6 classmates = (pencils - pencils_left) / pencils_given result = classmates return result
Mike has 100 rubber bands. He gives 12 rubber bands to his brother. If he gives his sister four times as many rubber bands as he gave to his brother, how many rubber bands does Mike have left?
def solve() -> int: rubber_bands = 100 rubber_bands -= 12 rubber_bands_left = rubber_bands - (12*4) result = rubber_bands_left return result
Henry purchased six cans of soda for $1.25 each, three bags of chips for $2.50 each, and a box of candy for $4. How much did Henry spend altogether?
def solve() -> int: cans_of_soda = 6 price_of_soda = 1.25 bags_of_chips = 3 price_of_chips = 2.50 box_of_candy = 1 price_of_candy = 4 total_cost = (cans_of_soda * price_of_soda) + (bags_of_chips * price_of_chips) + (box_of_candy * price_of_candy) result = total_cost re...
At the farmer's market, Jack and Jill bought a total of 48 apples. Jill bought three times the number of apples that Jack bought. How many apples did Jill buy?
def solve() -> int: jack_apples = 0 jill_apples = 0 jack_apples = 48 / 4 jill_apples = 3 * jack_apples result = jill_apples return result
A hospital has 1500 employees. If 35% of them work in the emergency room and the rest work in other departments, how many employees work in other departments?
def solve() -> int: total_employees = 1500 er_employees = total_employees * 0.35 other_employees = total_employees - er_employees result = other_employees return result
Monica is trying to calculate the area of a triangle with a base of 10 cm and a height of 6 cm. What is the area of the triangle?
def solve() -> int: base = 10 height = 6 area = 0.5 * base * height result = area return result
Student: Kelly paid $18 for a hat, $24 for a scarf, and $6 less for a pair of gloves than for a hat. She also got a 10% discount on her total purchase. How much did Kelly pay after the discount?
def solve() -> int: hat_price = 18 scarf_price = 24 gloves_price = hat_price - 6 total_price = hat_price + scarf_price + gloves_price discount = total_price * 0.1 final_price = total_price - discount result = final_price return result
Rachel sells jewelry in a store. She had 500 necklaces in the inventory but only 490 left in the evening. She also observed that there were 130 earrings in the inventory but only 120 left in the evening. If she found out that 3 necklaces and 1 earring had defects, how many pieces of jewelry did she sell today?
def solve() -> int: necklaces_start = 500 necklaces_end = 490 defective_necklaces = 3 sold_necklaces = necklaces_start - necklaces_end - defective_necklaces earrings_start = 130 earrings_end = 120 defective_earrings = 1 sold_earrings = earrings_start - earrings_end - defective_earri...
Tom is baking cookies and he needs 2 cups of sugar for every 36 cookies he makes. If he wants to make 240 cookies, how many cups of sugar does he need?
def solve() -> int: sugar_per_cookie = 2/36 total_cookies = 240 total_sugar_needed = sugar_per_cookie * total_cookies result = total_sugar_needed return result
Mark recently bought an air conditioner for $800. The store he bought it from was offering a 10% discount. He was able to get an extra 5% off the discounted price by using his store credit card. What is the final price of the air conditioner?
def solve() -> int: discount1 = 800 * 0.1 discountedvprice = 800 - discount1 discount2 = discountedvprice * 0.05 finalprice = discountedvprice - discount2 result = finalprice return result
Student: Michael works 45 hours a week. If he gets paid $12 per hour for the first 35 hours and $16 per hour for overtime, how much does he earn in a week?
def solve() -> int: hours = 45 regular_rate = 12 overtime_rate = 16 regular_hours = 35 overtime_hours = hours - regular_hours regular_pay = regular_rate * regular_hours overtime_pay = overtime_rate * overtime_hours total_pay = regular_pay + overtime_pay result = total_pay ...
Jack whips up 500 milkshakes daily at the diner. If he works for 8 hours a day, how many milkshakes will he make per hour?
def solve() -> int: milkshakes_per_day = 500 hours_per_day = 8 milkshakes_per_hour = milkshakes_per_day / hours_per_day result = milkshakes_per_hour return result
``` A bag of candy has 100 pieces in total, with 30 pieces being chocolate and the rest being other flavors. What percentage of the total candy represents the chocolate pieces?
def solve() -> int: total_candy = 100 chocolate = 30 percent_chocolate = chocolate / total_candy * 100 result = percent_chocolate return result
A factory produces 400 boxes of candy per hour. How many boxes of candy can the factory produce in 5 hours?
def solve() -> int: boxes_per_hour = 400 hours = 5 total_boxes = boxes_per_hour * hours result = total_boxes return result
Tom wants to buy some chips. He received $10 from his older brother and $25 from his sister. If each bag of chips costs $1.50, how many crunches did all the chips have?
def solve() -> int: brother_money = 10 sister_money = 25 cost_per_bag = 1.50 total_money = brother_money + sister_money total_bags = total_money / cost_per_bag total_crunches = total_bags * 100 result = total_crunches return result
Student: A recipe requires 4 eggs for every 3 cups of flour. If you only have 15 eggs, how much flour can you use for the recipe?
def solve() -> int: eggs = 15 flour = 0 flour = eggs * 3 / 4 result = flour return result
Before starting her fitness journey, Mia could lift 50 pounds. Thanks to the help of a personal trainer, she was able to increase that weight by 200 pounds. She then received a strength-boosting supplement that increased her strength by an additional 500%. How much can she lift now?
def solve() -> int: initial_weight = 50 trainer_boost = 200 total_weight = initial_weight + trainer_boost supplement_boost = 5 final_weight = total_weight * supplement_boost result = final_weight return result
A car travels 250 miles in 5 hours. If it maintains the same speed, how long will it take the car to travel 500 miles?
def solve() -> int: distance_1 = 250 time_1 = 5 speed = distance_1 / time_1 distance_2 = 500 time_2 = distance_2 / speed result = time_2 return result
A group of friends went out to eat and the bill was $85. If they decide to split it equally and include a 15% tip, how much will each person have to pay?
def solve() -> int: total_bill = 85 num_people = 5 tip_rate = 0.15 total_with_tip = total_bill * (1 + tip_rate) per_person_price = total_with_tip / num_people result = per_person_price return result
At a weekly farmer's market, 15 produce stands open up each week. Each stand is offering 10 different types of vegetables. How many total types of vegetables are being sold?
def solve() -> int: produce_stands = 15 vegetables = 10 total_vegetables = produce_stands * vegetables result = total_vegetables return result
Tom needs to pick up his sister who is living 180 miles away. If he drives at a rate of 55mph and takes a 30 minute lunch break and two 10 minute bathroom breaks, how long will it take him to get there?
def solve() -> int: distance = 180 speed = 55 lunch_break = 30 bathroom_breaks = 2 * 10 driving_time = distance / speed total_time = driving_time + lunch_break + bathroom_breaks result = total_time return result
There are 15 cars at a dealership with a sticker price of $25,000. If each car is sold at a 12% discount, what is the total cost of the cars?
def solve() -> int: cars = 15 sticker_price = 25000 discount = 0.12 total_discount = cars*sticker_price*discount total_cost = cars*sticker_price - total_discount result = total_cost return result
Emma attends a combined undergraduate and Ph. D program. It takes 3 years to finish the BS and 5 years to finish the Ph.D. If Emma had one-eighth the amount of time to finish, how long does it take for her to finish?
def solve() -> int: time = 3 / 8 + 5 / 8 result = time return result
Elizabeth drove 240km in 3 hours. If she travels at a constant speed, how long will it take her to drive 480km?
def solve() -> int: distance_1 = 240 time_1 = 3 distance_2 = 480 speed = distance_1/time_1 time_2 = distance_2/speed result = time_2 return result
Jeff will be putting up wallpaper in a hallway that is 7 yards long and 11 feet wide. If each wallpaper comes in a roll that is 10 yards long, how many rolls will Jeff need to buy?
def solve() -> int: wall_length = 7*3 + 11 roll_length = 10*3 result = wall_length // roll_length return result
cott bought a car for $24,000. He got a rebate of $3,000 dollars. How much did the car cost after the rebate?
def solve() -> int: final_cost = 24000-3000 result = 21000 return result
A pizza shop offers 20% discount on all pizzas. If a pizza costs $10, how much will it cost after the discount?
def solve() -> int: original_price = 10 discount_percentage = 20 discounted_price = original_price * (1 - (discount_percentage/100)) result = discounted_price return result
A fruit vendor bought 50 apples for $30 and sold them at $1.50 each. How many apples does he need to sell to make a 20% profit on his total cost?
def solve() -> int: cost_price = 30 no_of_apples = 50 selling_price = 1.5 total_cost = cost_price total_sales = no_of_apples * selling_price profit = total_sales - total_cost percentage_profit = (profit / total_cost) * 100 selling_price_new = (1.2 * total_cost) / no_of_apples result ...
At Oaktree Middle School, Ethan and Michael have a total of 150 highlighters. Ethan has six times as many highlighters as Michael, minus 30. How many highlighters does Michael have?
def solve() -> int: ethan_highlighters = 150 michael_highlighters = (ethan_highlighters - 30) / 6 result = michael_highlighters return result
A car uses 10 liters of gasoline for every 100 km it travels. If diesel is 20% more efficient, how much diesel does the car need to travel 2000 km?
def solve() -> int: gasoline_consumption = 10 distance = 2000 consumption = gasoline_consumption / 100 diesel_consumption = consumption * 0.8 diesel_needed = distance * diesel_consumption result = diesel_needed return result
A recipe calls for 2 cups of sugar to make 24 cupcakes. If you want to make 48 cupcakes, how much sugar should you use?
def solve() -> int: cups_per_cupcake = 2/24 sugar_needed = cups_per_cupcake * 48 result = f'{sugar_needed} cups of sugar' result = sugar_needed return result
Amy works in a building with 8 floors. She takes the elevator to her floor 5 times a day for 5 days. If each floor is 12 feet tall, how many feet does she travel vertically in total over the week?
def solve() -> int: num_floors = 8 trips_per_day = 5 days_in_week = 5 floor_height = 12 total_trips = num_floors * trips_per_day * days_in_week total_distance = total_trips * floor_height result = total_distance return result
A digital artist buys a new tablet for $800 and a software program for $120. If there is a 8% sales tax on the total purchase and a 15% discount on the tablet, how much will she pay in total?
def solve() -> int: tablet = 800 software = 120 tablet_discount = tablet * 0.15 tablet -= tablet_discount subtotal = tablet + software tax = subtotal * 0.08 total_price = subtotal + tax result = total_price return result
A water tank is filled with 100 liters of water. If the water is being used at a rate of 4 liters per minute, how long will it take for the water to completely finish?
def solve() -> int: time_to_finish = 100/4 result = time_to_finish return result
The value of a green diamond is eight times the value of a blue sapphire. The blue sapphire is also three-fourths the value of a yellow emerald. If the green diamond and yellow emerald are displayed next to each other, what value of the green diamond might the yellow emerald holder see if the green diamond is worth $1,...
def solve() -> int: green_diamond_value = 1600 blue_sapphire_value = green_diamond_value / 8 yellow_emerald_value = (4/3) * blue_sapphire_value result = yellow_emerald_value return result
The cost of a shirt is $25. If John pays with a $50 note, how much change will he receive?
def solve() -> int: shirt_cost = 25 paid_with = 50 change = paid_with - shirt_cost result = change return result
A construction company is building a house. They need to pour concrete for the foundation. If each cubic foot of concrete costs $100 and they need 500 cubic feet, how much will they spend on the concrete itself?
def solve() -> int: cost_per_cubic_foot = 100 cubic_feet_needed = 500 total_cost = cost_per_cubic_foot * cubic_feet_needed result = total_cost return result
Tony has 24 lollipops, if each lollipop costs 0.75 dollars, how much money does he have?
def solve() -> int: total_value = 0 for num_of_lollipop in range(0, 24): total_value = total_value + 0.75 result = total_value return result
A car goes from point A to B at a speed of 50 km/h and returns to point A at a speed of 80 km/h. What is the average speed of the car in the entire trip?
def solve() -> int: time1 = 100 / 50 time2 = 100 / 80 total_time = time1 + time2 total_distance = 200 avg_speed = total_distance / total_time result = round(avg_speed, 2) return result
Maggie has a budget of $80 to spend on groceries. She buys bread for $2.50, milk for $3.25, cheese for $5.50, and eggs for $1.75. How much money does Maggie have left?
def solve() -> int: budget = 80 bread_cost = 2.5 milk_cost = 3.25 cheese_cost = 5.5 egg_cost = 1.75 total_spent = bread_cost + milk_cost + cheese_cost + egg_cost money_left = budget - total_spent result = money_left return result
A right triangle has a base of 6 feet and a height of 8 feet. What is the length of the hypotenuse?
def solve() -> int: hypotenuse = ((6**2) + (8**2)) ** 0.5 result = hypotenuse return result
A restaurant owner needs to order food for the week. On Monday they need 50 pounds of chicken, on Tuesday they need 25 pounds of chicken, on Wednesday they need 30 pounds. If each bag of chicken contains 10 pounds, how many bags should the owner order for the week?
def solve() -> int: total_chicken = 50+25+30 bags = total_chicken/10 result = bags return result
Joseph went to a amusement park with $50. He spends $5 on a parking ticket, $21 buying snacks throughout the day, and $17 buying a souvenir. How much money does Joseph have left?
def solve() -> int: amount_start = 50 spend_tickets = 5 spend_snacks = 21 spend_souvenir = 17 result = amount_start - spend_tickets - spend_snacks - spend_souvenir return result
Here are some possible questions and programs: A bakery sells muffins for $1.50 each, but offers a buy one get one half off deal for every two muffins. John, Amy and Kelly want to buy four muffins each. How much can they save by buying 12 muffins together with the deal rather than buying individually?
def solve() -> int: original_price = 12 * 1.50 discounted_price = 6 * (1.50 + 0.75) savings = original_price - discounted_price result = savings return result
There are 90 chickens in a farm. 2/3 of them lay eggs. How many chickens lay eggs?
def solve() -> int: total_chickens = 90 num_egg_laying_chickens = total_chickens * (2/3) result = num_egg_laying_chickens return result
There are 30 students in a classroom. 1/3 of the students are absent. How many students are present?
def solve() -> int: students = 30 absent = students/3 present = students - absent result = present return result
A gym membership costs $50/month. If a customer pays for 6 months upfront, they get a 10% discount. What is the total cost of a 6-month membership with the discount?
def solve() -> int: membership_price = 50*6 discount_price = membership_price*0.10 total_price = membership_price - discount_price result = "The total cost of a 6-month membership with the discount is $" + str(total_price) + "." return result
A bag contains 50 coins of different values. There are 10 quarters, 15 dimes and the rest are nickels. How much money is in the bag? Give the answer in dollars.
def solve() -> int: nickels = 50 - 10 - 15 total = 25 * 10 + 10 * 15 + 5 * nickels total = total / 100 result = total return result
Student: Larry went to the store and purchased 24 cookies. If he ate 15 cookies, how many cookies are left?
def solve() -> int: cookies_purchased = 24 cookies_eaten = 15 cookies_left = cookies_purchased - cookies_eaten result = cookies_left return result
-Possible questions and programs: Leslie works at a candy store. She earns $50 per day + $1.50 for each pound of candy she sells. On Monday, she sold 36 pounds of candy. How much did she earn that day?
def solve() -> int: fixed_pay = 50 variable_pay = 1.5 candy_sold = 36 total_pay = variable_pay * candy_sold + fixed_pay result = total_pay return result
Student: Chris can bake 12 muffins in an hour. He bakes for a total of 10 hours a week. He improves his recipe and can bake 20% more muffins per hour. However, he also uses 25% more flour per muffin. How much more or less flour does he use a week now? Assume he uses 100 g of flour per muffin before.
def solve() -> int: muffins_per_hour = 12 baking_hours = 10 flour_per_muffin = 100 improvement = 0.2 flour_increase = 0.25 muffins_before = muffins_per_hour * baking_hours muffins_after = (muffins_per_hour * (1 + improvement)) * baking_hours flour_before = muffins_before * flour_p...
Carla has 1,250 candies to divide up among her 7 friends. How many candies will each friend get?
def solve() -> int: total_candies = 1250 num_of_friends = 7 each_candies = total_candies // num_of_friends result = each_candies return result
andy bakes cookies for a bake sale. She has a recipe that makes 36 cookies using 2 cups of flour, 1 cup of sugar, and 0.5 cups of butter. She wants to make 108 cookies for the sale. How much of each ingredient does she need?
def solve() -> int: cookies_per_batch = 36 flour_per_batch = 2 sugar_per_batch = 1 butter_per_batch = 0.5 target_cookies = 108 flour_needed = 0 sugar_needed = 0 butter_needed = 0 ratio = target_cookies / cookies_per_batch flour_needed = ratio * flour_per_batch ...
A box of cookies has 24 chocolate chip cookies and 16 oatmeal raisin cookies. If Maria eats 3 chocolate chip cookies and 2 oatmeal raisin cookies, how many more chocolate chip cookies than oatmeal raisin cookies are in the box now?
def solve() -> int: num_choco_chips = 24 - 3 num_oatmeal = 16 - 2 result = num_choco_chips - num_oatmeal return result
A rectangle has a length of 8 meters and a width of 6 meters. What is the perimeter of the rectangle?
def solve() -> int: length = 8 width = 6 perimeter = 2*length + 2*width result = perimeter return result
Maria wants to buy a gift for her sister and has a budget of $150. If a bracelet costs $50, a necklace $70, and a picture frame $30, can she buy all three items within her budget?
def solve() -> int: bracelet = 50 necklace = 70 frame = 30 budget = 150 total_cost = bracelet + necklace + frame if total_cost <= budget: result = 'Yes' else: result = 'No' return result
Ali bought a box of chocolates that contains 8, 15 and 9 candies respectively. If Ali ate one candy from the first box, two candies from the second box and three candies from the third box, how many chocolates did Ali eat?
def solve() -> int: total_candies_eaten = 1 + 2 + 3 result = total_candies_eaten return result