question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
John wants to decrease his weekly spending on dining out. Before decreasing, he used to spend $100 per week. He wants to decrease to 30% less than that total in 180 days and each week he will reduce the amount spent in the week by the same amount. How much does John need to reduce his spending on dining out per week? I...
def solve() -> int: total_spending = 100 reduction_percentage = 30 days = 180 reduction_amount = total_spending * reduction_percentage / 100 reduction_per_week = reduction_amount / (days / 7) result = reduction_per_week total_books = 200 science_fiction_books = 30 ...
10. A company needs to make 500 cups of hot chocolate with 1 litre of milk. If a cup of hot chocolate takes 0.2 litres of milk, how many litres of milk are needed?
def solve() -> int: total_milk = 500 * 0.2 result = total_milk return result
A group of friends went to a theme park. They spent 12 minutes in line for the first ride, 17 minutes on the ride, 8 minutes walking to the next ride, and 20 minutes in line for the second ride. If the group spent a total of 2 hours and 15 minutes in the theme park, how many minutes did they spend enjoying the rides?
def solve() -> int: time_in_park = 2*60+15 time_waiting = 12+17+8+20 time_enjoying = time_in_park - time_waiting result = time_enjoying return result
Ken's car gets 32 miles per gallon. He wants to travel 200 miles. How many gallons of gas does he need?
def solve() -> int: distance = 200 mpg = 32 gallons = distance/mpg result = gallons return result
Anna is organizing a bookshelf. If there are 60 books and she wants to have 4 books per shelf, how many shelves does she need to use?
def solve() -> int: books = 60 books_per_shelf = 4 shelves = books/books_per_shelf result = shelves return result
You bike three times as fast as Ms. Lee, and Ms. Lee took 1.5 hours to bike to the park. If your destination is 4 times further away than the park Ms. Lee biked to, how many hours will it take you to get there?
def solve() -> int: ms_lee_speed = 1 you_speed = 3 * ms_lee_speed ms_lee_distance = 1.5 * ms_lee_speed you_distance = 4 * ms_lee_distance you_time = you_distance / you_speed result = you_time return result
Student: Mandy, Susan's friend, also earned $600 from babysitting over the summer. Mandy spent $200 on a new phone and half of what was left on a concert ticket. How much money did Mandy have left?
def solve() -> int: earnings = 600 phone_cost = 200 concert_cost = (earnings - phone_cost) / 2 result = earnings - phone_cost - concert_cost return result
Samantha wants to buy enough pencils for her classmates. The store sells pencils in packs of 10. If Samantha has 36 classmates, how many packs of pencils does she need to buy?
def solve() -> int: classmates = 36 pencils_per_pack = 10 total_pencils_needed = classmates * pencils_per_pack packs_needed = total_pencils_needed // pencils_per_pack result = packs_needed return result
A recipe calls for 3/4 cup of sugar for every 2 cups of flour. If you have 8 cups of flour, how much sugar should you use?
def solve() -> int: flour = 8 sugar_per_cup = 3/8 sugar_needed = sugar_per_cup * flour result = round(sugar_needed, 2) return result
David purchased 2 packs of gum at $4 each, and he gave one pack to his brother. How much did David spend on gum for himself?
def solve() -> int: pack_price = 4 num_packs = 2 num_packs_given = 1 total_spent = pack_price * num_packs spent_for_himself = total_spent - (pack_price * num_packs_given) result = spent_for_himself return result
There are 20 books in a library, 3 of them have already been checked out. How many books remain in the library?
def solve() -> int: numberOfBooks = 20 numberCheckedOut = 3 result = numberOfBooks - numberCheckedOut return result
Tom's dad gives him a bag of 12 chips for snack on Tuesdays and Fridays every week. If there are 35 weeks of school and Tom missed 2 Tuesdays and 3 Fridays, how many chips did he eat this school year?
def solve() -> int: chips_per_bag = 12 weeks_in_school = 35 tuesdays_missed = 2 fridays_missed = 3 snack_days = (2 * weeks_in_school) - (tuesdays_missed + fridays_missed) total_chips_eaten = snack_days * chips_per_bag result = total_chips_eaten ret...
Bob sells sandwiches for $5 each. If a slice of bread costs $0.25, a piece of lettuce costs $0.15, a slice of turkey costs $0.50, and a slice of cheese costs $0.30, how much does it cost Bob to make one sandwich?
def solve() -> int: bread_cost = 0.25 lettuce_cost = 0.15 turkey_cost = 0.50 cheese_cost = 0.30 sandwich_cost = bread_cost + lettuce_cost + turkey_cost + cheese_cost result = sandwich_cost return result
Fred sold some books and made a total of $52. He got $20 for a romance book and $10 for a mystery book, how much money did he make for the sci-fi book?
def solve() -> int: totalEarned = 52 romanceBook = 20 mysteryBook = 10 totalGivenAway = romanceBook + mysteryBook result = totalEarned - totalGivenAway return result
If Sarah picked x apples in one hour, and she has to pick 48 apples, how many hours will it take her?
def solve() -> int: x = 5 total_apples = 48 hours = total_apples / x result = hours return result
Student: Kevin earns 10% per hour of what he worked. If he worked for 3 hours and earned $90, what is his hourly rate?
def solve() -> int: hours_worked = 3 earnings = 90 hourly_rate = earnings / (hours_worked * 0.1) result = hourly_rate return result
If it takes 20 minutes to make 2 pizzas, how many minutes does it take to make 5 pizzas?
def solve() -> int: time_for_2_pizzas = 20 time_per_pizza = time_for_2_pizzas / 2 time_for_5_pizzas = 5 * time_per_pizza result = time_for_5_pizzas return result
A basketball player's free throw shooting percentage is 80%. If he attempts 20 free throws per game, on average, how many does he make per game?
def solve() -> int: attempts = 20 percentage = 0.8 makes = attempts*percentage result = makes return result
A gym membership costs $50 per month plus an additional $3 for each workout. If someone goes to the gym 20 times a month, how much will they pay in total for their membership fees?
def solve() -> int: membership_fee = 50 cost_per_workout = 3 number_of_workouts_per_month = 20 total_fee = membership_fee + (cost_per_workout * number_of_workouts_per_month) result = total_fee return result
Jack and Lily are both climbing a tall tree. Jack can climb at a rate of 11 feet/minute and Lily can climb at a rate of 8 feet/minute. After 9 minutes, how much higher is Jack than Lily?
def solve() -> int: jack_rate = 11 lily_rate = 8 time = 9 jack_height = jack_rate * time lily_height = lily_rate * time height_difference = jack_height - lily_height result = height_difference return result
A store has a revenue of $5000. If the store's expenses totaled 3/5 of its revenue, calculate the profit the store made.
def solve() -> int: revenue = 5000 expenses = revenue * 3/5 profit = revenue - expenses result = profit return result
A school has 500 students. 55% of them are girls. How many boys are there in the school?
def solve() -> int: total_students = 500 girls_percentage = 0.55 girls = total_students * girls_percentage boys = total_students - girls result = boys return result
Mr. Batsis bought a dress shirt and a pair of pants. The pair of pants cost $35 and the dress shirt cost twice the same amount as the pants. How much did the dress shirt cost?
def solve() -> int: pants_cost = 35 shirt_cost = 2 * pants_cost result = shirt_cost return result
Eight students and two teachers go on a field trip and spend $12 on snacks. If the total cost of the trip is $100, and each teacher's ticket costs $20, what is the cost of each student's ticket?
def solve() -> int: students = 8 teachers = 2 total_cost = 100 snacks_cost = 12 teacher_ticket_cost = 20 students_ticket_cost = total_cost - (teachers * teacher_ticket_cost) - snacks_cost cost_per_student = students_ticket_cost / students result = cost_per_student retu...
Liam needs 20 bolts to fix his bike. If he buys twice as many more to have on hand, and separates them evenly among 4 different boxes, how many bolts will be in each box?
def solve() -> int: bolts_needed = 20 extra_bolts = bolts_needed * 2 total_bolts = bolts_needed + extra_bolts boxes = 4 bolts_per_box = total_bolts // boxes result = bolts_per_box return result
Owen is organizing his digital music collection and wants to clear out some songs. He deletes 75 songs, but then finds 40 more. Later, he deletes 25 more songs and downloads 10 new ones. If he ends up with 50 songs, how many songs did he start with in his collection?
def solve() -> int: x = 0 x -= 75 x += 40 x -= 25 x += 10 result = x - 50 return result
``` A rectangle has a length of 8cm and a width of 4cm. What is the area of the rectangle?
def solve() -> int: length = 8 width = 4 area = length * width result = area return result
A restaurant served 100 meals yesterday and doubled the amount today. How many meals did the restaurant serve in total?
def solve() -> int: yesterday = 100 today = yesterday * 2 total = yesterday + today result = total return result
Henry needs to order 5 monogrammed backpacks for his children. Each backpack costs $35 with a 10% discount and customization costs $8 per backpack. How much will Henry spend on the backpacks?
def solve() -> int: backpack_cost = 35 discount = 0.10 customization_cost = 8 quantity = 5 total_cost = (backpack_cost - (backpack_cost * discount) + customization_cost) * quantity result = total_cost return result
A tutoring center offers classes for math and English. They have a rule that for every math class you take, you must take 2 English classes which cost 1/4 the price of the math classes. If they sold 10 math classes and earned $200, how much do the English classes cost?
def solve() -> int: math_classes = 10 english_classes = math_classes * 2 math_price = 200 / math_classes english_price = math_price / 4 english_cost = english_classes * english_price result = english_cost return result
At a birthday party, there were 9 balloons. 6 of the balloons were green, and the others were red. How many red balloons were there?
def solve() -> int: n_balloons = 9 n_balloons_green = 6 result = n_balloons - n_balloons_green return result
A farmer harvested 1200 kilograms of wheat in a season. If he sold 25 percent of the wheat at 5 dollars per kilogram and the rest at 4 dollars per kilogram, calculate his total revenue from the wheat sales.
def solve() -> int: higher_price_wheat = 1200 * 0.25 lower_price_wheat = 1200 - higher_price_wheat higher_price_revenue = higher_price_wheat * 5 lower_price_revenue = lower_price_wheat * 4 total_revenue = higher_price_revenue + lower_price_revenue result = total_revenue return result
A train traveled 360 km in 4 hours. If it had traveled 40 km/h slower, it would have taken 1 hour longer to complete the journey. What was the speed of the train?
def solve() -> int: distance = 360 time1 = 4 time2 = 5 speed1 = distance / time1 speed2 = distance / time2 difference = speed1 - speed2 speed = (speed1 + speed2) / 2 result = speed return result
Hugh has 14 shelves of books in his bedroom. Each shelf has the same amount of books, and the total number of books in the bedroom is 126. How many books are in each shelf?
def solve() -> int: number_of_shelves = 14 total_number_of_books = 126 number_of_books_in_each_shelf = total_number_of_books // number_of_shelves result = number_of_books_in_each_shelf return result
A ball is thrown upward from the ground with an initial velocity of 30 meters per second. How long will it take to reach the highest point of its trajectory? (neglect air resistance and assume the acceleration due to gravity is 9.81 m/s^2).
def solve() -> int: v0 = 30 g = -9.81 t_peak = -v0/g result = t_peak return result
Kurt wants to build a back patio in his backyard. He needs five boards to build the structure and each board costs $7.00. How much will the boards cost?
def solve() -> int: result = 0 number_of_boards = 5 cost_of_each_board = 7 cost_of_boards = number_of_boards * cost_of_each_board result = cost_of_boards return result
Jane drove 28 miles to the gym. After her workout, she drove to the grocery store which was 5 miles away. Then, she drove 15 miles back home. How many miles did Jane drive in all?
def solve() -> int: distance_to_gym = 28 distance_to_store = 5 distance_home = 15 total_distance = distance_to_gym + distance_to_store + distance_home result = total_distance return result
Maya wants to buy a necklace that costs $180. She has a coupon that gives her a 15% discount on the original price. She also has to pay a 7% sales tax on the final price. How much does she have to pay for the necklace?
def solve() -> int: discount = 0.15 * 180 price_before_tax = 180 - discount tax = 0.07 * price_before_tax total_price = price_before_tax + tax result = f"Maya has to pay ${total_price:.2f} for the necklace." return result
A family drove through three different states on a road trip. They spent 2 hours in Georgia, 4 hours in South Carolina, and 6 hours in North Carolina. The next day, they drove an additional hour in each state they passed through the previous day. How long did the family spend in each state over the two days?
def solve() -> int: georgia_hours = 2 south_carolina_hours = 4 north_carolina_hours = 6 georgia_hours += 1 south_carolina_hours += 1 north_carolina_hours += 1 total_hours_day1 = georgia_hours + south_carolina_hours + north_carolina_hours georgia_hours += 1 south_caroli...
A pizza parlor charges $12.50 for a large pizza. They sold 15 large pizzas tonight. How much money did they make?
def solve() -> int: pizzaprice = 12.50 pizzasold = 15 total = pizzaprice * pizzasold result = total return result
A company manufactures 500 pens each day. 5% of these pens fail a quality control check and are discarded. How many pens are likely to pass the quality control check?
def solve() -> int: pens = 500 fail_percent = 5 pass_pens = pens - ((fail_percent/100)*pens) result = pass_pens return result
A farmer has 550 chickens and ducks on his farm. If the number of ducks is 120 less than the number of chickens, calculate how many ducks the farmer has.
def solve() -> int: total_animals = 550 chickens = (total_animals + 120) / 2 ducks = total_animals - chickens result = ducks return result
A recipe calls for 3 1/2 cups of flour. If you only have 1 3/4 cups, how much more do you need?
def solve() -> int: needed_flour = 3 + 1/2 - 1 - 3/4 result = needed_flour return result
Emma and Olivia are in a skateboarding competition. Emma completed four tricks and received scores of 8, 7, 8, and 6. Olivia completed five tricks and received scores of 7, 9, 8, 7, and 8. The next round is worth the same amount of points as all the previous rounds combined. If the highest possible score is 10, what is...
def solve() -> int: emma_scores = [8, 7, 8, 6] olivia_scores = [7, 9, 8, 7, 8] emma_total = sum(emma_scores) olivia_total = sum(olivia_scores) combined_total = (len(emma_scores) + len(olivia_scores)) * max(emma_scores + olivia_scores) min_score = combined_total - emma_to...
If two sides of a right triangle are 3 and 4, what is the length of the hypotenuse?
def solve() -> int: side_1 = 3 side_2 = 4 hypotenuse = ((side_1**2) + (side_2**2))**(1/2) result = hypotenuse return result
Student: A train travels 840 miles in 14 hours. If the train travels at a constant speed, how far will it travel in 6 hours?
def solve() -> int: distance_traveled = 840 time_traveled = 14 time_to_travel = 6 speed = distance_traveled / time_traveled distance_in_6_hours = speed * time_to_travel result = distance_in_6_hours return result
Student: A car is calculating its gas mileage during a trip. It starts with a full tank of 15 gallons and has to refuel after 270 miles. If the car's gas tank capacity is 18 gallons, what is the car's gas mileage in miles per gallon (MPG)?
def solve() -> int: start_gallons = 15 end_miles = 270 tank_capacity = 18 total_miles = end_miles - 0 total_gallons = start_gallons + tank_capacity - start_gallons result = total_miles / total_gallons return result
A pet store has 120 animals. Half of the animals are dogs, and one-fifth of the dogs are poodles. If there are 6 poodles, how many non-dog animals are in the store?
def solve() -> int: total_animals = 120 dogs = total_animals / 2 poodles = dogs / 5 poodles = 6 non_dog_animals = total_animals - dogs non_dog_animals = non_dog_animals - poodles result = non_dog_animals return result
Fiona has 2000 feet of fence to enclose a square field. If each square foot of fence costs $5, how much will it cost to fence the field?
def solve() -> int: total_fence = 2000 length = total_fence / 4 area = length ** 2 cost = area * 5 result = cost return result
Ben and his classmates are selling cookies for a fundraiser. Each box of cookies costs $5 and contains 12 cookies. Ben sells 3 boxes and gives away 4 cookies as samples. His classmates sell 2 boxes each and give away 2 cookies as samples each. How much money did they raise in total?
def solve() -> int: box_price = 5 box_cookies = 12 ben_boxes = 3 ben_samples = 4 classmates_boxes = 2 classmates_samples = 2 classmates_number = 4 ben_sold = ben_boxes * box_cookies - ben_samples ben_money = ben_sold * box_price / box_cookies classmate_sold...
Kim has 15 shelves in her library, filled with books. Each shelf has 8 rows of books with 3 books in each row. How many books does Kim have in her library?
def solve() -> int: totalBooks = 0 for shelf in range(15): for row in range(8): totalBooks += 3 result = totalBooks return result
A car rental company charges a base rate of $70 per day, plus $0.35 per mile. If Steven rented a car for 4 days and drove 600 miles, how much would he have to pay?
def solve() -> int: base_rate = 70 days_rented = 4 miles_driven = 600 cost_per_mile = 0.35 total_cost = (base_rate*days_rented) + (miles_driven*cost_per_mile) result = total_cost return result
Lila aims to read 200 pages of a book. On Monday, she was only able to read 50 pages so she decided to make up for the rest the next day. Unfortunately, she only read 80 pages on Tuesday. How many more pages should Lila read on Wednesday to complete her goal?
def solve() -> int: pages_goal = 200 pages_read_monday = 50 pages_read_tuesday = 80 pages_remaining = pages_goal - (pages_read_monday + pages_read_tuesday) result = pages_remaining return result
A farmer has 120 chickens and 80 cows. He sells each chicken for $8 and each cow for $200. He spends $50 per day on animal feed. How much profit does he make in a week, assuming he sells all his animals?
def solve() -> int: chicken_revenue = 120 * 8 cow_revenue = 80 * 200 total_revenue = chicken_revenue + cow_revenue feed_cost = 50 * 7 profit = total_revenue - feed_cost result = profit return result
John and his mom have 10 apples in total. John has twice as many apples as his mom. How many apples does John have?
def solve() -> int: john_mom_ratio = 2 total_apples = 10 mom_apples = total_apples / (john_mom_ratio + 1) john_apples = mom_apples * john_mom_ratio result = john_apples return result
A school has 70 students in the science club and 40 students in the math club. There are 10 students who are members of both clubs. How many students are there in the school clubs in total?
def solve() -> int: science_club = 70 math_club = 40 both_clubs = 10 total_students = science_club + math_club - both_clubs result = total_students return result
san works at a grocery store as a cashier. On Monday, she sold $100 worth of groceries, on Tuesday she sold $120 worth, and on Wednesday she sold $85 worth. If the grocery store takes a flat 10% commission on sales, how much money does Susan earn in three days?
def solve() -> int: monday_sales = 100 tuesday_sales = 120 wednesday_sales = 85 total_sales = monday_sales + tuesday_sales + wednesday_sales commission_rate = 0.1 commission = total_sales * commission_rate total_earnings = total_sales - commission result = total_earnings return resu...
Student: A store has 390 pens in stock. The store sold 176 pens on Monday and then 43 pens on Tuesday. How many pens are left in stock?
def solve() -> int: pens_in_stock = 390 pens_sold_on_monday = 176 pens_sold_on_tuesday = 43 pens_left_in_stock = pens_in_stock - pens_sold_on_monday - pens_sold_on_tuesday result = pens_left_in_stock return result
Student: On Monday, a company produces 50 units of product A. Each day, the number of units produced increases by 5. On Friday, they produce 80 units. How many units of A did the company produce in total from Monday to Friday?
def solve() -> int: units_produced_on_monday = 50 increase_per_day = 5 units_produced_on_friday = 80 total_units_produced = units_produced_on_monday + (increase_per_day * 4) + units_produced_on_friday result = total_units_produced return result
Alex's party has 30 balloons. Mia's party has 1/3 as many balloons as Alex's party. Ava's party has 1/10 as many balloons as Mia's party. How many balloons does Ava's party have?
def solve() -> int: alex_balloons = 30 mia_balloons = alex_balloons * (1/3) ava_balloons = mia_balloons * (1/10) result = ava_balloons return result
Student: If it takes Sam 2 hours to mow a lawn and it takes Tom 3 hours to mow the same lawn, how long will it take them to mow the lawn if they work together?
def solve() -> int: sam_time = 2 tom_time = 3 sam_rate = 1/sam_time tom_rate = 1/tom_time combined_rate = sam_rate + tom_rate combined_time = 1/combined_rate result = combined_time return result
A trade company exports products to other countries. Every month, the company earns $10,000 from China, $8,000 from Japan, and $6,000 from Vietnam. If the company exported for 10 months, how much money did the company earn overall?
def solve() -> int: monthly_earnings_from_china = 10000 monthly_earnings_from_japan = 8000 monthly_earnings_from_vietnam = 6000 total_month_count = 10 total_earnings = (monthly_earnings_from_china + monthly_earnings_from_japan + monthly_earnings_from_vietnam) * total_month_count result = total_...
A florist sells rose bouquets for $50 per bouquet. The florist has 100 roses, and each bouquet requires 10 roses. If the florist also has to pay $200 for rent, how many bouquets can the florist sell to make a profit?
def solve() -> int: roses_available = 100 roses_per_bouquet = 10 rent = 200 price_per_bouquet = 50 max_bouquets = roses_available // roses_per_bouquet total_bouquet_cost = max_bouquets * roses_per_bouquet total_sales = max_bouquets * price_per_bouquet profit = total_sales - total_bo...
Jack and Zoey have to jog a total of 3500 meters in their fitness class. The track they are using is 400 meters long. If they have already completed 5 laps each, how many more laps do they need to go to finish the total distance?
def solve() -> int: track_length = 400 total_distance = 3500 completed_laps = 5 distance_completed = completed_laps * track_length distance_remaining = total_distance - distance_completed laps_remaining = distance_remaining / track_length result = laps_remaining return res...
A rectangle has a length of 15 cm and a width of 10 cm. What is its perimeter?
def solve() -> int: length = 15 width = 10 perimeter = 2 * (length + width) result = perimeter return result
Gordon has $4000 to buy gifts for his family. He spends the same amount of money on each of his 5 siblings and his parents. How much does Gordon spend on each family member?
def solve() -> int: total_funds = 4000 number_of_family_members = 5+2 amount_spent_per_member = total_funds / number_of_family_members result = amount_spent_per_member return result
Noah has 60 marbles in his jar, which is 20% of the number of marbles he has in his box. How many marbles does Noah have in his jar and box altogether?
def solve() -> int: jar = 60 box = jar / 0.2 total = jar + box result = total return result
Sarah is building a wall around her garden that is 12 feet by 16 feet. She needs to leave 2 feet on each side for a garden pathway. How much material will she need to buy to build the wall?
def solve() -> int: length = 16 width = 12 pathway = 2 new_length = length + (2 * pathway) new_width = width + (2 * pathway) perimeter = 2 * (new_length + new_width) material = perimeter * 0.5 result = material return result
There are 24 students in a class. If the class is divided into 4 equal groups, how many students are in each group?
def solve() -> int: num_students = 24 num_groups = 4 students_per_group = num_students / num_groups result = students_per_group return result
There are 24 students in a class. If 10 are absent today, 12 are present and 6 are not sure, how many students are present today?
def solve() -> int: num_students = 24 num_absent = 10 num_present = 12 num_not_sure = 6 result = num_present + num_not_sure return result
A car rental company charges $20 per day for a car rental. If Ben rents a car for 5 days, but uses a discount code that takes 10% off the total price, how much will he pay in total?
def solve() -> int: days = 5 price_per_day = 20 total_price = days*price_per_day*0.9 result = total_price return result
In a class of 45, 40% of the students are absent and of those present, 60% are girls. If there are 5 boys present, how many girls are present?
def solve() -> int: absent = 0.4 * 45 present = 45 - absent boys_present = 5 girls_present = present * 0.6 result = girls_present return result
A rectangular swimming pool has a length of 20 meters and a width of 10 meters. If the pool is filled with water to a depth of 2 meters, what is the volume of the water in the pool in cubic meters?
def solve() -> int: length = 20 width = 10 depth = 2 volume = length * width * depth result = volume return result
Student: Four friends went to a restaurant and ordered pizza. If the total cost of the pizza was $60 and they decided to split the cost evenly, how much did each person pay?
def solve() -> int: total_cost = 60 friends = 4 cost_per_person = total_cost / friends result = cost_per_person return result
8. Mary can shoot 10 arrows in 1/2 the time that Mark can. Mark can shoot 5 arrows in 20 seconds. How many arrows can Mary shoot in 10 seconds?
def solve() -> int: mark_speed = 5/20 mary_speed = mark_speed * 2 mary_time = 10 marry_arrows = mary_speed * mary_time result = marry_arrows return result
A restaurant sells meals at $20 per person. The restaurant has 100 seats. If the restaurant is full on a given night, how much money will they make?
def solve() -> int: meal_price = 20 num_seats = 100 total_revenue = meal_price * num_seats result = total_revenue return result
In a store, there were 25 apples. If the store sold twice as many oranges as apples, and 5 more bananas than oranges, how many fruits were sold in the store?
def solve() -> int: apples = 25 oranges = 2*apples bananas = oranges + 5 total_fruits = apples + oranges + bananas result = total_fruits return result
A triangle has perimeter 24 units and its sides have the ratio of 2:3:4. What is the length of the shortest side?
def solve() -> int: perimeter = 24 ratio = 2 + 3 + 4 shortest_side = (2/9)*perimeter result = shortest_side return result
Janey had achieved scores of 93, 79, and 82 on her 3 tests. What score should she get on the fourth to get an average of 85?
def solve() -> int: score1 = 93 score2 = 79 score3 = 82 total = score1 + score2 + score3 required_score = (4 * 85) - total result = required_score return result
For every loaf of bread that Joel bakes, he has to make the dough, let it rise for 2 hours and then bake the bread for 45 minutes. He then has to add a layer of seeds on top and let it cool down for 1 hour. Then he has to slice the bread and let it cool down for an additional 30 minutes. If it takes him 4 hours to make...
def solve() -> int: dough_time = 2 bake_time = 0.75 seed_time = 1 slice_time = 0.5 total_time = 4 num_loaves = 4 total_bake_time = num_loaves * (dough_time + bake_time) total_cool_time = num_loaves * (seed_time + slice_time) dough_and_rise_time = (total_time - total_ba...
If there are two more books added to the eighteen books on the shelf, the new number of books on the shelf will be three-fourths the number of books that Tom has on his bookshelf. How many books does Tom have in his bookshelf? There are 50 students in a school play on Monday and 3 times as many on Tuesday. How many stu...
def solve() -> int: books_on_shelf = 18 books_added = 2 total_books_on_shelf = books_on_shelf + books_added tom_books = (4/3) * total_books_on_shelf monday_students = 50 tuesday_students = 3 * monday_students wednesday_students = monday_students + tuesday_studen...
A farmer has a rectangular field that is 40 meters long and 30 meters wide. He wants to fence the field with a wire that costs $10 per meter. He also wants to leave a gap of 2 meters on each side for a gate. How much will the fence cost him?
def solve() -> int: length = 40 width = 30 cost = 10 gap = 2 perimeter = 2 * (length + width) adjusted_perimeter = perimeter - 4 * gap result = adjusted_perimeter * cost return result
In a bookstore, there are 5 types of books. They sell mystery books three times as often as romance books, and thriller books twice as much as horror books. The romance books sell half as much as the horror books. If they sold 8 horror books today, how many mystery books did they sell?
def solve() -> int: horror_books = 8 romance_books = horror_books / 2 mystery_books = 3 * romance_books thriller_books = 2 * horror_books result = mystery_books return result
===== Alex, Bob and Charlie are sharing cookies. Alex eats 4 cookies. Bob eats 3 more cookies than Alex. Charlie eats 2 less cookies than Bob. If they start with 24 cookies, how many cookies are left?
def solve() -> int: alex = 4 bob = alex + 3 charlie = bob - 2 cookies_eaten = alex + bob + charlie cookies_start = 24 cookies_left = cookies_start - cookies_eaten result = cookies_left return result
A store has 250 shirts. They sold 98 shirts on Monday and 64 on Tuesday. How many shirts are left in the store?
def solve() -> int: shirts_left = 250 - 98 - 64 result = shirts_left return result
Sophia has a rose garden with 40 roses. 60% of the roses are red and 40% are yellow. If each red rose has 6 petals and each yellow rose has 5 petals, how many petals are there in total?
def solve() -> int: red_roses = 40 * 0.6 yellow_roses = 40 * 0.4 red_petals = red_roses * 6 yellow_petals = yellow_roses * 5 total_petals = red_petals + yellow_petals result = total_petals return result
A recipe calls for 2 cups of sugar to make 24 muffins. If there are 36 muffins needed, how many cups of sugar are required?
def solve() -> int: muffins = 36 cups_sugar_per_muffin = 2/24 total_sugar_required = muffins * cups_sugar_per_muffin result = total_sugar_required return result
Mark is making an apple pie. He has 6 apples, but the recipe calls for 3/4 of an apple per slice and 8 slices per pie. How many more apples does he need to buy?
def solve() -> int: recipe = 3/4 apples = 6 slices_per_pie = 8 total_apples_needed = recipe * slices_per_pie apples_needed = total_apples_needed - apples result = apples_needed return result
A bakery makes 500 muffins every day. Each muffin costs $1.5 to make and sells for $3. The bakery opens from 8:00 a.m. to 4:00 p.m. In the first hour, they sell 20% of the muffins they made. In the second hour, they sell 15% more muffins than in the first hour. In the third hour, they sell 10% less muffins than in the ...
def solve() -> int: muffins = 500 cost = 1.5 price = 3 hours = 8 muffins_sold_1 = muffins * 0.2 muffins_sold_2 = muffins_sold_1 * 1.15 muffins_sold_3 = muffins_sold_2 * 0.9 muffins_sold_4 = muffins_sold_3 * 1.25 muffins_sold_5 = muffins_sold_4 muffins_sold_6 = muffins_sold_5...
- Mr. Kim painted some walls in his house from Monday to Friday. He painted 2/7 of a wall on Monday, 1/4 of a wall on Tuesday, 3/8 of a wall on Wednesday, 0.4 of a wall on Thursday, and 0.25 of a wall on Friday. How many walls did he paint in total from Monday to Friday?
def solve() -> int: monday = 2/7 tuesday = 1/4 wednesday = 3/8 thursday = 0.4 friday = 0.25 total = monday + tuesday + wednesday + thursday + friday whole = int(total) fraction = total - whole numerator = int(fraction * 4) denominator = 4 result = str(whole...
amantha wants to buy a shirt for $15 and a pair of shoes for $40. She has $75 and wants to know how much money she will have left after her purchase.
def solve() -> int: shirt_price = 15 shoe_price = 40 total_cost = shirt_price + shoe_price samantha_money = 75 remaining_money = samantha_money - total_cost result = remaining_money return result
A company has 200 employees. If each employee can produce 5 units per hour, how many units can the company produce in an 8-hour day?
def solve() -> int: num_employees = 200 units_per_hour = 5 hours_per_day = 8 total_units = num_employees * units_per_hour * hours_per_day result = total_units return result
A car travels at a constant speed of 60 miles per hour. How far will it travel in 2.5 hours?
def solve() -> int: speed = 60 time = 2.5 distance = speed*time result = distance return result
Student: Jack runs 6 km on Monday, and increases his distance by 2 km each day. On Friday, he runs 3 times as far as he did on Monday. How many km does Jack run in total in the five days?
def solve() -> int: distance_monday = 6 distance_increase = 2 distance_friday = 3 * distance_monday total_distance = distance_monday + (distance_increase * 4) + distance_friday result = total_distance return result
Jim has 5 pencils. If the number of Sarah's pencils is three less than twice the number of Jim's pencils, what is the number of Sarah's pencils?
def solve() -> int: jim_pencils = 5 sarah_pencils = (2*jim_pencils) - 3 result = sarah_pencils return result
Kevin has 3 pizzas that are each cut into 10 slices. A third of the slices are given away to his friends. Then, half of the remaining slices are given away to his sibling. If Kevin eats 2 slices, how many slices of pizza are left?
def solve() -> int: pizzas = 3 slices_per_pizza = 10 total_slices = pizzas * slices_per_pizza given_away = total_slices // 3 remaining_slices = total_slices - given_away given_away_to_sibling = remaining_slices // 2 remaining_slices -= given_away_to_sibling remaining_slices -= 2 resu...
Rachel has 12 cans of soda and wants to buy twice as many. She wants to divide them into four equal piles. How many cans of soda are in each pile?
def solve() -> int: cans_of_soda = 12 additional_cans = 12 * 2 total_cans = cans_of_soda + additional_cans piles = 4 cans_per_pile = total_cans // piles result = cans_per_pile return result
Ted needs to fill up a swimming pool that has a capacity of 25000 L. He currently has 10000L of water in the pool. How much more water does Ted need to fill up the pool?
def solve() -> int: maximum_capacity = 25000 current_amount = 10000 required_amount = maximum_capacity - current_amount result = required_amount return result
Tyler invested $600 in stocks. In the first week, it gained 10% in value. In the second week, it lost 20% of its current value. After 2 weeks, how much is his investment worth now?
def solve() -> int: investment = 600 investment *= 1.10 investment *= 0.80 result = investment return result
Daniel wants to buy a new phone that costs $800. He has saved $120 already. If he saves $30 per week, how many weeks will it take him to save enough money to buy the phone?
def solve() -> int: total_price = 800 saving_amount_per_week = 30 already_saved = 120 weeks_to_save = (total_price - already_saved) / saving_amount_per_week result = weeks_to_save return result