question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Cameron is 9 years older than Finn. Finn is half the age of Giselle. If Giselle is 16 years old, how old is Cameron?
def solve() -> int: age_finn = 16 / 2 age_cameron = age_finn + 9 result = age_cameron return result
Tom wants to pay for his movie tickets. If each ticket costs $7 and he buys five tickets, what is the total cost?
def solve() -> int: ticketPrice = 7 numTickets = 5 totalCost = ticketPrice * numTickets result = totalCost return result
Allye has 9 notebooks each with 40 pages. How many pages in total does she have in all her notebooks?
def solve() -> int: notebooks = 9 pages_per_notebook = 40 total_pages = notebooks * pages_per_notebook result = total_pages return result
If there are 14 chairs in a classroom and the teacher wants to add twice as many tables as the number of chairs in the room, plus 5 more chairs. How many chairs and tables will be in the room in total? A toy shop sold 500 stuffed animals in a year. In the first quarter, 75 stuffed animals were sold. In the second quart...
def solve() -> int: chairs = 14 tables = 2 * chairs + 5 total_chairs = chairs + tables stuffed_animals_sold = 500 first_quarter = 75 second_quarter = 2 * first_quarter third_and_fourth_quarter = 125 stuffed_animals_sold_in_third_and_fourth_quarter = 2 * third_and_fourth_quarter ...
Michelle and her family were preparing for a trip. Michelle had packed 3 outfits and her family had packed 5 outfits. Michelle wanted to pack at least 2 more outfits than her family. If her family packs one more outfit, how many more outfits does Michelle have to pack to reach her goal?
def solve() -> int: michelle_outfits = 3 family_outfits = 5 extra_outfits = 2 total_outfits = michelle_outfits + family_outfits + extra_outfits new_family_outfits = family_outfits + 1 michelle_goal = new_family_outfits + extra_outfits outfits_to_pack = michelle_goal - michelle...
Olivia, Jack, and Mason worked a total of 450 hours in one week. Olivia worked 20 hours more than Jack. Mason worked half as many hours as Olivia. How many hours did each person work? Carly wants to know how many papers she wrote for her English class last week. She wrote 3 papers on Monday and 2 more on Tuesday. She w...
def solve() -> int: olivia = (450 - 20) / 2 jack = olivia - 20 mason = olivia / 2 total_papers = 3 + 2 + (2 * 2) + 0 + 1 + (3 + 2 + (2 * 2) + 0 + 1) avg_papers = total_papers / 7 result = avg_papers return result
A sandwich shop charges $8 for each sandwich. If they sold 20 sandwiches, how much money will they make?
def solve() -> int: num_sandwiches = 20 cost_per_sandwich = 8 total_cost = num_sandwiches * cost_per_sandwich result = total_cost return result
Ngozi invested $5000 in the stock market. She received a profit of 10% after the first year, and a 20% profit after the second year. How much money does Ngozi have after 2 years?
def solve() -> int: initial_investment = 5000 first_year_profit = 5000 * 0.10 second_year_profit = (initial_investment + first_year_profit) * 0.20 amount_earned = initial_investment + first_year_profit + second_year_profit result = amount_earned return result
A road can accommodate 10,000 cars per day. It can handle up to 5 accidents per day. On the first day, there were 8 accidents on the road. On the second day, twice as many accidents occurred as the first day. How many more accidents can the road tolerate on the third day without creating major traffic jams?
def solve() -> int: cars_per_day = 10000 accidents_per_day = 5 first_day_accidents = 8 second_day_accidents = 2 * first_day_accidents total_accidents = first_day_accidents + second_day_accidents remaining_accidents = accidents_per_day - total_accidents result = remaining_...
Student: Amy orders 12 pizzas for a family reunion. She wants to distribute them equally among 4 tables. Ben and Cindy also order pizzas for the reunion. If they need 20 pizzas total, and Ben orders 5 pizzas, how many pizzas should Cindy order?
def solve() -> int: amy_pizzas = 12 ben_pizzas = 5 total_pizzas = 20 tables = 4 cindy_pizzas = total_pizzas - amy_pizzas - ben_pizzas pizzas_per_table = cindy_pizzas / tables result = pizzas_per_table * tables return result
Here is an example of what you should submit. If 110 people took a survey and 30 said they liked it, what is the percentage of people who liked it?
def solve() -> int: people = 110 likes = 30 percentage = (likes/ people) * 100 result = percentage return result
A car travels 480 miles on 20 gallons of gasoline. How many miles per gallon does the car get?
def solve() -> int: miles_per_gallon = 480 / 20 result = miles_per_gallon return result
A classroom has 32 students and each desk can seat 2 students. How many desks are needed for all the students?
def solve() -> int: students_in_classroom = 32 students_per_desk = 2 desks_needed = students_in_classroom / students_per_desk result = desks_needed return result
A box of chocolates contains 40 pieces. If 25% of them are eaten, how many remain in the box?
def solve() -> int: percentage_eaten = 0.25 number_of_chocolates = 40 number_of_eaten_chocolates = percentage_eaten * number_of_chocolates number_of_left_chocolates = number_of_chocolates - number_of_eaten_chocolates result = number_of_left_chocolates return result
A dance club charges a $10 cover fee and $2.50 per drink. If you have $50, how many drinks can you buy?
def solve() -> int: cover = 10 budget = 50 drink_price = 2.50 drinks = (budget - cover) / drink_price result = drinks return result
If a store made a profit of $5000 for selling 100 items, how much profit will it make if it sells 120 items?
def solve() -> int: profit_per_item = 5000/100 profit = profit_per_item * 120 result = profit return result
Robert went to the store and got 4 plums for $0.75 each, 10 apples for $1.25 each, 3 peaches for $2.00 each and 12 bottles of juice for $3.50 each. What is the total cost of these items before tax?
def solve() -> int: plumPrice = 0.75 applePrice = 1.25 peachPrice = 2.00 juicePrice = 3.50 plumCost = 4 * plumPrice appleCost = 10 * applePrice peachCost = 3 * peachPrice juiceCost = 12 * juicePrice totalCost = plumCost + appleCost + peachCost + juiceCost result = totalCost ...
Possible new questions and programs are: There are 120 chocolates in a box. One-fourth of them are dark chocolates and the rest are milk chocolates. How many more milk chocolates are there than dark chocolates?
def solve() -> int: total = 120 dark_fraction = 1/4 dark = total * dark_fraction milk = total - dark difference = milk - dark result = difference return result
Tom is saving up to go to college. He puts away 5% of his $100,000 a year salary. He needs to save up 50% of the cost of a $20,000 degree for a downpayment. How long will it take?
def solve() -> int: salary = 100000 savings_percentage = 0.05 degree_cost = 20000 downpayment_percentage = 0.5 savings_per_year = salary * savings_percentage downpayment_amount = degree_cost * downpayment_percentage years_needed = downpayment_amount / savings_per_year resu...
Claudia is arranging a holiday dinner for her family. The family has 10 members, and each member brings a plus one. If they plan to eat a 5-course meal, how many plates do they need in total?
def solve() -> int: num_members = 10 plus_ones = 10 total_people = num_members + plus_ones num_courses = 5 total_plates = total_people * num_courses result = total_plates return result
A store is having a sale for 25% off. If a sweater was originally $40, how much does it cost during the sale?
def solve() -> int: original_price = 40 discount = 0.25 discounted_price = original_price - (original_price * discount) result = discounted_price return result
They want to receive $5310 from selling matinee and evening tickets. If they sell 160 more matinee ticket than evening tickets, how much money will they receive from each type of ticket?
def solve() -> int: price_m = 5 price_e = 12 total_rev = 5310 difference = 160 total_m = (total_rev + difference*price_m) / (price_m + price_e) total_e = total_m - difference rev_m = total_m * price_m rev_e = total_e * price_e result = rev_m, rev_e return result
Student: 7. Maria was given 2,000 toy cars for her daughter's birthday. She gave away 90% of them to her neighbours. How many toy cars did Maria have left?
def solve() -> int: total_cars = 2000 percent_given_away = 90 cars_given_away = total_cars * percent_given_away / 100 cars_left = total_cars - cars_given_away result = cars_left return result
Tony is 27 years younger than Sarah. In 2016, Tony is 9 years old. How old is Sarah in 2016?
def solve() -> int: tony_age = 9 tony_age_difference = 27 sarah_age = tony_age + tony_age_difference result = sarah_age return result
A person wants to sell a table for $100 and make a 20% profit. How much did the person originally pay for the table?
def solve() -> int: selling_price = 100 profit_margin = 0.2 cost_price = selling_price / (1 + profit_margin) result = cost_price return result
Student: If Paul donated $150 to a charity where 2/3 of it is for widowed women, 1/5 goes to single parents, and the rest is for the disabled community, how much is for the disabled community?
def solve() -> int: total_donation = 150 widowed_fraction = 2/3 single_fraction = 1/5 disabled_fraction = 1 - widowed_fraction - single_fraction widowed_amount = total_donation * widowed_fraction single_amount = total_donation * single_fraction disabled_amount = total_donation * disabl...
Six students are working on a group project. Their names are Tom, Rachel, Emma, Bella, Jack, and Ethan. Tom read three times more pages than Ethan, but half as many as Rachel. Bella read the same number of pages as the average number of pages on the three other students. If Ethan read 10 pages, how many pages did Rache...
def solve() -> int: tom_pages = 0 rachel_pages = 0 emma_pages = 0 bella_pages = 0 jack_pages = 0 ethan_pages = 10 tom_pages = ethan_pages * 3 rachel_pages = tom_pages * 2 average_pages = (rachel_pages + emma_pages + jack_pages) / 3 bella_pages = average_pages ...
Carol is a baker who makes 12 batches of cookies a day. Each batch requires 2.5 cups of flour. Each bag of flour has 20 cups. How many bags of flour does Carol need each week to make her cookies?
def solve() -> int: batches_per_day = 12 flour_per_batch = 2.5 cups_per_bag = 20 days_per_week = 7 flour_per_week = batches_per_day * flour_per_batch * days_per_week bags_per_week = flour_per_week / cups_per_bag result = bags_per_week return result
A farmer had 450 apples. He sold 75 apples to the customers on Monday, 50 apples on Wednesday and 65 apples on Friday. How many apples were left with the farmer?
def solve() -> int: apples = 450 apples -= 75 apples -= 50 apples -= 65 result = apples return result
Bob's age is 3 times that of Kate's age. In 9 years, their ages will sum up to 42. How old is Kate now?
def solve() -> int: sum_in_9_years = 42 age_bob_now = sum_in_9_years - 18 age_kate_now = age_bob_now / 3 result = age_kate_now return result
During a 10-day school trip, Sophia spent $27 for lunches, she spent three times as much money on transportation. How much money did Sophia spend on transportation?
def solve() -> int: lunch_spending = 27 transp_spending = lunch_spending * 3 result = transp_spending return result
Jenny made 12 cookies. She ate half of the first cookie, shared 2/3 of the second cookie with her coworker, and gave the whole third cookie to her neighbor. How many cookies remained?
def solve() -> int: result = 0 total_cookies = 0 cookies_consumed = 0 cookies_consumed += 0.5 cookies_consumed += 0.67 cookies_consumed += 1 total_cookies = 0.3 + cookies_consumed result = total_cookies return result
A truck travels from Miami to Orlando, which is a distance of 236 miles, in 4 hours. If the truck then continues on to Atlanta, which is another 440 miles, and travels at an average speed that is 15 mph faster than its previous speed, how long does it take the truck to reach Atlanta?
def solve() -> int: distance_first_leg = 236 time_first_leg = 4 distance_second_leg = 440 average_speed_first_leg = distance_first_leg / time_first_leg average_speed_second_leg = average_speed_first_leg + 15 time_second_leg = distance_second_leg / average_speed_second_leg result = time_secon...
Ethan needs to sell 200 t-shirts at $20 per t-shirt to make $1000 in profit. How much did each t-shirt cost him?
def solve() -> int: num_tshirts = 200 selling_price = 20 total_profit = 1000 total_revenue = num_tshirts * selling_price total_cost = total_revenue - total_profit cost_per_tshirt = total_cost / num_tshirts result = cost_per_tshirt return result
Student: Farmer John has 16 chickens in his farm. He gives away two chickens and buys a total of 5 more chickens. How many chickens does he have now?
def solve() -> int: num_chickens = 16 num_chickens -= 2 num_chickens += 5 result = num_chickens return result
John is 3 years older than his little brother Cam. If Cam is 7 years old, how old is John?
def solve() -> int: cam_age = 7 john_age = cam_age + 3 result = john_age return result
Rebecca is saving to buy a car. She saves 10% of her income each month and earns $3,000 per month. How much will she have saved in 2 years?
def solve() -> int: income_per_month = 3000 savings_percentage = 0.10 months_in_year = 12 years = 2 savings_per_month = income_per_month * savings_percentage total_savings = savings_per_month * months_in_year * years result = total_savings return result
After every 2 flowers Felix waters, he plants 3 tomatoes. He needs to plant 5 tomatoes per pot. If he is making 6 pots, how many flowers does he water?
def solve() -> int: f = 2 t = 3 p = 5 pots = 6 flowers = pots * (p/t) * f result = flowers return result
Question2: John has $500 and he wants to buy 5 toys. The price of each toy is $100 and there is a 10% discount on all toys. How much money will John have left after buying the toys?
def solve() -> int: total_money = 500 price_per_toy = 100 num_toys = 5 discount_rate = 0.10 total_price = price_per_toy * num_toys total_price = total_price - (total_price * discount_rate) money_left = total_money - total_price result = money_left return result
Kevin earned $60 from mowing lawns. He spent $15 on a video game, $12 on a pizza, and $8 on a soda. He also saved 20% of his earnings in a piggy bank. How much money does Kevin have left to spend?
def solve() -> int: earnings = 60 video_game = 15 pizza = 12 soda = 8 savings = earnings * 0.2 total_expenses = video_game + pizza + soda + savings remaining_money = earnings - total_expenses result = remaining_money return result
Ashley wants to increase the weight of her resistance band by 60%. The resistance band currently weighs 10 pounds, and she can buy 1-pound steel weights for $3 each. If she buys 20 weights, she gets a 20% discount. How much will it cost Ashley to get the weight she needs?
def solve() -> int: current_weight = 10 increase_percentage = 60 new_weight = current_weight + (current_weight * increase_percentage / 100) weight_cost = 3 number_of_weights = 20 discount_percentage = 20 total_cost = weight_cost * number_of_weights if number_of_weights >= ...
Alice has a bag of candy that weighs 600 grams. She wants to share it equally with her four friends. However, she also wants to keep 20% of the candy for herself. How many grams of candy will each of her friends get?
def solve() -> int: alice = 0.2 * 600 remaining = 600 - alice friend = remaining / 4 result = round(friend) return result
Frank has an hour long ride on the bus and during his ride, the bus stops every 15 minutes for a five minute break. How many minutes will Frank spend on the bus?
def solve() -> int: t = 0 number_of_breaks = 0 while t < 60: t = t + 15 number_of_breaks = number_of_breaks + 1 tot_min = (60 - (number_of_breaks * 5)) + (number_of_breaks * 5) result = tot_min return result
Benjamin and Emily are moving into their new apartment. They need to make four trips to move all their furniture and boxes from their old apartment to their new one. Each trip takes them 20 minutes to load the car and 35 minutes to drive to the new apartment. Unloading their stuff takes no time at all. How many hours d...
def solve() -> int: num_trips = 4 load_time = 20 drive_time = 35 total_time = num_trips * (load_time + drive_time) total_hours = total_time / 60 result = total_hours return result
Student: There are 1500 coins in the jar. 30% are taken out to buy candy. Half of the remaining are taken out to buy a toy. How many coins are left in the jar?
def solve() -> int: coins = 1500 candy_coins = coins * 0.3 coins = coins - candy_coins toy_coins = coins / 2 coins = coins - toy_coins result = coins return result
A horse has four legs. If a herd of horses has 20 more horses than one-fourth as many legs as a single horse has, what is the total number of horse legs in the herd?
def solve() -> int: horse_legs = 4 herd_horses = (horse_legs / 4) + 20 total_legs = herd_horses * horse_legs result = total_legs return result
Anna and Ben have collected some coins for charity. Anna collects 50 coins more than Ben. If Ben collects 200 coins, how many coins are there in total for charity?
def solve() -> int: anna = 200 + 50 total = anna + 200 result = total return result
A store is having a sale of 20% off all items. If a dress originally costs $80, how much does it cost during the sale?
def solve() -> int: original_price = 80 discount_percentage = 20 discount_amount = discount_percentage/100*original_price new_price = original_price - discount_amount result = new_price return result
A survey shows that 25% of people have gone skydiving before and 15% of people have gone bungee jumping before. If a person is selected at random, what is the probability that they have done at least one of these activities before?
def solve() -> int: skydiving = 0.25 bungee_jumping = 0.15 neither = 1 - skydiving - bungee_jumping result = 1 - neither return result
Mrs. Lee is a librarian who wants to organize the books in her library. She has 12 shelves and each shelf can hold 25 books. How many books can she fit in her library if she leaves one shelf empty for new arrivals?
def solve() -> int: shelves = 12 books_per_shelf = 25 books_in_full_shelves = (shelves - 1) * books_per_shelf books_in_library = books_in_full_shelves result = books_in_library return result
David is making a cocktail. He adds 1 cup of vodka, 1 tablespoon of grenadine, 1/2 teaspoon of lemon juice, 3 tablespoons of orange juice, and four times as much cranberry juice as grenadine. What percentage of the cocktail is vodka, rounded to the nearest integer?
def solve() -> int: vodka = 1 grenadine = 1 lemon_juice = 1/2 orange_juice = 3 cranberry_juice = 4 * grenadine total_volume = vodka + grenadine + lemon_juice + orange_juice + cranberry_juice vodka_percentage = (vodka / total_volume) * 100 result = round(vodka_percentage) ...
Student: Mia works as a tutor and she also sells handmade jewelry on Etsy. Mia charges $25 an hour for tutoring and makes $5/piece on her jewelry. If she tutors 8 hours and sells 12 pieces of jewelry, how much money does she make?
def solve() -> int: tutoring_rate = 25 jewelry_rate = 5 tutoring_hours = 8 jewelry_pieces = 12 tutoring_money = tutoring_rate * tutoring_hours jewelry_money = jewelry_rate * jewelry_pieces result = tutoring_money + jewelry_money return result
Lena has 12 pens and 18 pencils in her backpack. She uses 2 pens and 3 pencils every day for schoolwork. After 10 days, she buys 4 more pens and 6 more pencils. How many pens and pencils does Lena have left in her backpack?
def solve() -> int: pens_initial = 12 pencils_initial = 18 pens_used = 2 pencils_used = 3 days = 10 pens_bought = 4 pencils_bought = 6 pens_used_total = pens_used * days pencils_used_total = pencils_used * days pens_left = pens_initial - pens_used_total + pens_bought pencils_...
Jake purchased 20 bags of popcorn. Each bag contained 8 cups of popcorn. If Lily bought 1 bag less than three times the amount of bags Jake bought, how many cups of popcorn did they buy in total?
def solve() -> int: jake_bags = 20 popcorn_per_bag = 8 jake_popcorn = jake_bags * popcorn_per_bag lily_bags = 3 * jake_bags - 1 lily_popcorn = lily_bags * popcorn_per_bag total_popcorn = jake_popcorn + lily_popcorn result = total_popcorn return result
A classroom has 24 students. 7 of them are absent today. What percentage of students are absent?
def solve() -> int: total_students = 24 num_absent = 7 percent_absent = (num_absent / total_students) * 100 result = percent_absent return result
A store sells shirts for $25 each. They offer a discount of 10% if a customer buys 4 or more shirts. David wants to buy 5 shirts. What is the total cost of the shirts after the discount?
def solve() -> int: price_per_shirt = 25 num_of_shirts = 5 if num_of_shirts >= 4: total_cost = num_of_shirts*price_per_shirt*0.9 else: total_cost = num_of_shirts*price_per_shirt result = total_cost return result
Tom works at a grocery store for $12 an hour. If he works 8 hours a day for 5 days, how much money will he make in a week?
def solve() -> int: pay_per_hour = 12 hours_per_day = 8 days_per_week = 5 total_hours = hours_per_day * days_per_week total_pay = total_hours * pay_per_hour result = total_pay return result
He ate 2 of them and gave half of the remaining cookies to his friend. Later, he baked another 24 cookies and decided to share them equally with his friend. How many cookies did Brian have left at the end?
def solve() -> int: cookies = 12 cookies = cookies - 2 cookies = cookies / 2 baked = 24 shared = baked / 2 cookies = cookies + shared result = cookies return result
Anna wants to paint her room. She has three walls that measure 12 ft x 9 ft and one wall that measures 10 ft x 9 ft. What is the total area of the walls she needs to paint?
def solve() -> int: wall1 = 12 * 9 wall2 = 12 * 9 wall3 = 10 * 9 wall4 = 12 * 9 total_area = wall1 + wall2 + wall3 + wall4 result = total_area return result
4. A pizza restaurant is offering a special deal. If you buy one large pizza, you get a second pizza at half the price. If the large pizza costs $25,how much does the second pizza cost?
def solve() -> int: price1 = 25 price2 = price1/2 result = 12.5 return result
If a pizza costs $10 and the delivery fee is $2, how much would a person pay for two pizzas and delivery?
def solve() -> int: total_cost = (10*2) + 2 result = total_cost return result
Emma wants to buy a book that costs $8. She currently has $5. If she saves $0.75 per week, how many weeks will it take her to save for the book?
def solve() -> int: savings_goal = 8 - 5 weeks_needed = savings_goal / 0.75 result = weeks_needed return result
Karen has twice as many stickers as Lauren. Lauren has three less than one fourth the number of stickers as Amy. If Amy has 16 stickers, how many stickers does Karen have?
def solve() -> int: amy_stickers = 16 lauren_stickers = amy_stickers / 4 - 3 karen_stickers = lauren_stickers * 2 result = karen_stickers return result
At the dance studio, half of the students will participate in the upcoming competition. If there are 250 students at the studio, and the number of males competing is twice the number of females competing, how many females are competing?
def solve() -> int: students = 250 males = students / 2 females = males / 2 result = females return result
Student: A train covers a distance of 720km in 8 hours. What is its speed in km/h?
def solve() -> int: distance = 720 time = 8 speed = distance / time result = speed return result
A bottle of water contains 1000 milliliters. If John drinks 350 milliliters, what percentage of the bottle of water did John drink?
def solve() -> int: total = 1000 drank = 350 percentage = (drank / total) * 100 result = percentage return result
Mary has a collection of 60 stamps. She wants to put an equal number of stamps in each of 8 albums. How many stamps will be in each album?
def solve() -> int: stamps = 60 albums = 8 stamps_per_album = stamps // albums result = stamps_per_album return result
In an Olympic event, there are four teams. The first two teams finish the competition in 2 hours, while the rest of the teams complete the competition 10 hours later. How long does the event last in total?
def solve() -> int: team1_time = 2 team2_time = 2 other_teams_time = 10 total_time = team1_time + team2_time + other_teams_time result = total_time return result
Student: Ben has a collection of stamps. He started with 50 stamps and buys 10 more stamps every month. He also gives away 5 stamps to his friend every week. How many stamps will he have after 6 months?
def solve() -> int: stamps_initial = 50 stamps_bought_monthly = 10 stamps_given_weekly = 5 months = 6 total_stamps_bought = stamps_bought_monthly * months total_stamps_given = stamps_given_weekly * (months * 4) result = stamps_initial + total_stamps_bought - total_stamps_given return re...
In Jane's drama club, there are 12 performers. They need to raise $720 to stage their upcoming play, which costs $60 per person. If all but 3 performers pay full cost and the rest only pay half, how much did they manage to gather?
def solve() -> int: performers = 12 total_cost = 720 cost_per_person = 60 performers_full_cost = performers - 3 performers_half_cost = 3 total_gathered = (performers_full_cost * cost_per_person) + (performers_half_cost * (cost_per_person / 2)) result = total_gathered return res...
Sophia and Lucas are planning a hiking trip. They rented a tent for $25 and bought a backpack for $30. They also bought some food for $20. If they bring $100, how much money is left for other expenses?
def solve() -> int: tent_rental = 25 backpack_cost = 30 food_cost = 20 total_expenses = tent_rental + backpack_cost + food_cost money_brought = 100 money_left = money_brought - total_expenses result = money_left return result
If the length of a rectangle is twice the width and the perimeter is 30, what is the area of the rectangle?
def solve() -> int: width = 5 length = 2 * width perimeter = 2 * (length + width) area = length * width result = area return result
``` You have $350 in savings. You want to buy a new phone that costs $800. You save $75 each month. How many months will it take you to afford the phone?
def solve() -> int: savings = 350 cost = 800 monthly_savings = 75 months_needed = (cost - savings) / monthly_savings result = months_needed return result
Kevin is working on a landscaping project that involves digging a rectangular hole that is 3 m long, 2 m wide, and 1 m deep. He can dig at a rate of 0.5 m3 per hour and he gets paid $30 per hour. How much money will he earn from this project?
def solve() -> int: volume = 3 * 2 * 1 time = volume / 0.5 money = time * 30 result = money return result
============================ Some possible questions and programs are: A baking club sold $120 worth of cakes and pies at a fundraiser. The pies were sold for $10 each and the cakes were sold for $8 each. The club made twice as much money from pies as from cakes. How many more pies than cakes did the club sell?
def solve() -> int: x = 80 / 6 y = 20 / 6 difference = x - y result = difference return result
A farmer has 12 chickens and 8 ducks in his farm. He collects eggs from them every day. Each chicken lays 2 eggs per day, and each duck lays 1 egg per day. The farmer sells his eggs for 50 cents each. How much money does he make from selling eggs in a week (7 days)?
def solve() -> int: chickens = 12 ducks = 8 chicken_eggs = 2 duck_eggs = 1 egg_price = 0.5 days = 7 chicken_egg_total = chickens * chicken_eggs * days duck_egg_total = ducks * duck_eggs * days egg_total = chicken_egg_total + duck_egg_total money = egg_total * egg_price ...
Student: David is saving money for a bike. He gets $10 every week for doing chores and $5 every month for his allowance. He also spends $3 every week on snacks. The bike costs $120. How many weeks will it take him to save enough money for the bike?
def solve() -> int: weekly_chores = 10 monthly_allowance = 5 weekly_snacks = 3 bike_cost = 120 total_weekly_income = weekly_chores + monthly_allowance/4 total_weekly_expense = weekly_snacks total_savings = total_weekly_income - total_weekly_expense result = int(bike_cost/total_savings) ...
The price of a pair of shoes is $75, but the store has a 20% discount. What is the price of the shoes after the discount?
def solve() -> int: original_price = 75 discount = 20/100 final_price = original_price - (original_price * discount) result = final_price return result
arah can walk 5 miles per hour. If she walks for 2.5 hours, how far will she have gone?
def solve() -> int: speed = 5 time = 2.5 distance = speed * time result = distance return result
A man traveled 300 miles. He traveled the first 100 miles at a speed of 50 mph and the next 200 miles at a speed of 60 mph. What was his average speed for the entire trip?
def solve() -> int: d1 = 100 d2 = 200 s1 = 50 s2 = 60 t1 = d1 / s1 t2 = d2 / s2 total_time = t1 + t2 total_distance = d1 + d2 avg_speed = total_distance / total_time result = f'{avg_speed}' result = avg_speed return result
9. Sam was cooking dinner for her large family and wanted to make sure everyone had enough to eat. She made 150 chicken nuggets, which she evenly divided between her 5 children. How many chicken nuggets did each child get?
def solve() -> int: nuggets = 150 kids = 5 nuggets_per_child = nuggets // kids remainder = nuggets % kids if remainder == 0: result = nuggets_per_child else: result = nuggets_per_child + 1 return result
Oliver is getting ready for a long flight. He packs 9 pounds of water, 4 pounds of food, and 35 pounds of equipment. During his flight, he drinks 1.8 pounds of water per hour and eats 1/10th the weight of food per hour as water per hour. How much weight is he carrying after twelve hours?
def solve() -> int: water_weight = 9 food_weight = 4 equipment_weight = 35 total_weight = water_weight + food_weight + equipment_weight water_consumed = 1.8 * 12 food_consumed = 0.1 * water_consumed total_consumed = water_consumed + food_consumed final_weight = total_...
A store is giving a discount of 25% on all items. If an item normally costs $80, how much will it cost with the discount?
def solve() -> int: item_price = 80 discount = 0.25 discount_amount = item_price * discount price_with_discount = item_price - discount_amount result = price_with_discount return result
A group of students are taking the elevator up 2 floors, down 4 floors, and then up 6 floors. If the elevator started on the 6th floor, what floor is it on now?
def solve() -> int: floors = 6 floors += 2 floors -= 4 floors += 6 result = floors return result
John can paint a house in 3 days, while Jane can paint the same house in 5 days. How long will it take for both of them to paint the same house working together?
def solve() -> int: day_john = 1/3 day_jane = 1/5 day_together = day_john + day_jane house = 1 days_required = house/day_together result = days_required return result
A car gets 30 miles per gallon. If you drive 150 miles, how many gallons of gas do you need?
def solve() -> int: mpg = 30 distance = 150 gallons_needed = distance / mpg result = gallons_needed return result
Nathan is painting a room. The room is 10 feet tall, 12 feet long, and 8 feet wide. If a gallon of paint covers 350 square feet and he wants to apply 2 coats of paint, how many gallons of paint does he need to buy?
def solve() -> int: height = 10 length = 12 width = 8 area = 2 * (length * height + width * height) square_feet_per_gallon = 350 gallons_needed = area / square_feet_per_gallon / 2 result = gallons_needed return result
A turtle is swimming in the water at 4 miles per hour and a fish is swimming at 8 miles per hour. The turtle is 3 miles from shore and the fish is 5 miles from shore. Who will reach shore first?
def solve() -> int: turtleSpeed = 4 fishSpeed = 8 turtleDist = 3 fishDist = 5 turtleTime = turtleDist / turtleSpeed fishTime = fishDist / fishSpeed if turtleTime > fishTime: result = "Fish" else: result = "Turtle" return result
Anna reads 20 pages every day. She reads every day except for the weekends. In 3 weeks, how many pages did she read?
def solve() -> int: days = 15 pages_per_day = 20 result = days * pages_per_day * 3 return result
Mark is twice as old as his brother Steve who is 7 years younger than him. If Mark is currently 24 years old, how old is Steve?
def solve() -> int: mark_age = 24 steve_age = mark_age / 2 - 7 result = steve_age return result
There are 350 students in a classroom. Each student has 4 pens in their bag. How many pens are there altogether in the classroom?
def solve() -> int: students_number = 350 pens_per_student = 4 total_pens = students_number * pens_per_student result = total_pens return result
Mia purchased 18 nails for $23. 10 of them cost $1 each, 6 of them cost $2 each, and the remaining cost $3 each. How much did she spend in total?
def solve() -> int: nails_cost1 = 10 nails_cost2 = 6 nails_cost3 = 18 - (nails_cost1 + nails_cost2) total_cost = (nails_cost1 + (2 * nails_cost2) + (3 * nails_cost3)) result = total_cost return result
Mike goes to the store and buys 3 packs of gum for $1.20 each, 2 chocolate bars for $2.50 each, and a pack of pencils for $3. How much money did Mike spend in total?
def solve() -> int: gum_price = 1.20 choco_price = 2.50 pencil_price = 3 num_gum_packs = 3 num_choco_bars = 2 total_gum_cost = gum_price * num_gum_packs total_choco_cost = choco_price * num_choco_bars total_pencil_cost = pencil_price total_cost = total_gum_cost + total_choco_cost + t...
ome possible questions and python programs are: Jasmine sells lemonade for $0.50 per cup at her stand. She spends $5 on lemons and sugar every week. She wants to buy a skateboard that costs $80. How many cups of lemonade does she need to sell in one week to reach her goal?
def solve() -> int: price = 0.50 cost = 5 goal = 80 cups = (goal + cost) / price result = cups return result
Caitlyn has 40 markers and uses 5 every day. How many markers does she have after 5 days?
def solve() -> int: num_markers = 40 markers_used = 5 markers_left = num_markers - (markers_used * 5) result = markers_left return result
cott needs to calculate the total cost of going to an amusement park. He knows that he needs to pay an entrance fee of $10, and each ride costs $3. He is going on 5 rides. How much is his total cost?
def solve() -> int: entrance_fee = 10 ride_cost = 3 num_rides = 5 total_cost = entrance_fee + (ride_cost * num_rides) result = total_cost return result
There are 6 bags of cookies, each containing 8 cookies. Ava and Ben share the cookies equally. How many cookies does each of them get?
def solve() -> int: bags = 6 cookies_per_bag = 8 total_cookies = bags * cookies_per_bag cookies_per_person = total_cookies / 2 result = cookies_per_person return result
Possible new questions: Amy wants to make some bracelets for her friends. She has 120 beads of different colors. She uses 8 beads to make one bracelet. How many bracelets can she make if she wants to use all the beads and have no leftovers?
def solve() -> int: beads = 120 bracelet = 8 result = beads // bracelet return result
James has bought a bag of 15 apples that costs $10. He plans to sell them for $1 each. But 5 apples have gone bad and he needs to throw them away. How much profit will he make after selling the remaining apples?
def solve() -> int: num_apples = 15 cost = 10 num_good_apples = num_apples - 5 price_per_apple = 1 revenue = num_good_apples * price_per_apple profit = revenue - cost result = profit return result
Student: At the library, there are 9 shelves and each shelf has 15 books. How many total books are in the library?
def solve() -> int: num_shelves = 9 books_per_shelf = 15 total_books = num_shelves * books_per_shelf result = total_books return result