question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Liam bought 50 books. Each book has 12 chapters. If 3/5 of the books have 2 missing pages per chapter, how many pages are still readable?
def solve() -> int: books = 50 chapters_per_book = 12 missing_pages_ratio = 3/5 missing_pages_per_chapter = 2 total_pages = books * chapters_per_book * missing_pages_per_chapter readable_pages = total_pages * (1 - missing_pages_ratio) result = readable_pages return result
Ava is filling up a vase with flowers. The vase can hold 50 flowers. Ava has already added 20 flowers to the vase. How many more flowers does she need to add to fill up the vase?
def solve() -> int: vase_capacity = 50 flowers_added = 20 flowers_needed = vase_capacity - flowers_added result = flowers_needed return result
Student: Blake has four times as many pencils as Hannah, and Hannah has three times as many pencils as Ryan. How many pencils do Blake, Hannah and Ryan have combined if Ryan has 25 pencils?
def solve() -> int: ryan_pencils = 25 hannah_pencils = ryan_pencils * 3 blake_pencils = hannah_pencils * 4 total_pencils = ryan_pencils + hannah_pencils + blake_pencils result = total_pencils return result
Emma starts her walk by walking 20 meters away from her home before walking along the route. She makes a turn after walking 250 meters and walks twice the distance she has covered before retracing half the distance to reach home. How far did Emma walk in total?
def solve() -> int: distance_from_home = 20 distance_covered = 250 distance_walked_twice = distance_covered * 2 distance_retraced = distance_walked_twice / 2 total_distance = distance_from_home + distance_covered + distance_retraced result = total_distance return result
Liam is an avid skater and enters a skating competition every season in hopes of winning the 250 dollar grand prize. For the first 4 competitions, he managed first place and won 250 dollars each time. He is saving up for a new skateboard that costs 300 dollars. What is the minimum number of additional competitions Liam...
def solve() -> int: current_savings = 1000 skateboard_cost = 300 additional_savings_needed = skateboard_cost - current_savings competitions_needed = additional_savings_needed / 250 from math import ceil competitions_needed = ceil(competitions_needed) result = competi...
The school library had 306 books, but when they were organizing them, 125 of the books were donated to a charity group, how many books were left in the library?
def solve() -> int: init_num = 306 donated = 125 result = init_num - donated return result
In a trivia game, Ana and Sam are on one team. The team's final score is obtained by adding 10 points for each correct answer and subtracting 5 points for each wrong answer. Out of the 15 questions, Ana got 12 correct while Sam got 4 less than half the correct answers of Ana. How many points did their team get?
def solve() -> int: ana_correct = 12 ana_wrong = 15 - ana_correct sam_correct = (1 / 2) * ana_correct - 4 sam_wrong = 15 - sam_correct team_score = 10 * (ana_correct + sam_correct) - 5 * (ana_wrong + sam_wrong) result = team_score return result
Lily and her two friends decided to share the cost of a bag of apples equally. Lily's aunt went to the farmers market and bought a bag of apples, a box of strawberries that cost $5, and a carton of oranges that also cost $5. If Lily's aunt paid $20 in total, how much should Lily and her friends pay each for the bag of ...
def solve() -> int: bag_of_apples = 1 box_of_strawberries = 5 carton_of_oranges = 5 total_cost = 20 cost_of_apples = total_cost - box_of_strawberries - carton_of_oranges cost_per_person = cost_of_apples / 3 result = cost_per_person return result
Jack has a rectangular garden that is 8 meters long and 6 meters wide. He wants to plant roses along the border of the garden. He needs one rose plant for every meter of the border. Each rose plant costs $2. How much money does he need to buy the rose plants?
def solve() -> int: length = 8 width = 6 border = 0 cost = 2 perimeter = 2 * (length + width) border = perimeter total_cost = border * cost result = total_cost return result
Alex is constructing a sunroom. Two of the walls will be completely covered in glass panels. If one wall is 18 feet by 14 feet and the other is 12 feet by 8 feet, what is the total area of glass panels needed?
def solve() -> int: wall1_length = 18 wall1_width = 14 wall2_length = 12 wall2_width = 8 wall1_area = wall1_length * wall1_width wall2_area = wall2_length * wall2_width total_area = wall1_area + wall2_area result = total_area return result
At a certain farm, each pig needs 6 gallons of water each day. There are 30 pigs at the farm. How much water does the farm need to provide for the pigs in one month?
def solve() -> int: water_needed = 0 pigs = 30 daily_water = 6 no_of_days = 30 water_needed = pigs * daily_water * no_of_days result = water_needed return result
A carpenter's daily pay decreased by 25% today, and they earned $120. What was the carpenter's daily pay before the decrease?
def solve() -> int: pay_before_decrease = 120 / 0.75 result = pay_before_decrease return result
Kim has 2 dozen (24) cupcakes. If she gives away 6 cupcakes to her neighbor and eats 4 herself, how many cupcakes does she have left?
def solve() -> int: cupcakes = 2 * 24 give_neighbor = 6 eat = 4 left = cupcakes - give_neighbor - eat result = left return result
There are 8 children waiting for ice cream and five times as many children waiting for popsicles. If each child waits 3 minutes for ice cream and each child waits 30 seconds for a popsicle, how many seconds shorter is the shorter wait?
def solve() -> int: ice_cream_wait = 8 * 3 popsicle_wait = 5 * 8 * 0.5 shorter_wait = ice_cream_wait - popsicle_wait result = shorter_wait return result
If it takes 3 hours to paint a room and 5 gallons of paint, how many hours will it take to paint 2 rooms and how much paint will be needed?
def solve() -> int: rooms = 2 paint_per_room = 5 paint_needed = paint_per_room * rooms time_per_room = 3 time_needed = time_per_room * rooms result = (time_needed, paint_needed) return result
A park has twice as many dogs as it has cats. If there are 36 cats in the park, and 40% of the animals are dogs, how many animals are in the park in total?
def solve() -> int: cats = 36 dogs = 2 * cats total_animals = (cats + dogs) / 0.4 result = total_animals return result
Student: Zoe is taking yoga lessons. She pays $100 for 10 classes in one offer. She can purchase extra classes at the price of 1/10 less than the average price of a class in the offer. If she takes 13 total classes, how much does she pay?
def solve() -> int: price_per_class = 100/10 average_price = price_per_class extra_class_price = average_price * (9/10) extra_classes = 13 - 10 extra_classes_cost = extra_classes * extra_class_price total_cost = 100 + extra_classes_cost result = total_cost return result
Possible questions: Billy has 3 more stickers than Cindy. Cindy has twice as many stickers as Andy. If Andy has 12 stickers, how many stickers does Billy have?
def solve() -> int: cindy_stickers = 12 * 2 billy_stickers = cindy_stickers + 3 result = billy_stickers return result
Possible questions and programs: Ms. Lee has a collection of coins with 20 jars. If each jar has 300 coins and Ms. Lee gives away 25% of the coins, how many coins does she have left?
def solve() -> int: jars = 20 coins_per_jar = 300 percent_given_away = 0.25 total_coins = jars * coins_per_jar coins_given_away = total_coins * percent_given_away coins_left = total_coins - coins_given_away result = coins_left return result
Maria has 10 notebooks. She wants to put them into 3 bags evenly. How many notebooks should be in each bag?
def solve() -> int: number_of_notebooks = 10 number_of_bags = 3 notebooks_per_bag = number_of_notebooks // number_of_bags result = notebooks_per_bag return result
Johnny is 18 months older than Daisy. If Johnny is currently 5 years old, how old is Daisy?
def solve() -> int: Johnny_age_in_years = 5 Johnny_age_in_months = Johnny_age_in_years * 12 Daisy_age_in_months = Johnny_age_in_months - 18 Daisy_age_in_years = Daisy_age_in_months / 12 result = Daisy_age_in_years return result
Student: Tiffany spent $20 on 4 pairs of socks and 3 shirts. Each pair of socks costs $3. How much did each shirt cost?
def solve() -> int: total_spent = 20 socks = 4 socks_price = 3 shirts = 3 socks_total = socks * socks_price remaining = total_spent - socks_total shirt_price = remaining / shirts result = shirt_price return result
There are 20 students in a classroom and each student wants to buy a copy of the school yearbook. The yearbook costs $25 each. What will be the total cost of all the yearbooks? While studying different national parks, Max found out that Yellowstone had 50 more bison than Yosemite. Yosemite had 200 bison, and Glacier ha...
def solve() -> int: students = 20 yearbook_cost = 25 total_cost = students * yearbook_cost yosemite_bison = 200 glacier_bison = yosemite_bison + 30 yellowstone_bison = 300 total_bison = yosemite_bison + glacier_bison + yellowstone_bison result = total_cost + total_bison ...
Ian took a loan of $2500 at a 4% annual interest rate. How much will he pay in a year?
def solve() -> int: amount_borrowed = 2500 annual_interest_rate = 0.04 interest = amount_borrowed * annual_interest_rate amount_paid = amount_borrowed + interest result = amount_paid return result
A rectangular field is 120 meters long and 80 meters wide. What is the area of the field in square meters?
def solve() -> int: length = 120 width = 80 area = length * width result = area return result
A recipe for a cake requires 2 cups of flour and 1 cup of sugar. If you only have 5 cups of flour and 2 cups of sugar, how many cakes can you make?
def solve() -> int: flour_needed = 2 sugar_needed = 1 flour_available = 5 sugar_available = 2 max_cakes_flour = flour_available // flour_needed max_cakes_sugar = sugar_available // sugar_needed max_cakes = min(max_cakes_flour, max_cakes_sugar) result = max_cakes return result
If Jackson is three times as old as his little sister who is 7 years old, how old will he be when she is 10?
def solve() -> int: little_sister_age = 7 jackson_age = 3 * little_sister_age age_difference = jackson_age - little_sister_age age_when_sister_is_10 = jackson_age + (10 - little_sister_age) result = age_when_sister_is_10 return result
If the first computer was made 70 years ago, how many years in the future will it be 2 years before its 140th anniversary of being made?
def solve() -> int: first_computer_year = 1951 current_year = 2021 anniversary_year = first_computer_year + 140 years_in_future = anniversary_year - current_year - 2 result = years_in_future return result
A recipe calls for 2 and 1/4 cups of flour. If you want to make 3/4 of the recipe, how much flour do you need?
def solve() -> int: full_recipe_flour = 2.25 partial_recipe = 3/4 partial_recipe_flour = full_recipe_flour * partial_recipe result = partial_recipe_flour return result
A class has 60 students, the ratio of boys to girls is 2:3. How many girls are in the class?
def solve() -> int: students = 60 boys = students * 2/5 girls = students - boys result = girls return result
The area of a rhombus and the height of a cuboid are both 25 cm. What is the width of the cuboid if the side of the rhombus is 5 cm?
def solve() -> int: area_rhombus = 25 height_cuboid =25 side_rhombus = 5 width_cuboid = (area_rhombus*4)/(height_cuboid * side_rhombus) result = width_cuboid return result
A fruit basket has 3 apples and 2 oranges. What is the ratio of apples to oranges?
def solve() -> int: apples = 3 oranges = 2 ratio = apples / oranges result = ratio return result
Q2: If Jimmy purchased a house for $150,000 and it increases in value by $15,000 every year, what will it be worth after 6 years?
def solve() -> int: house_value = 150000 annual_increase = 15000 no_of_years = 6 new_value = house_value + (no_of_years * annual_increase) result = new_value return result
An aero plane can carry 16 passengers. If it is full, how many passengers will it have?
def solve() -> int: capacity = 16 result = capacity return result
Jacob and Noah are running a race. If Jacob can finish the race in 20 minutes and Noah can finish the race in half the time it takes Jacob, how long does it take Noah to finish the race?
def solve() -> int: jacob_time = 20 noah_time = jacob_time / 2 result = noah_time return result
A water slide launches riders down a slide, and they are caught in a pool at the bottom. The slide begins at a height eight times the length of the waterslide. If the slide is seventy-two feet long, what was the height of the starting location in feet?
def solve() -> int: length_of_slide = 72 height_of_start = 8 * length_of_slide result = height_of_start return result
There were twice as many hummingbirds as cardinals. If there were 4 cardinals, how many hummingbirds were there?
def solve() -> int: hummingbirds = 4 * 2 result = hummingbirds return result
A car travelled 150 kilometers and used 12 liters of gas. The gas price was $1.2 per liter. If the car had a fuel efficiency of 15 kilometers per liter, how much money did the driver save by driving efficiently?
def solve() -> int: actual_gas_cost = 12 * 1.2 efficient_gas_cost = 150 / 15 * 1.2 money_saved = efficient_gas_cost - actual_gas_cost result = money_saved return result
andy has 82 stickers. She has given away 32. How many stickers does Sandy have left?
def solve() -> int: total = 82 used = 32 left = total - used result = left return result
Chris is buying a couch for his new apartment. The couch costs $400 and the delivery fee is $68. How much will Chris spend in total?
def solve() -> int: price = 400 delivery_fee = 68 total_price = price + delivery_fee result = total_price return result
In a classroom, there are 42 students and 21 desks. The ratio of female students to male students is 3 : 2. How many female students can be seated in the classroom?
def solve() -> int: total_students = 42 male_students = total_students * (2/5) female_students = total_students * (3/5) total_desks = 21 if male_students > total_desks: result = total_desks elif male_students < total_desks: result = male_students + female_students return res...
Student: A company's revenue increased by 20%. If last year's revenue was $6000, what was this year's revenue?
def solve() -> int: last_year_revenue = 6000 increase_percentage = 20 increase_revenue = last_year_revenue * (increase_percentage/100) this_year_revenue = last_year_revenue + increase_revenue result = this_year_revenue return result
Possible math questions and programs: Brian earned $45 from doing chores and $15 from selling lemonade. He spent half of his earnings on a video game, then gave $10 to his sister as a birthday gift. How much money did he have left?
def solve() -> int: chores = 45 lemonade = 15 game = (chores + lemonade) / 2 gift = 10 left = chores + lemonade - game - gift result = left return result
Student: Kim and Lee wanted to buy a $40.00 backpack for their friend as a graduation present. Kim had $6.00 in her piggy bank and Lee had $4.00 in his wallet. Kim then sold 5 of her old books to a second-hand bookstore, earning $2.00 per book, while Lee collected 20 cans and bottles and returned them to a recycling ce...
def solve() -> int: backpack_price = 40.00 kim_piggy_bank = 6.00 lee_wallet = 4.00 kim_book_sales = 5 * 2.00 lee_can_bottle_sales = 20 * 0.05 total_money = kim_piggy_bank + lee_wallet + kim_book_sales + lee_can_bottle_sales result = backpack_price - total_money return result
``` The probability of choosing a red marble from a bag is 1/4. If 18 marbles are in the bag and 3 are red, how many blue marbles are in the bag?
def solve() -> int: blue = 18 - 3 result = blue return result
If John worked 26 hours this week and wants to make $420 this week with an hourly rate of $20, how many more hours does he need to work?
def solve() -> int: hours_worked = 26 hourly_rate = 20 cash_goal = 420 remaining_hours = (cash_goal / hourly_rate) - hours_worked result = remaining_hours return result
The local soccer team has a rectangular field with an area of 600 square feet. If the length of the field is 20 feet, what is the width?
def solve() -> int: area = 600 length = 20 result = area/length result = 30.0 return result
A game console costs $750. If a salesman's commission is 15%, how much commission does he make?
def solve() -> int: console_cost = 750 commission_rate = 0.15 commission = console_cost*commission_rate result = commission return result
A carpenter needs to buy supplies to build a deck. How much does he need to pay for 250 pieces, if each piece costs 8$?
def solve() -> int: number_of_pieces = 250 price_per_piece = 8 total_cost = number_of_pieces * price_per_piece result = total_cost return result
Student: A florist buys 24 roses for $36 from a wholesaler. He arranges them into 6 bouquets of different sizes. The smallest bouquet has 2 roses and the largest has 6 roses. He sells each bouquet for $15 at his shop. How many dollars will the florist make from the largest bouquet?
def solve() -> int: roses_bought = 24 wholesaler_price = 36 bouquets = 6 smallest_bouquet = 2 largest_bouquet = 6 shop_price = 15 profit_from_largest_bouquet = shop_price * largest_bouquet result = profit_from_largest_bouquet return result
Emily has 2 yards of fabric that she wants to divide into equal pieces. She divides it into 10 pieces, but then she realizes they are too short so she ties 2 of the pieces together. This reduces the length of each piece by 6 inches. What is the length of each piece now?
def solve() -> int: total_yards = 2 num_pieces = 10 tied_pieces = 2 reduced_length = 6 original_length = total_yards * 36 / num_pieces new_length = (total_yards * 36 - tied_pieces * reduced_length) / (num_pieces - tied_pieces) result = new_length return result
John has a rectangular piece of land that is 40 feet long and 30 feet wide. He wants to build a fence around it. If each section of the fence is 8 feet long, how many sections of fence will he need to buy?
def solve() -> int: fence_sections_needed = (2*(40+30))/8 result = fence_sections_needed return result
In an auction, a painting is sold for $700 more than twice the highest bid received. If the highest bid was $1,100, how much did the painting sell for?
def solve() -> int: highest_bid = 1100 selling_price = 2 * highest_bid + 700 result = selling_price return result
There were 10 people working at the fair. If each person in line bought an equal number of tickets, how many tickets were sold?
def solve() -> int: TotalPeople = 364 NumberofWorkers = 10 TotalTickets = (TotalPeople - NumberofWorkers) * 1 result = TotalTickets return result
Student: Leah bakes 36 cookies and divides them equally among 6 friends. Each friend eats 4 cookies and gives 2 back to Leah. How many cookies does Leah have after sharing and receiving?
def solve() -> int: cookies_baked = 36 friends = 6 cookies_eaten_per_friend = 4 cookies_given_back_per_friend = 2 total_cookies_given = cookies_baked - (cookies_eaten_per_friend * friends) total_cookies_received = cookies_given_back_per_friend * friends result = total_cookies_given + total_c...
Tom has two parcels. One weighs 500 grams and the other weighs 750 grams. He wants to make the parcels equal in weight by adding some weight to the lighter one. If he wants them to have a total weight of 3,000 grams, how much should he add to the lighter parcel?
def solve() -> int: lighter_parcel = 500 heavier_parcel = 750 total_weight = 3000 current_total_weight = lighter_parcel + heavier_parcel weight_difference = total_weight - current_total_weight weight_to_add = weight_difference / 2 result = weight_to_add retu...
Hana and Sara work for a flower shop, creating beautiful flower arrangements for their customers. They are paid $75 for each arrangement they make. In a particular week, Hana made 12 arrangements while Sara made 3/4 times as many arrangements as Hana. Calculate the difference in their pay for the week.
def solve() -> int: hana_arrangements = 12 sara_arrangements = hana_arrangements * 3/4 hana_pay = hana_arrangements * 75 sara_pay = sara_arrangements * 75 difference = hana_pay - sara_pay result = difference return result
If the perimeter of a triangle is 26cm and the sides are in the ratio 3:4:5, what is the length of the longest side?
def solve() -> int: perimeter_of_triangle = 26 ratio_of_sides = [3,4,5] total_ratio = sum(ratio_of_sides) side1 = (ratio_of_sides[0]/total_ratio)*perimeter_of_triangle side2 = (ratio_of_sides[1]/total_ratio)*perimeter_of_triangle side3 = (ratio_of_sides[2]/total_ratio)*perimeter_of_triangle ...
If it takes Mike 40 minutes to run 5 miles, how long would it take him to run 3 miles?
def solve() -> int: distance1 = 5 time1 = 40 distance2 = 3 speed = distance1 / time1 time2 = distance2 / speed result = time2 return result
A factory has five machines each capable of producing 200 items per hour. How many items can the factory produce in one 8-hour shift?
def solve() -> int: machine_capacity = 200 num_machines = 5 hours_per_shift = 8 items_per_shift = machine_capacity * num_machines * hours_per_shift result = items_per_shift return result
Anatole has 10 maple trees and 9 magnolia trees. If each maple tree produces 17 maples and each magnolia tree produces 25 magnolias, how many fruits does Anatole have in total?
def solve() -> int: maple_num = 10 magnolia_num = 9 maple_fruit = 17 magnolia_fruit = 25 result = maple_num * maple_fruit + magnolia_num * magnolia_fruit return result
Tyler wants to buy a skateboard that usually costs $120. He has saved up $200, but then the skateboard goes on sale for $80. How many skateboards can he buy now with his savings?
def solve() -> int: skateboard_cost = 120 savings = 200 sale_price = 80 money_left = savings - sale_price num_skateboards = money_left // skateboard_cost result = num_skateboards return result
The basketball team scored 17 more points than the football team. Together, they have a total of 63 points. How many points did the basketball team score?
def solve() -> int: football_points = 0 basketball_points = 0 total_points = 63 basketball_points = football_points + 17 total_points = football_points + basketball_points football_points = (total_points - 17) / 2 basketball_points = total_points - football_points ...
Alex and Maya are bloggers, Alex has an average of 50 readers per day while Maya has three quarters the number of readers Alex has. If they earn $0.40 per reader, how much does Maya earn per week?
def solve() -> int: alex_readers = 50 maya_readers = 0.75 * alex_readers maya_weekly_readers = maya_readers * 7 maya_earnings = maya_weekly_readers * 0.40 result = maya_earnings return result
Mia has 5 dolls in the first month of the year. Every week her doll collection increases by 2. How many more dolls will Mia have than Emily if Emily has 21 dolls after a month?
def solve() -> int: dolls_in_first_month = 5 increase_per_week = 2 weeks_in_a_month = 4 total_dolls_mia = dolls_in_first_month + (increase_per_week * weeks_in_a_month) dolls_emily = 21 more_dolls_than_emily = total_dolls_mia - dolls_emily result = more_dolls_than_emily ret...
A school has a rectangular playground that is 60 meters long and 40 meters wide. If the school wants to build a fence around the playground that is 2 meters high, how much fencing material is required?
def solve() -> int: length = 60 width = 40 height = 2 perimeter = 2 * (length + width) area_of_fence = perimeter * height result = area_of_fence return result
Emily bought a bag of 21 oranges. She gave half of them to her brother. How many oranges did Emily keep?
def solve() -> int: total_number_of_oranges = 21 number_of_oranges_gave_away = total_number_of_oranges / 2 number_of_oranges_kept = total_number_of_oranges - number_of_oranges_gave_away result = number_of_oranges_kept return result
Possible questions and programs: Matt has a collection of 120 marbles of different colors. He decides to give away 15 red marbles and 10 green marbles to his friends. If he had 40 red marbles and 25 green marbles before, how many marbles of other colors does he have left?
def solve() -> int: left = 120 - 15 - 10 other = 120 - 40 - 25 result = other - (left - (40 - 15) - (25 - 10)) return result
There are 25 students in a class. If each student brings 2 pencils, how many pencils are there in total?
def solve() -> int: num_students = 25 pencils_per_student = 2 total_pencils = num_students * pencils_per_student result = total_pencils return result
Emily works at a bookstore and earns $12 per hour. She also gets a 5% commission on the total sales that she makes. Last week, she worked for 25 hours and made $1800 in sales. How much did Emily earn last week?
def solve() -> int: base_salary = 12 * 25 commission = 1800 * 0.05 total_earnings = base_salary + commission result = total_earnings return result
Sarah works part-time at a café, if she earns $8.50 per hour and works for 25 hours a week, how much does she earn per month if there are 4 weeks in a month?
def solve() -> int: weekly_earnings = 8.50 * 25 monthly_earnings = weekly_earnings * 4 result = monthly_earnings return result
Rachel bought a bag worth $50 and a scarf worth $25. If she got a 10% discount on the bag and spent $15 on gloves, how much did she spend in total?
def solve() -> int: bag_cost = 50 * 0.9 scarf_cost = 25 gloves_cost = 15 total_cost = bag_cost + scarf_cost + gloves_cost result = total_cost return result
A population of 5000 increases by 6% per year. What will the population be in 7 years?
def solve() -> int: population = 5000 growth_rate = 0.06 years = 7 new_population = population * (1 + growth_rate)**years result = int(new_population) return result
A clothing store offers 30% off the original price of any item on clearance. If a customer purchased a shirt that was originally priced at $50 for 30% off, how much did they pay?
def solve() -> int: original_price = 50 discount_percentage = 30 discount_amount = original_price * (discount_percentage / 100) final_price = original_price - discount_amount result = final_price return result
phiroth bought 5 oranges for $0.50 each, and 8 bananas for $0.35 each. How much money did he spend in total?
def solve() -> int: total = 0 total += 5 * 0.5 total += 8 * 0.35 result = total return result
John wants to buy a new video game that costs $45. He gets paid $8 per hour from his part-time job and he worked for 6 hours last week. He also found $10 on the street last month. How much more does John need to save to buy the video game?
def solve() -> int: earnings = (6 * 8) + 10 difference = 45 - earnings result = difference return result
Tom is hosting a birthday party. He wants to give 4 goodie bags for each of his 25 kid guests. He has 18 bags prepared, but he doesn't know if it is enough. How many more goodie bags does he need to make?
def solve() -> int: kid_guests = 25 bags_prepared = 18 bags_needed = kid_guests * 4 - bags_prepared result = bags_needed return result
``` A triangle has an area of 40 square units and a base of 10 units. What is the height of the triangle?
def solve() -> int: area = 40 base = 10 height = (2 * area) / base result = height return result
A factory produces 5000 items a day. If each worker can produce 25 items in a day, how many workers does the factory require?
def solve() -> int: count = 5000 // 25 result = count return result
Student: Damien bakes 21 dozen cookies, each weighing 1 ounce. He then divides the cookies into 7 bags and takes one for himself. How many ounces of cookies does Damien have for himself?
def solve() -> int: cookies_per_dozen = 12 ounces_per_cookie = 1 dozen_baked = 21 bags = 7 total_cookies = cookies_per_dozen * dozen_baked cookies_in_one_bag = total_cookies / bags ounces_in_one_bag = cookies_in_one_bag * ounces_per_cookie result = ounces_in_one_bag return result
A store offers a 20% discount on all items. If an item normally costs $40, what will be the new price after the discount?
def solve() -> int: original_price = 40 percent_discount = 20 discount_amount = original_price * percent_discount / 100 new_price = original_price - discount_amount result = round(new_price, 2) return result
If a cube has edges of length 4 feet, what is the surface area of the cube?
def solve() -> int: edge_length = 4 surface_area = 6 * edge_length**2 result = surface_area return result
Mark has a rectangular garden that measures 10 feet by 12 feet. He wants to build a border around the garden, consisting of paving stones measuring 1 foot by 1 foot. How many paving stones will he need?
def solve() -> int: length_of_garden = 10 width_of_garden = 12 length_of_stone = 1 width_of_stone = 1 area_of_garden = length_of_garden * width_of_garden area_of_one_stone = length_of_stone * width_of_stone number_of_stones = area_of_garden / area_of_one_stone result = number_of_stones ...
A garden is 25 meters wide, and 3/5 of it is covered by flowers. If the rest is covered by grass, how wide is the grassy area?
def solve() -> int: width_of_garden = 25 area_covered_by_flowers = width_of_garden * (3/5) area_covered_by_grass = width_of_garden - area_covered_by_flowers result = area_covered_by_grass return result
Possible questions and python programs: Carrie is a florist and has been hired to decorate a banquet hall with roses. She knows that each vase can hold 12 roses and that she needs to fill 9 vases for each table. She also knows that she has 18 boxes of roses, each containing 72 roses. How many tables can she decorate wi...
def solve() -> int: total_roses = 18 * 72 one_table = 9 * 12 tables = total_roses // one_table result = tables return result
Lily is practicing typing. She can type 50 words per minute. The book she is typing has on average 2000 words per page and it is 500 pages long. How many hours will she have to type to finish the book?
def solve() -> int: words_per_minute = 50 words_per_page = 2000 total_pages = 500 total_words = words_per_page * total_pages minutes = total_words / words_per_minute hours = minutes / 60 result = hours return result
A water tank is 10 feet high, 6 feet wide, and 4 feet deep. If it is filled to capacity, what is the volume of the water in cubic feet?
def solve() -> int: tank_height = 10 tank_width = 6 tank_depth = 4 water_volume = tank_height * tank_width * tank_depth result = water_volume return result
There are 20 packets of chips, with 1/5 of them being spicy. How many of the packets are spicy?
def solve() -> int: totalPackets = 20 percentSpicy = 1/5 spicyPackets = totalPackets * percentSpicy result = spicyPackets return result
Sophie needs to make 80 paintings this month for her art exhibition. She made 9 paintings each day for the first 6 days. Then she made 6 paintings each day for the next 8 days. How many more paintings does she need to make in the remaining days to meet her goal?
def solve() -> int: total_paintings = 80 paintings_first_six_days = 9 * 6 paintings_next_eight_days = 6 * 8 total_paintings_made = paintings_first_six_days + paintings_next_eight_days paintings_remaining = total_paintings - total_paintings_made result = paintings_remaining ...
Student: Frank went to the supermarket and bought a carton of eggs and a loaf of bread. The eggs cost $2.90 and the bread cost $3.25. How much did he pay in total?
def solve() -> int: eggs_cost = 2.90 bread_cost = 3.25 total_cost = eggs_cost + bread_cost result = total_cost return result
Q2: Joan is a proud owner of 3 rabbits. Each rabbit eats 80g of food per day. She is decided to go on a 23-day trip. How many kilograms of food should she prepare for her 3 rabbits so they will not starve while she is away?
def solve() -> int: rabbit_number = 3 food_per_rabbit_per_day = 80 days = 23 food_for_each_rabbit_for_all_days = food_per_rabbit_per_day * days all_rabbits_food_for_all_days = rabbit_number * food_for_each_rabbit_for_all_days all_rabbits_food_for_all_days_in_kgs = all_rabbits_food_for_all_d...
Brian needs to pay $48.12 for a purchase. He only has $20 and $10 notes. How many notes will he need in total to make the full payment?
def solve() -> int: payment_amount = 48.12 twenty_notes = 20 ten_notes = 10 number_of_twenties = payment_amount // twenty_notes remaining_amount = payment_amount % twenty_notes if remaining_amount > 0: number_of_tens = remaining_amount // ten_notes result = int(number_o...
Student: A computer costs $849.95 plus $19.95 for shipping and handling. How much do you need to pay in total?
def solve() -> int: cost_of_computer = 849.95 shipping_handling = 19.95 total_cost = cost_of_computer + shipping_handling result = total_cost return result
Student: A jar has 120 jellybeans, 40 are red, 25 are blue, and 55 are green. What percentage of the jar are red jellybeans?
def solve() -> int: total_jellybeans = 120 red_jellybeans = 40 percentage_red = (red_jellybeans / total_jellybeans) * 100 result = percentage_red return result
Laura has a jar of marbles that contains 36 red marbles, 48 blue marbles, 24 green marbles, and 12 yellow marbles. She takes out 15 red marbles, 18 blue marbles, 9 green marbles, and 6 yellow marbles to play with. How many marbles are left in the jar?
def solve() -> int: total = 36 + 48 + 24 + 12 taken = 15 + 18 + 9 + 6 remaining = total - taken result = remaining return result
A recipe calls for 2 cups of flour, 1 cup of sugar, and 3 eggs. If you only have 1 cup of sugar, how many eggs do you need to use to make the recipe?
def solve() -> int: flour = 2 sugar_needed = 1 sugar_owned = 1 ratio = sugar_needed/sugar_owned eggs = 3*ratio result = eggs return result
The car dealership wants to sell a certain number of cars every week. On the first day, they sold 3 cars. Each day afterwards, they sold 1 more car than the day before. If they sell cars for 6 days a week, what is their weekly goal for number of cars sold?
def solve() -> int: first_day = 3 num_days = 6 total_cars = 0 for day in range(num_days): num_cars = first_day + day total_cars += num_cars result = total_cars return result
A company produces 2400 pencils per day. If it takes 5 workers to produce this amount of pencils, how many pencils can 2 workers produce in 2 days?
def solve() -> int: pencils_per_day_per_worker = 2400 / 5 pencils_produced_in_two_days_by_two_workers = 2 * 2 * pencils_per_day_per_worker result = pencils_produced_in_two_days_by_two_workers return result
Luke has 50 pencils and 4/9 as many erasers as pencils. His classmates, Lily and Max, come over and he gives each of them 2/9 of each supply. How many supplies does he have left in total?
def solve() -> int: pencils = 50 erasers = pencils * 4/9 total_supplies = pencils + erasers supplies_given = (2/9) * total_supplies * 2 supplies_left = total_supplies - supplies_given result = supplies_left return result
A playground has a fence surrounding it with a side length of 24 meters. There is a sandbox within the playground that measures 8 meters by 5 meters. How much fencing will be needed to surround both the playground and sandbox?
def solve() -> int: playground_side = 24 sandbox_length = 8 sandbox_width = 5 playground_perimeter = 4 * playground_side sandbox_perimeter = 2 * (sandbox_length + sandbox_width) total_fencing = playground_perimeter + sandbox_perimeter result = total_fencing retur...