question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Ana has 60 marbles with 4 colors each. If 1/8 of them have 1 color missing each, how many marbles have all 4 colors?
def solve() -> int: marbles_total = 60 colors_per_marble = 4 missing_color_fraction = 1/8 marbles_missing_color = marbles_total * missing_color_fraction marbles_with_all_colors = marbles_total - marbles_missing_color result = marbles_with_all_colors return result
Question 7. Amy earns a weekly salary of $1,000 and has to pay $800/month for rent. What percentage of her salary does she use for rent?
def solve() -> int: weekly_salary = 1000 monthly_rent = 800 percentage = (monthly_rent/(weekly_salary*4))*100 result = percentage return result
A bag has 8 red, 5 blue, and 3 green balls. If one ball is selected at random, what is the probability of getting a blue ball?
def solve() -> int: total_balls = 8 + 5 + 3 probability_blue = 5 / total_balls result = probability_blue return result
Student: Jamie sold 10 bags of popcorn for $6 each. 4 of the bags were salted and the other 6 were plain. He made a profit of $20. How much did he pay for all of the bags?
def solve() -> int: num_bags = 10 price_per_bag = 6 num_salted_bags = 4 profit = 20 total_price = num_bags * price_per_bag total_price_salted = num_salted_bags * price_per_bag total_price_plain = total_price - total_price_salted cost = total_price - profit cost_salted = cost - total_...
Wendy studied 4 hours yesterday for the test, but her classmate, Michael, studied twelve times as many hours as she did. Today, Wendy wants to catch up and studies six times as many hours as Michael, who studied 10 hours. Who studied more hours in total, and by how many?
def solve() -> int: wendy_hours = 4 michael_hours = 12 * wendy_hours wendy_today_hours = 6 * 10 total_wendy_hours = wendy_hours + wendy_today_hours total_michael_hours = michael_hours + 10 if total_wendy_hours > total_michael_hours: difference = total_wendy_hours - total_michael_hours ...
Sarah had $100 in her bank account but spent 60%. How much money does she have left in her account?
def solve() -> int: money_in_account = 100 percentage_spent = 60 amount_spent = money_in_account * (percentage_spent/100) money_left = money_in_account - amount_spent result = money_left return result
A bag contains 5 red balls, 4 green balls, and 3 blue balls. What is the probability of picking a green ball randomly?
def solve() -> int: total_balls = 12 green_balls = 4 probability = green_balls/total_balls result = probability return result
Student: A class took an exam and the average score was 80. If the top 5% of students received a perfect score of 100, and the remaining students received a lower score, what was the average score of the remaining students?
def solve() -> int: total_students = 100 top_students = 5 perfect_score = 100 average_score = 80 num_top_students = int(total_students * top_students / 100) total_top_score = num_top_students * perfect_score total_remaining_score = (total_students - num_top_students) * average_score aver...
A farmer has 25 chickens and 10 cows. Each chicken lays 4 eggs per week and each egg sells for $0.5. Each cow produces 20 liters of milk per week and each liter sells for $1.5. How much money does the farmer make from selling eggs and milk in a week?
def solve() -> int: egg_count = 25 * 4 egg_revenue = egg_count * 0.5 milk_amount = 10 * 20 milk_revenue = milk_amount * 1.5 total_revenue = egg_revenue + milk_revenue result = total_revenue return result
A silver airplane is three times longer than a yellow helicopter. A yellow helicopter is also 2.5 times shorter than a green military helicopter. If the green military helicopter and silver airplane are parked together, what length of the silver airplane could the military helicopter pilot see if the airplane is 120 fe...
def solve() -> int: yellow_helicopter = 120 / 3 green_military_helicopter = yellow_helicopter / 2.5 length_seen = green_military_helicopter / 3 * 120 result = length_seen return result
Lisa needs to bake 4 times as many cupcakes as cookies. If she needs to bake a total of 80 cupcakes and cookies combined, how many cookies does she need to bake?
def solve() -> int: result = 16 return result
If Michael can clean a room three times faster than Jenna and Jenna takes 45 minutes to clean a room, how much time does it take Michael to clean a room? How much time will they take if they clean the room together?
def solve() -> int: jenna_time = 45 michael_time = jenna_time / 3 together_time = 1 / ((1/jenna_time) + (1/michael_time)) result = together_time return result
A printer can print 60 pages in 5 minutes. How many pages can be printed in 45 minutes?
def solve() -> int: pages_per_time = 60/5 time = 45 pages_printed = pages_per_time*time result = pages_printed return result
A train traveled a distance of 480km in 6 hours. If it maintained the same speed for the next 5 hours, how far did it travel in total?
def solve() -> int: distance_travelled_in_6_hours = 480 time_for_second_leg = 5 speed = distance_travelled_in_6_hours / 6 distance_travelled_in_second_leg = speed * time_for_second_leg total_distance_travelled = distance_travelled_in_6_hours + distance_travelled_in_second_leg result = total_dist...
Emma rides her bike 6 miles every day for 5 days a week. How many miles does she ride in 4 weeks?
def solve() -> int: miles_week = 6 * 5 miles_4weeks = miles_week * 4 result = miles_4weeks return result
If 6 workers can finish a project in 15 days, how many days will it take for 8 workers to finish the same project?
def solve() -> int: workers_1 = 6 days_1 = 15 workers_2 = 8 total_work = workers_1 * days_1 work_per_day = total_work / workers_1 days_2 = total_work / (workers_2 * work_per_day) result = days_2 return result
Jill climbs up 2 flights of stairs. Each flight is 10 feet, and then she climbs a ladder 10 feet in length. How high up did Jill go?
def solve() -> int: stairs = 10 ladder = 10 ht_climbed = stairs * 2 + ladder result = ht_climbed return result
You have a triangle with a base of 12cm and a height of 6cm. What is the area of the triangle?
def solve() -> int: base = 12 height = 6 area = 0.5 * base * height result = area return result
Mary wants to study abroad in Europe for a semester. Tuition fees cost €5000, and she needs €3000 for living expenses. If she has saved €2000, How much money does she need to get before she can go?
def solve() -> int: tuition_fees = 5000 living_expenses = 3000 total_cost = tuition_fees + living_expenses saved_money = 2000 money_needed = total_cost - saved_money result = money_needed return result
A car can travel 100 kilometers on 5 liters of gas. If 600 kilometers of a road trip need to be covered in 8 hours, how many liters of gas must you buy? Assume constant speed and no stops.
def solve() -> int: distance_per_liter = 100 / 5 total_distance = 600 liters = total_distance / distance_per_liter result = liters return result
A group of 10 bees buzz around a garden and are joined by 3 butterflies. Each butterfly brings 5 ants with them and every 3 ants are joined by 2 ladybugs. How many insects are fluttering about the garden?
def solve() -> int: bees = 10 butterflies = 3 ants_per_butterfly = 5 ladybugs_per_ant = 2 total_ants = butterflies * ants_per_butterfly total_ladybugs = total_ants // 3 * 2 total_insects = bees + butterflies + total_ants + total_ladybugs result = total_insects return r...
``` A car travels at a rate of 50 miles per hour, how many miles will it travel in 8 hours?
def solve() -> int: speed = 50 time = 8 distance = speed*time result = distance return result
If a party of 10 people can eat 5 pizzas in 1 hour, how many pizzas will 20 people eat in 2 hours?
def solve() -> int: people_in_party = 10 pizzas_in_1_hour = 5 time_in_hours = 1 pizzas_per_person_per_hour = pizzas_in_1_hour / people_in_party pizzas_for_20_people_in_1_hour = pizzas_per_person_per_hour * 20 pizzas_for_20_people_in_2_hours = pizzas_for_20_people_in_1_hour * 2 resu...
Lily has a jar of jelly beans. She knows that there are 120 jelly beans in the jar, and 25% of them are red, 15% are green, 20% are yellow, and the rest are blue. She wants to give some jelly beans to her friends, so she takes out 10 red ones, 12 green ones, 8 yellow ones, and 6 blue ones. How many jelly beans of each ...
def solve() -> int: total = 120 red = 0.25 green = 0.15 yellow = 0.2 blue = 1 - red - green - yellow red_taken = 10 green_taken = 12 yellow_taken = 8 blue_taken = 6 red_in_jar = total * red green_in_jar = total * green yellow_in_jar = total * yellow b...
A photo frame is 12 inches by 10 inches. If the frame is 1 inch thick, what is the volume of the frame?
def solve() -> int: length = 12 width = 10 thickness = 1 volume = (length + 2 * thickness) * (width + 2 * thickness) * thickness result = volume return result
Mandy has a jigsaw puzzle with 8 pieces. If she has used up 4 pieces, how many pieces are left to finish the puzzle?
def solve() -> int: total_pieces = 8 used_pieces = 4 pieces_to_use = total_pieces - used_pieces result = pieces_to_use return result
A car rental company charges $50 per day for a car rental plus $0.25 per mile driven. If James rents a car for 4 days and drives 200 miles, how much does he pay?
def solve() -> int: rental_days = 4 daily_rental_charge = 50 miles_driven = 200 per_mile_charge = 0.25 total_rental_charge = (rental_days * daily_rental_charge) + (miles_driven * per_mile_charge) result = total_rental_charge return result
Jenny runs around the park for exercise. She starts with a 100-yard sprint before running halfway around the park. When she arrives back at her starting point, she doubles the total distance she has run so far before running half that distance again to complete her route. How far did Jenny run in total?
def solve() -> int: sprint_distance = 100 half_distance = sprint_distance / 2 total_distance = sprint_distance + half_distance + (2 * half_distance) + (0.5 * half_distance) result = total_distance return result
Lisa works as a tour guide and gets paid $50.00 per tour. In one hour, she conducts 3 tours and each person in the tour group leaves her a $10.00 tip. How much money did she make in that hour?
def solve() -> int: tours_per_hour = 3 tour_payment = 50.00 tip_per_person = 10.00 people_per_tour = 1 total_tour_earnings = tours_per_hour * tour_payment total_tip_earnings = tours_per_hour * people_per_tour * tip_per_person total_earnings = total_tour_earnings...
A bag of candy has 24 pieces. Each piece has 5 grams of sugar. How many grams of sugar are in the whole bag of candy?
def solve() -> int: pieces = 24 sugar_per_piece = 5 total_sugar = pieces * sugar_per_piece result = total_sugar return result
Tara sold 150 bracelets at a craft fair for $8 each. She had to pay a booth rental fee of $50 and a commission of 15% of her sales to the organizer. How much profit did she make?
def solve() -> int: sales_amount = 150 * 8 commission_amount = sales_amount * 0.15 total_expenses = 50 + commission_amount profit = sales_amount - total_expenses result = profit return result
A bookstore is closing down and selling all of its books. They have 2500 books that would normally retail for $15 each. They offer a 90% discount and manage to sell 75% of the books. If the bookstore owed $35,000 to their creditors, how much money do they have left after the sale?
def solve() -> int: num_books = 2500 book_price = 15 total_retail_value = num_books * book_price discount_percent = 90 discounted_price = book_price * (100 - discount_percent) / 100 num_sold = num_books * 0.75 total_revenue = num_sold * discounted_price amou...
A hat contains only red, green, and blue balls. The ratio of the red balls to the green balls is 2:1, while the ratio of the green balls to the blue balls is 3:4. If there are 18 green balls in the hat, how many red balls are there?
def solve() -> int: red_green = 2/1 green_blue = 3/4 g = 18 r = (red_green * green_blue * g) / (green_blue + red_green) result = r return result
Alex's toilet uses 7 gallons of water per flush and his household flushes 10 times per day. He replaced it with a toilet that uses 90% less water per flush. How much water did Alex save in February?
def solve() -> int: gallons_per_flush_old = 7 flushes_per_day = 10 days_in_february = 28 gallons_per_flush_new = gallons_per_flush_old * 0.1 water_saved_per_flush = gallons_per_flush_old - gallons_per_flush_new water_saved_per_day = water_saved_per_flush * flushes_per_day water_saved_in...
Student: Jennifer bought 17 apples, 6 oranges and 9 bananas. If she evenly divides the fruits among 5 people, how many more apples will each people receive compared with oranges?
def solve() -> int: apples = 17 oranges = 6 bananas = 9 people = 5 total_fruits = apples + oranges + bananas fruits_per_person = total_fruits // people apples_per_person = apples // people oranges_per_person = oranges // people difference = apples_per_person - oranges_per_person ...
Rachel wants to see a play that begins at 8:30 pm. Her parents agreed if she finished her homework and chores. She will be back home by 5 pm because of her swimming class. Dinner will take 45 minutes, and she needs 30 minutes to finish her homework. She has to wash the dishes, which takes 20 minutes, and clean the bath...
def solve() -> int: swimming_class_end_time = 5 dinner_time = 45 homework_time = 30 dish_washing_time = 20 bathroom_cleaning_time = 15 play_start_time = 20 + 30 + 45 + 15 + 30 + 20 + 15 latest_start_time = play_start_time - (swimming_class_end_time + dinner_time + homework_time + dish_w...
A restaurant has an 8% tax rate. If a customer's bill was $50, how much tax will they have to pay?
def solve() -> int: bill = 50 tax_rate = 0.08 tax = bill * tax_rate result = tax return result
am needs to paint 800 square meters of his house. If the paint covers 12 square meters per liter, how many liters of paint does he need?
def solve() -> int: area = 800 coverage_per_liter = 12 liters_needed = area/coverage_per_liter result = liters_needed return result
Possible new questions and programs are: A girl has 15 candies. She eats one-fifth of them and then shares the rest equally with her two sisters. How many candies does each sister get?
def solve() -> int: candies = 15 candies_eaten = candies * (1/5) candies_remaining = candies - candies_eaten candies_per_sister = candies_remaining / 2 result = candies_per_sister return result
Student: A rectangular garden has a length of 10 meters and a width of 8 meters. What is the perimeter of the garden?
def solve() -> int: length = 10 width = 8 perimeter = 2 * (length + width) result = perimeter return result
The area of a rectangle is 84 square meters. If the length is 12 meters, what is the width?
def solve() -> int: area = 84 length = 12 width = area / length result = f'{width}' result = width return result
Student: A rectangular garden has a length of 25 meters and a width of 15 meters. How much fencing is needed to enclose the garden?
def solve() -> int: length = 25 width = 15 perimeter = 2 * (length + width) fencing = perimeter result = fencing return result
At a grocery store, 8 apples cost $3. How much would 10 apples cost?
def solve() -> int: number_of_apples_1 = 8 price_1 = 3 number_of_apples_2 = 10 result = round(number_of_apples_2/number_of_apples_1*price_1,2) return result
Student: A candy shop sells chocolate bars, lollipops, and gummy bears. A chocolate bar weighs 100 grams and costs $2, a lollipop weighs 25 grams and costs 50 cents, and a gummy bear weighs 10 grams and costs 10 cents. How much do you need to pay for 500 grams of candy if you want to buy the same amount of each type?
def solve() -> int: chocolate_bar_weight = 100 chocolate_bar_price = 2 lollipop_weight = 25 lollipop_price = 0.5 gummy_bear_weight = 10 gummy_bear_price = 0.1 total_weight = 500 num_chocolate_bars = total_weight // chocolate_bar_weight num_lollipops = (total_weight - num_choco...
Grace drinks 70 ounces of lemonade daily. She wants to bring her own drink to the beach and buys a 32-ounce cup. How many times will she need to refill her cup during a day at the beach?
def solve() -> int: lemonade_per_day = 70 cup_size = 32 refills_needed = lemonade_per_day / cup_size result = refills_needed return result
Harold had 13 cups of sugar on his shelf. He added 4 more cups of sugar. How many cups of sugar were on Harold's shelf after he added 4 more?
def solve() -> int: num_cups_sugar_start = 13 num_cups_sugar_added = 4 num_cups_sugar_end = num_cups_sugar_start + num_cups_sugar_added result = num_cups_sugar_end return result
A bookshop has 200 books in stock, and the sales goal for the month is 500 books. If they sell an average of 20 books per day, how many days will it take to meet their goal?
def solve() -> int: booksInStock = 200 salesGoal = 500 booksPerDay = 20 daysNeeded = (salesGoal - booksInStock) / booksPerDay result = daysNeeded return result
A box has 30 more pencils than pens. If there are 20 pens in the box, how many pencils are in the box?
def solve() -> int: pens = 20 pencils = pens + 30 result = pencils return result
A hotel with 200 rooms has an occupancy rate of 75%. If each room generates an average revenue of $150 per night, what is the total revenue for the hotel in one year?
def solve() -> int: num_rooms = 200 occupancy_pct = 0.75 avg_revenue_per_night = 150 num_nights = 365 occupied_rooms = num_rooms * occupancy_pct total_revenue = occupied_rooms * avg_revenue_per_night * num_nights result = total_revenue return result
If a pool can be filled in 4 hours and drained in 6 hours, how long will it take to fill the pool if both the inflow and outflow are open?
def solve() -> int: fill_time = 4 drain_time = 6 combined_time = 1 / (1/fill_time - 1/drain_time) result = combined_time return result
Student: John bought a laptop for $699, a mouse for $25, and a bag for $45. He paid with a thousand-dollar bill. How much change, in dollars, did John get?
def solve() -> int: laptop_price = 699 mouse_price = 25 bag_price = 45 payment = 1000 total_cost = laptop_price + mouse_price + bag_price change = payment - total_cost result = change return result
Lily wants to buy shampoo in bulk. A 30-ounce bottle of shampoo at Costco costs $8. At the local store, a 5-ounce bottle of shampoo costs $2. How much money does she save by buying the bulk bottle?
def solve() -> int: costco_ounce = 30 costco_price = 8 local_ounce = 5 local_price = 2 costco_total_price = costco_price / costco_ounce local_total_price = local_price / local_ounce savings = local_total_price - costco_total_price result = savings return result
Isabella biked 30 miles in the first 4 hours, and then 20 miles in the next 3 hours. What was her average speed in miles per hour?
def solve() -> int: total_miles = 0 total_time = 0 total_miles = total_miles + 30 total_miles = total_miles + 20 total_time = total_time + 4 total_time = total_time + 3 avg_speed = total_miles / total_time result = avg_speed return result
Tina and Tom are fishing. Tina spent 4 hours fishing, took a 30 minute break, and then fished for another 6 hours. Tom fished for 90% of the total fishing time of Tina and then fished for another 90 minutes. How long was their combined fishing time?
def solve() -> int: tina_fishing_time = 4 + 6 tina_break_time = 0.5 tina_total_time = tina_fishing_time + tina_break_time tom_fishing_time = tina_total_time * 0.9 + 1.5 combined_fishing_time = tina_total_time + tom_fishing_time result = combined_fishing_time return r...
If the temperature drops from 80 degrees Fahrenheit to 60 degrees Fahrenheit, what is the percent decrease in temperature?
def solve() -> int: initial_temp = 80 new_temp = 60 percent_change = ((initial_temp - new_temp) / initial_temp) * 100 result = percent_change return result
Oliver and his friend Jack are solving math problems. Oliver solved 150 problems in the first round, while Jack solved 1/2 as many problems as Oliver solved. In the second round, Jack solved 40 more problems than Oliver. If Oliver managed to solve 3/4 times the number of problems he solved in the first round, calculate...
def solve() -> int: oliver_first_round = 150 jack_first_round = oliver_first_round / 2 jack_second_round = oliver_first_round + 40 oliver_second_round = oliver_first_round * 3 / 4 total_problems = oliver_first_round + jack_first_round + oliver_second_round + jack_second_round result = ...
Student: Mary spent 2/5th of her salary on rent and 1/4th of it on groceries. She spent the remaining money on shopping. If her salary was $1400, how much did Mary spend on shopping?
def solve() -> int: salary = 1400 rent = salary * 2/5 groceries = salary * 1/4 remaining_money = salary - rent - groceries shopping = remaining_money result = shopping return result
Emily is a waitress, working 6 hours every day from Monday to Friday and 4 hours every Sunday. If she earns $9 per hour and earns double on Sundays, how much does she earn every week?
def solve() -> int: monday_to_friday_hours = 6 * 5 sunday_hours = 4 hourly_rate = 9 sunday_rate = hourly_rate * 2 monday_to_friday_earnings = monday_to_friday_hours * hourly_rate sunday_earnings = sunday_hours * sunday_rate weekly_earnings = monday_to_friday_earnings + sunday_earni...
Julia bought 2 skirts for $25 each and 3 shirts for $15 each. If she paid with a $100 bill, how much change will she get?
def solve() -> int: skirt_price = 25 shirt_price = 15 total_cost = 2 * skirt_price + 3 * shirt_price change = 100 - total_cost result = change return result
Cindy has 12 stickers. She gives 3 stickers to her friend David and 4 stickers to her friend Emily. She then receives 2 stickers from her friend Frank. How many stickers does she have now?
def solve() -> int: start = 12 give_david = 3 give_emily = 4 after_giving = start - give_david - give_emily receive_frank = 2 after_receiving = after_giving + receive_frank result = after_receiving return result
Ben has eleven boxes of books. Each box weighs 1/13 as much as Emma's box, which weighs 26kg. What is the total weight of all eleven of Ben's boxes?
def solve() -> int: emma_box_weight = 26 ben_box_weight = emma_box_weight / 13 total_weight = ben_box_weight * 11 result = total_weight return result
Student: Sarah is buying office supplies for her new job. She spent $39.50 on pens and $18.75 on paper. If she also buys a stapler for $12.99, how much does she spend in total?
def solve() -> int: pens_price = 39.50 paper_price = 18.75 stapler_price = 12.99 total_price = pens_price + paper_price + stapler_price result = total_price return result
At a library, there are a total of 18 books and 24 magazines. There are 3 bookshelves for every 4 items. Each book currently has 2 books on the shelf and each magazine currently has 1 magazine on the shelf. If each shelf can hold 3 items and all of the shelves are full, how many items are on each shelf?
def solve() -> int: books = 18 magazines = 24 total_items = books + magazines total_shelves = total_items // 3 books_on_shelf = total_shelves * 2 magazines_on_shelf = total_shelves * 1 result = books_on_shelf + magazines_on_shelf return result
Mia wants to average reading for 30 minutes each day for the week. On the first day she read for 20 minutes, on the second day she read for 40 minutes, on the third day she read for 25 minutes, on the fourth day she read for 35 minutes, on the fifth day she read for 30 minutes. How long does she need to read on the six...
def solve() -> int: total_days = 7 goal_time = 30 day1_time = 20 day2_time = 40 day3_time = 25 day4_time = 35 day5_time = 30 total_time = day1_time + day2_time + day3_time + day4_time + day5_time remaining_time = total_days * goal_time - total_time time_per_day = r...
A store has 500 items on sale. 125 of the items are t-shirts, and the rest are hats. If 20% of the hats are red, how many red hats are there?
def solve() -> int: items = 500 tshirts = 125 hats = items - tshirts red_hats = int(hats * 0.2) result = red_hats return result
Alice, Julia, and Megan are trying to buy a vintage watch for $750. Alice has $75, Julia has seven times as much as Alice, but half as much as Megan. How much more money do they need to buy the watch?
def solve() -> int: alice_money = 75 julia_money = 7 * alice_money megan_money = 2 * julia_money total_money = alice_money + julia_money + megan_money money_needed = 750 - total_money result = money_needed return result
A recipe calls for 2.5 cups of flour and 1.25 cups of sugar. If a bag of flour costs $3.50 and a bag of sugar costs $2.00, how much would all the ingredients for the recipe cost?
def solve() -> int: flour_cups_needed = 2.5 sugar_cups_needed = 1.25 flour_cost_per_cup = 3.5/5 sugar_cost_per_cup = 2.0/4 total_cost = (flour_cups_needed * flour_cost_per_cup) + (sugar_cups_needed * sugar_cost_per_cup) result = total_cost return result
A marathon consists of 26.2 miles. If someone runs the marathon in 3 hours and 45 minutes, what is their average pace per mile?
def solve() -> int: def calculate_pace(distance, time): minutes = time.hours * 60 + time.minutes pace = minutes / distance return pace class Time: def __init__(self, hours, minutes): self.hours = hours self.minutes = minutes result = calculate_pace(26....
In 2010 the Milwaukee Bucks won 46 games. The Detroit Pistons won 7 less games than the Bucks. How many games did the Bucks and the Pistons win together?
def solve() -> int: a = 46 b = a - 7 result = a + b return result
Sarah is practicing for a piano competition. She needs to practice a total of 1,000 minutes to be fully prepared. In the first day, she practices for 30 minutes. Each day after that, she practices 10 more minutes than the previous day. After 20 days, how far away from her goal will she be?
def solve() -> int: total_minutes = 1000 first_day_minutes = 30 days_practiced = 20 total_practice_minutes = first_day_minutes for i in range(1, days_practiced): total_practice_minutes += first_day_minutes + i * 10 minutes_left = total_minutes - total_practice_minutes ...
At P’s store, 10 customers bought jeans in the first week, five times as many customers bought jeans in the second week, and 4 times as many customers bought jeans in the third week. P earns $5 commission for every jeans sold. He also receives a bonus of $60. How much did he earn in total for the 3 weeks?
def solve() -> int: week_1 = 10 week_2 = week_1 * 5 week_3 = week_2 * 4 earnings_per_jean = 5 bonus = 60 total_earnings = (week_1 * earnings_per_jean) + (week_2 * earnings_per_jean) + (week_3 * earnings_per_jean) + bonus result = total_earnings return result
Joan has $38. Joan buys 4 art papers for $5 each and 2 glue sticks for $2 each. How much money does Joan have left?
def solve() -> int: art_papers = 4 glue_sticks = 2 total_cost = art_papers * 5 + glue_sticks * 2 result = 38 - total_cost return result
**** The school has 40 classrooms, each classroom containing 30 desks and 10 chairs. How many desks and chairs are there in total?
def solve() -> int: desks_and_chairs = 0 for c in range(40): desks_and_chairs = desks_and_chairs + (30*2) result = desks_and_chairs return result
Mr. Brown drives 65 km/hr on his way to work and 50 km/hr on his way back home. The distance between his home and office is 20 km. What is Mr. Brown's average speed for the whole trip?
def solve() -> int: distance = 20 speed1 = 65 speed2 = 50 total_time = distance / speed1 + distance / speed2 total_distance = distance * 2 average_speed = total_distance / total_time result = average_speed return result
Kate had 78 books and gave away 13 of them. How many books did she have remaining?
def solve() -> int: books_remaining = 78 - 13 result = books_remaining return result
At a school, there are 150 students. On Monday, 25 new students enrolled, and 15 students left the school. On Tuesday, 10 more students enrolled and 12 students left the school. On Wednesday, 8 more students enrolled, and 5 students left. What was the net increase in the number of students at the school at the end of t...
def solve() -> int: students_start = 150 students_monday = students_start + 25 - 15 students_tuesday = students_monday + 10 - 12 students_wednesday = students_tuesday + 8 - 5 net_increase = students_wednesday - students_start result = net_increase return result
The cost of a laptop is $1200. If the sales tax is 8%, what is the total cost of the laptop including sales tax?
def solve() -> int: laptop_cost = 1200 sales_tax_rate = 8 sales_tax_amount = laptop_cost * (sales_tax_rate / 100) total_laptop_cost = laptop_cost + sales_tax_amount result = total_laptop_cost return result
James planned to study for 5 hours for his math exam. If he only ends up studying half of this time, and he studies a chapter every 18 minutes, how many chapters did he study in this time?
def solve() -> int: hours_planned = 5 hours_studied = hours_planned / 2 minutes_studied = hours_studied * 60 chapters_studied = minutes_studied / 18 result = chapters_studied return result
If a student solved 4 math problems in 30 minutes, how long did it take them to solve 14 math problems?
def solve() -> int: problems_solved = 4 time_taken = 30 problems_to_solve = 14 time_per_problem = time_taken / problems_solved total_time = time_per_problem * problems_to_solve result = total_time return result
Student: Bob went to the store and bought 186 books on the first day, and he bought another 99 books on the second day. How many books did Bob buy altogether if he returned 23 books after the second day?
def solve() -> int: first_day_books = 186 second_day_books = 99 returned_books = 23 total_books_bought = first_day_books + second_day_books total_books_after_return = total_books_bought - returned_books result = total_books_after_return return result
Student: A shopkeeper bought a toy for $120 and sold it at a 20% profit. What was the selling price of the toy?
def solve() -> int: cost = 120 profit_percentage = 20 profit = cost * (profit_percentage/100) selling_price = cost + profit result = selling_price return result
An amusement park offers weekdays tickets for $9, and weekend tickets for $12. If John visited the park twice on weekdays and once over the weekend. How much did he spend on tickets?
def solve() -> int: weekday_cost = 9 * 2 weekend_cost = 12 total_cost = weekday_cost + weekend_cost result = total_cost return result
He offers a 10% discount for every 5 pieces of fruit purchased. Leila bought 16 apples and 12 pears from the farmer. How much did she pay in total?
def solve() -> int: total_fruits = 16 + 12 discount_times = total_fruits // 5 discount_amount = discount_times * 0.1 * (16 * 0.5 + 12 * 0.75) original_price = 16 * 0.5 + 12 * 0.75 final_price = original_price - discount_amount result = final_price return result
Jacob has 12 dimes in his wallet. His sister, Olivia, has three times that amount but accidentally used 2 dimes to buy gum. How many dimes does Olivia have now?
def solve() -> int: jacob_dimes = 12 olivia_dimes = jacob_dimes * 3 olivia_dimes -= 2 result = olivia_dimes return result
Amanda earns 2/3 of what Rachel earns. If Rachel earns $5,000 per month, how long will it take Amanda to earn the same amount of money in 4 months?
def solve() -> int: rachel_earnings = 5000 amanda_earnings = (2/3) * rachel_earnings time_taken = 4 amanda_total_earnings = amanda_earnings * time_taken result = amanda_total_earnings return result
Raj needs to travel 450 miles to reach his grandparents’ house. If he can drive 60 miles per hour, how many hours will it take him to get there?
def solve() -> int: distance = 450 speed = 60 time = distance / speed result = time return result
Sarah has $300 and needs to buy a new winter coat, hat, and gloves. She finds a coat for $150, a hat for $20, and gloves for $15. However, the store offers a 10% discount if she buys all three items. How much money will Sarah have left after buying the coat, hat, and gloves?
def solve() -> int: price_coat = 150 price_hat = 20 price_gloves = 15 total_price = price_coat + price_hat + price_gloves discount_price = total_price * 0.9 money_left = 300 - discount_price result = money_left return result
A school has 1000 students. 60% of the students are girls. How many girls are in the school?
def solve() -> int: total_students = 1000 girls_percent = 60 boys_percent = 100 - girls_percent girls = total_students * girls_percent / 100 result = girls return result
David is making keychains for a school fundraiser. Each keychain needs 1 keyring, 3 beads, and 2 plastic charms. If David wants to make 200 keychains, how many keyrings, beads, and plastic charms will he need in total?
def solve() -> int: keychains = 200 keyrings_per_keychain = 1 beads_per_keychain = 3 charms_per_keychain = 2 total_keyrings = keychains * keyrings_per_keychain total_beads = keychains * beads_per_keychain total_charms = keychains * charms_per_keychain result = total_keyrings + ...
Eric has 42 marbles. If he gives 3 to his sister and 7 to his brother, how many marbles does he have left?
def solve() -> int: marbles = 42 marbles -= 3 marbles -= 7 result = marbles return result
John borrowed $800 from his brother and paid an initial installment of $100. If he still has 70% left to pay, how much did he borrow originally?
def solve() -> int: borrowed_amount = 800 initial_installment = 100 remaining_amount = borrowed_amount - initial_installment original_borrowed_amount = remaining_amount / 0.7 result = original_borrowed_amount return result
A recipe calls for 2.5 cups of flour to make 12 cookies. How many cups of flour are needed to make 30 cookies?
def solve() -> int: cookies_needed = 30 cookies_in_recipe = 12 flour_in_recipe = 2.5 flour_per_cookie = flour_in_recipe / cookies_in_recipe flour_needed = cookies_needed * flour_per_cookie result = flour_needed return result
A painter can paint a room in 8 hours. His apprentice can do the same job in 12 hours. How many hours will it take for both of them to paint the room together?
def solve() -> int: painter_hours = 8 apprentice_hours = 12 painter_rate = 1/painter_hours apprentice_rate = 1/apprentice_hours total_rate = painter_rate + apprentice_rate time_together = 1 / total_rate result = time_together return result
If you purchase more than 8 shirts, you'll get a 30% discount. If Sarah paid $210 for 10 shirts, what was the original price?
def solve() -> int: original_price = 0 discounted_price = 0 num_shirts = 10 discount_rate = 0.3 discount_threshold = 8 total_paid = 210 if num_shirts > discount_threshold: discounted_price = total_paid original_price = discounted_price / (1 - discount_rate) else: ...
A construction worker earns $15 per hour. If he works for 40 hours a week, how much money will he earn in 4 weeks?
def solve() -> int: total_earned = 15 * 40 * 4 result = total_earned return result
A company sold 110 products in the morning and 120 products in the afternoon. If the company sold twice as many products in the afternoon as in the morning, how many products did it sell overall?
def solve() -> int: morning_products = 110 afternoon_products = 120 double_morning_products = 2 * morning_products total_products = morning_products + afternoon_products + double_morning_products result = total_products return result
If one box of cookies contains 24 cookies and a store has to serve 156 cookies, how many boxes of cookies will the store need?
def solve() -> int: cookies_per_box = 24 total_cookies = 156 result = total_cookies / cookies_per_box return result
Possible new questions and python programs are: Alice can fill her watering can with 1 liter of water and use it to water 2 plants. If she has 15 plants in her garden and the water costs $0.02 per liter, how much does she spend on water in a month if she waters her plants every day?
def solve() -> int: liters_per_day = 15 / 2 cost_per_day = liters_per_day * 0.02 days_per_month = 30 cost_per_month = cost_per_day * days_per_month result = cost_per_month return result
Matthew has 72 pieces of legos. He has 3 times as many yellow pieces than red pieces. How many yellow pieces are there?
def solve() -> int: num_red = 72 / 4 num_yellow = num_red * 3 result = num_yellow return result
A grocery store sells 1500 bananas for $0.50 each, and 1000 apples for $0.75 each. If they have a 5% sales tax, how much money will they make after tax?
def solve() -> int: number_of_bananas = 1500 price_of_bananas = 0.50 number_of_apples = 1000 price_of_apples = 0.75 tax_rate = 0.05 subtotal = number_of_bananas*price_of_bananas + number_of_apples*price_of_apples total = subtotal * (1+tax_rate) result = total return result