question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A man bought 10 packs of gum with 7 pieces in each pack. If he ate 5 pieces, gave away 2 packs, and lost 2 pieces, how many pieces of gum does he have left?
def solve() -> int: total_gum = 10 * 7 pieces_eaten = 5 gave_away_packs = 2 lost_pieces = 2 gum_left = total_gum - pieces_eaten - (gave_away_packs * 7) - lost_pieces result = gum_left return result
Alex has 40 more marbles than Lily does. With 80 marbles, Lily has a third of the number of marbles that Ben has. If they combine the marbles and play with 25 marbles each day, calculate the total number of days it will take for them to finish the marbles.
def solve() -> int: lily_marbles = 80 alex_marbles = lily_marbles + 40 ben_marbles = 3 * lily_marbles total_marbles = lily_marbles + alex_marbles + ben_marbles days = total_marbles // 25 result = days return result
A restaurant has three chefs and needs to make 100 pizzas. Chef 1 can make 30 pizzas in an hour and is paid $20 per hour, Chef 2 can make 25 pizzas in an hour and is paid $25 per hour and Chef 3 can make 20 pizzas in an hour and is paid $22 per hour. If they work for 5 hours, how much will they be paid in total?
def solve() -> int: chef1_pizza_perhour = 30 chef1_salary_perhour = 20 chef2_pizza_perhour = 25 chef2_salary_perhour = 25 chef3_pizza_perhour = 20 chef3_salary_perhour = 22 total_pizzas = 100 hours_worked = 5 chef1_salary = chef1_salary_perhour * hours_worked chef2_salary = chef2...
Emily is trying to consume less than 1800 calories daily. For breakfast she consumed 200 calories, for lunch 650 calories, and for dinner 800 calories. How much more can she consume while staying within her limit?
def solve() -> int: breakfast_calories = 200 lunch_calories = 650 dinner_calories = 800 daily_limit = 1800 total_calories_consumed = breakfast_calories + lunch_calories + dinner_calories remaining_calories = daily_limit - total_calories_consumed result = remaining_calories retu...
A circle's circumference is 40πcm. What is the diameter of the circle?
def solve() -> int: circumference = 40 * 3.14 diameter = circumference / 3.14 result = diameter return result
Mark earns £250 each month. He saved up 2 months worth of his salary, but he spent £120 on a new laptop. How much money does he have left in his savings?
def solve() -> int: initial_balance = 250 * 2 laptop_price = 120 remaining_balance = initial_balance - laptop_price result = remaining_balance return result
Possible new questions and programs: In a spelling bee, Ben and Mia are on one team. The team's final score is obtained by multiplying the scores of the students of the same team. Out of the 20 words, Ben spelled 18 correctly while Mia spelled 3 less than twice the score of Ben. How many points did their team get?
def solve() -> int: ben_score = 18 mia_score = 2 * ben_score - 3 team_score = ben_score * mia_score result = team_score return result
A travel agency surveyed their customers about their experience on a trip to Japan. 5% of the respondents rated their experience as unforgettable; 70% rated it as great; 80% of the remaining respondents rated it as good, and the rest rated it as subpar. If the survey received 1000 responses, how many customers rated th...
def solve() -> int: total_responses = 1000 unforgettable_responses = total_responses * 0.05 great_responses = total_responses * 0.7 remaining_responses = total_responses - unforgettable_responses - great_responses good_responses = remaining_responses * 0.8 subpar_responses = remaining_responses ...
Kevin is making a fruit salad for a party. He needs 3 kg of apples, 2 kg of bananas, and 1.5 kg of grapes. The apples cost $4 per kg, the bananas cost $3 per kg, and the grapes cost $6 per kg. He also has a 10% off coupon that he can use on any one item. How much does Kevin spend on the fruit salad?
def solve() -> int: apple_cost = 3 * 4 banana_cost = 2 * 3 grape_cost = 1.5 * 6 total_cost = apple_cost + banana_cost + grape_cost savings = max(apple_cost, banana_cost, grape_cost) * 0.1 final_cost = total_cost - savings result = final_cost return result
Mia has a basket of 72 apples. She sells 40% of them at the market and gives away 5% of the rest to her neighbors. She then buys 18 more apples from another stall. How many apples does she have in her basket now?
def solve() -> int: sold = 0.4 * 72 left = 72 - sold given = 0.05 * left left = left - given bought = 18 basket = left + bought result = basket return result
Ella bakes cookies and sells them at school. She uses 3 cups of flour, 2 cups of sugar, and 1 cup of chocolate chips to make 24 cookies. She buys the flour for $0.50 per cup, the sugar for $0.40 per cup, and the chocolate chips for $1 per cup. She sells each cookie for $0.25. How much money does she make if she bakes a...
def solve() -> int: flour = 3 sugar = 2 chips = 1 flour_price = 0.5 sugar_price = 0.4 chips_price = 1 spend_per_batch = flour * flour_price + sugar * sugar_price + chips * chips_price cookies = 72 batches = cookies / 24 spend_total = spend_per_batch * batches cookie...
A town has 500 households. 80 percent of the households recycle, and 70 percent of the households that recycle compost. How many households compost?
def solve() -> int: total_households = 500 recycling_households = total_households * 0.8 composting_households = recycling_households * 0.7 result = composting_households return result
During a coding competition, 10 programmers solved one problem in 2 hours, and the rest of the programmers completed the problem in 30 minutes longer. How long did it take for all programmers to solve the problem?
def solve() -> int: programmers_1 = 10 time_1 = 2 programmers_2 = 10 time_2 = time_1 + 0.5 total_programmers = programmers_1 + programmers_2 total_time = (programmers_1 * time_1) + (programmers_2 * time_2) result = total_time return result
Student: Emma biked 2 kilometers East, then turned North and biked for 10 more kilometers. If she then turned West and biked 4 kilometers, how far is she from the starting point?
def solve() -> int: distance_east = 2 distance_north = 10 distance_west = 4 total_distance = distance_east + distance_north + distance_west result = total_distance return result
A school store wants to know how much profit they made selling pencils. If they sold 100 pencils at $0.50 each and they bought the pencils for $0.25 each, how much profit did they make?
def solve() -> int: num_pencils = 100 selling_price = 0.5 buying_price = 0.25 profit_per_pencil = selling_price - buying_price total_profit = profit_per_pencil * num_pencils result = total_profit return result
Student: Janice received a gift card for 25 movie tickets that cost $8 each. Her best friend also gave her an additional $50. How much money is left on the card after buying the tickets?
def solve() -> int: ticket_cost = 8 ticket_num = 25 additional_money = 50 total_cost = ticket_cost * ticket_num total_money = total_cost + additional_money result = total_money - total_cost return result
Possible questions and programs: A pencil company produces 250 pencils on Monday, 300 on Tuesday, and 350 on Wednesday. If the company follows the same pattern for the rest of the week, how many pencils will they produce in total by Friday?
def solve() -> int: total = 0 increase = 50 total = total + 250 total = total + 300 total = total + 350 base = 350 for i in range(2): base = base + increase total = total + base result = total return result
Ben wants to make a fruit salad with apples, oranges, and bananas. He needs 4 apples, 3 oranges, and 2 bananas for each serving. He has 24 apples, 18 oranges, and 12 bananas in his fridge. How many servings of fruit salad can he make with the fruits he has?
def solve() -> int: apples = 24 oranges = 18 bananas = 12 apples_per_serving = 4 oranges_per_serving = 3 bananas_per_serving = 2 servings_with_apples = apples / apples_per_serving servings_with_oranges = oranges / oranges_per_serving servings_with_bananas = bananas / bananas_per_serv...
A restaurant uses 25 gallons of ketchup each month. Every month, ketchup consumption increases by 10%. How many gallons will they use in 6 months?
def solve() -> int: start_ketchup = 25 monthly_increase = 0.1 months_passed = 6 final_ketchup = start_ketchup * ((1 + monthly_increase) ** months_passed) result = final_ketchup return result
A store owner just reduced the price of a product by 15%. If the original price was $50, what is the new price?
def solve() -> int: original_price = 50 reduction_percentage = 15 reduction_amount = original_price * (reduction_percentage / 100) new_price = original_price - reduction_amount result = new_price return result
Student: A rectangle has a perimeter of 34 units and a width of 5 units. What is the length of the rectangle?
def solve() -> int: perimeter = 34 width = 5 length = perimeter / 2 - width result = length return result
If a recipe of brownies requires 3/4 cups of sugar and makes 12 brownies, how many cups of sugar would be required for 24 brownies?
def solve() -> int: recipe_yield = 12 sugar_reqd = 3/4 new_yield = 24 sugar_new = (new_yield/recipe_yield) * sugar_reqd result = sugar_new return result
Alex read 5 books in 4 weeks. Tricia read 7 more than one-fourth of that amount in the same time. How many books did Alex and Tricia read together in 4 weeks?
def solve() -> int: alex_books = 5 weeks = 4 one_fourth_books = alex_books / 4 tricia_books = one_fourth_books + 7 total_books = alex_books + tricia_books result = total_books return result
Student: A classroom has 30 students. The ratio of boys to girls is 3:2. How many boys are there in the classroom?
def solve() -> int: total_students = 30 boy_girl_ratio = 3/2 num_boys = total_students * (boy_girl_ratio / (boy_girl_ratio + 1)) num_girls = total_students - num_boys result = num_boys return result
A rectangular lawn measures 10m by 15m. What is its Area?
def solve() -> int: area = 10 * 15 result = area return result
Student: There are 120 students in a class, and each student needs 2 textbooks. How many textbooks would be needed for the entire class?
def solve() -> int: students = 120 textbooks_per_student = 2 textbooks_total = students * textbooks_per_student result = textbooks_total return result
If 70 out of every 100 people like running and out of those that like it, 45% run competitively, how many people would you expect run competitively out of a group of 900?
def solve() -> int: num_likes_running = 900 * (70/100) num_runs_competitively = num_likes_running * (45/100) result = num_runs_competitively return result
Sarah plans to cook spaghetti for 20 people at a charity event. She needs 2 lb. of spaghetti for every five people and wants to make sure there is extra. One pound of spaghetti costs $1.20. How much will she spend on spaghetti?
def solve() -> int: people = 20 spaghetti_per_person = 2 / 5 total_spaghetti = people * spaghetti_per_person cost_per_pound = 1.20 total_cost = total_spaghetti * cost_per_pound result = total_cost return result
Amy has 5 packs of gum. Each pack has 8 pieces of gum. She gave 2 pieces of gum to each of her 4 friends. How many pieces of gum does Amy have left?
def solve() -> int: total_gum = 5 * 8 gum_given_away = 2 * 4 gum_left = total_gum - gum_given_away result = gum_left return result
Jack is arranging for a charity event. He wants to make sure that there are enough chairs for everyone. He purchases 4 dozen chairs for the 4 dozen guests he's invited. Later, he discovers that 10% of the guests are bringing an extra person. He wants to buy an extra 7 chairs in case there are more guests. If 6 guests c...
def solve() -> int: guests_invited = 4 * 12 extra_guests = int(guests_invited * 0.1) total_guests = guests_invited + extra_guests chairs_needed = total_guests + 7 guests_cant_make_it = 6 new_total_guests = total_guests - guests_cant_make_it new_chairs_needed = n...
There are 600 marbles in total. The red marbles are 20% of the green marbles present while yellow marbles are five times more than red. How many blue marbles are there?
def solve() -> int: total_marbles = 600 green_marbles = round(total_marbles/5) red_marbles = round(green_marbles* 0.2) yellow_marbles = 5* red_marbles remaining_marbles = total_marbles - (green_marbles + red_marbles + yellow_marbles) blue_marbles = remaining_marbles result = blue_marbles ...
A company's expenses for the year were $500,000. If the company made a profit of 20% that year, how much was their profit?
def solve() -> int: total_expenses = 500000 profit_percent = 0.2 profit_amount = total_expenses*profit_percent result = profit_amount return result
Noah prepares a salad every day. He uses 2 cups of lettuce and tops it with 0.5 cups of dressing. He can usually make 3 cups of dressing per can. After 2 weeks, if lettuce is $1.00 per head and dressing is $2.50 per can, how much will he have spent on ingredients?
def solve() -> int: lettuce_per_serving = 2 dressing_per_serving = 0.5 dressing_per_can = 3 lettuce_cost_per_head = 1.00 dressing_cost_per_can = 2.50 total_serving = 14 * 7 total_lettuce = lettuce_per_serving * total_serving total_dressing = dressing_per_serving * total_se...
Dan works in a company for 8 hours a day, 5 days a week. Last week he took 2 days off because he was sick. How much time off work in percentage did he take for the week?
def solve() -> int: hours_per_day = 8 days_per_week = 5 total_hours = hours_per_day * days_per_week sick_days = 2 total_worked_hours = (days_per_week - sick_days) * hours_per_day time_off_percentage = ((total_hours - total_worked_hours) / total_hours) * 100 result = f'<<<{time_off_percentage...
David wants to become a successful trader. It takes 45 minutes to learn the basics of stock markets. It then takes him 30 times that long to master trading strategies. After that, he dedicates himself to the art of making money and spends 80 times as much as the combined time to become a millionaire trader. How much to...
def solve() -> int: basics_time = 45 master_time = 30 * basics_time millionaire_time = 80 * (basics_time + master_time) total_time = basics_time + master_time + millionaire_time result = total_time return result
am is painting a room. The walls are 6 feet tall and 20 feet long. What is the area of the room?
def solve() -> int: wall_height = 6 wall_length = 20 room_area = wall_height * wall_length result = room_area return result
Mary is planning a road trip with her friends. They plan to drive 300 miles in 6 hours. What is their average speed in miles per hour?
def solve() -> int: distance = 300 time = 6 average_speed = distance/time result = average_speed return result
Joan wants to save up for a new bicycle that costs $250. She earns $12 per hour at her weekend job and worked for 10 hours last week. She also babysits for her neighbor and earns $15 per hour for her 5 hours of work. If Joan spends $40 on groceries, will she have enough money to buy the bicycle?
def solve() -> int: grocery_cost = 40 hourly_rate = 12 weekend_hours = 10 babysitting_hours = 5 babysitting_rate = 15 bicycle_cost = 250 weekend_earnings = weekend_hours * hourly_rate babysitting_earnings = babysitting_hours * babysitting_rate total_earnings = weekend_earnings +...
Student: A family of four goes to the supermarket and spends $84. If they split the bill evenly, how much will each family member need to pay?
def solve() -> int: total_bill = 84 num_family_members = 4 amount_each_member = total_bill / num_family_members result = amount_each_member return result
Bob collects stamps and stickers. He has five times as many stickers as stamps. If he has 12 stamps in his album and 8 stamps in his drawer, how many stickers does he have in total?
def solve() -> int: stamps = 12 + 8 stickers = 5 * stamps result = stickers return result
Mia's book club read 2 books a day for the first 5 days and then on the last day of the week they read six times as many books as every other day combined. If the cost of each book was $5, how much did Mia spend that week?
def solve() -> int: books_per_day = 2 days_first_week = 5 total_books_first_week = books_per_day * days_first_week books_last_day = 6 * total_books_first_week - total_books_first_week total_books = total_books_first_week + books_last_day cost_per_book = 5 total_cost = total_books * cost_per_...
Dana always takes the same route when walking her dog. First, she walks 3 blocks to the mini-park. Then she walks 5 blocks to the pet store. Finally, she walks 4 blocks to get back home. Dana walks her dog thrice each day, how many blocks does Dana's dog walk each day? John is five years younger than Sarah. When Sarah ...
def solve() -> int: blocks_to_park = 3 blocks_to_store = 5 blocks_home = 4 total_blocks = (blocks_to_park + blocks_to_store + blocks_home) * 3 sarah_age = 3 * 12 john_age = sarah_age - 5 john_age_at_sarah_3_dozen = john_age + (3 * 12 - sarah_age) result = total_blocks...
During the end-of-season sale, Laura wants to sell all of her remaining $12.00 jackets and $7.00 scarfs at half price. If she sells the last 15 jackets and 25 scarfs, how much money does she make?
def solve() -> int: jacket_price = 12.00 scarf_price = 7.00 jacket_discount = 0.5 scarf_discount = 0.5 num_jackets = 15 num_scarfs = 25 jacket_sale_price = jacket_price * jacket_discount scarf_sale_price = scarf_price * scarf_discount total_jacket_sale = num_jackets * jacke...
Jack is a gamer who likes to buy video games and consoles. He spent $15,000 on his gaming setup this year. He spent eight times as much on video games as he did on consoles. What he spent on consoles was 1/16 the cost of controllers. If Jack's video games purchase was $12,000, what amount did he spend on controllers?
def solve() -> int: video_games = 12000 consoles = video_games / 8 controllers = consoles * 16 total = 15000 result = controllers return result
Student: Leo bikes 5 times a week. He bikes for 40 minutes each time and covers 12 kilometers. How many minutes does he take to bike 1 kilometer?
def solve() -> int: times = 5 duration = 40 distance = 12 total_time = times * duration total_distance = times * distance time_per_km = total_time / total_distance result = time_per_km return result
A company produces 500 units of a product at a cost of $3.50 per unit. They sell the product for $5.00 per unit. What is their profit from selling 400 units?
def solve() -> int: units_produced = 500 unit_cost = 3.50 unit_price = 5.00 units_sold = 400 total_cost = units_produced * unit_cost total_revenue = units_sold * unit_price total_profit = total_revenue - total_cost result = total_profit return result
A family of four went fishing and caught a total of 24 fish. Tom caught 10 fish while his brother and sister caught an average of 4 fish each. How many fish did Tom's brother and sister catch together?
def solve() -> int: total_fish = 24 tom_fish = 10 average_fish = 4 brother_sister_fish = (total_fish - tom_fish) / 2 result = brother_sister_fish return result
Ben has a rectangular garden that is 18 by 12 feet. He wants to plant tomatoes in one-fourth of the garden and lettuce in one-third of the remaining area. How many square feet of the garden will he use for planting tomatoes and lettuce?
def solve() -> int: area = 18 * 12 tomatoes = area * (1 / 4) left = area - tomatoes lettuce = left * (1 / 3) result = tomatoes + lettuce return result
Jack brought five apples, four oranges, and six carrots to his school. How many pieces of fruits and vegetables did Jack bring in total?
def solve() -> int: count = 0 count = count + 5 count = count + 4 count = count + 6 result = count return result
``` If Ali has 2 bills of 100 dollars, 3 bills of 20 dollars, 4 coins of 50 cents, and 10 coins of 25 cents, how much money does he have in total?
def solve() -> int: hundreds = 2 twenties = 3 half_dollars = 4 quarters = 10 total_amount = (hundreds * 100) + (twenties * 20) + (half_dollars * 0.5) + (quarters * 0.25) result = total_amount return result
A recipe calls for 2/3 cup of sugar for every 4 cups of flour. If you only have 2 cups of flour, how much sugar will you need?
def solve() -> int: flour = 2 sugar_per_flour = 2/3 sugar_needed = sugar_per_flour * (flour / 4) result = sugar_needed return result
Lisa purchased a new house. The attic has three times as much storage space as the basement. She filled up the entire basement with boxes, using up 50% of the space. If the basement has a total of 4,000 square feet, how much storage space is available in the attic?
def solve() -> int: basement_space = 4000 attic_space = basement_space * 3 available_space = attic_space - basement_space result = available_space return result
Lily constructs a rectangular prism with dimensions 10 inches by 6 inches by 4 inches. Emma constructs a rectangular prism with dimensions 14 inches by 8 inches by 6 inches. What is the difference in volume between the two rectangular prisms?
def solve() -> int: length_lily = 10 width_lily = 6 height_lily = 4 length_emma = 14 width_emma = 8 height_emma = 6 volume_lily = length_lily * width_lily * height_lily volume_emma = length_emma * width_emma * height_emma difference_in_volume = volume_emma - volume_lil...
Student: 1. Jeff orders a dish at his local restaurant for $45. He tips the server 40%. If his friend Bill agrees to split the bill, how much should each person pay?
def solve() -> int: bill = 45 tip_percentage = 0.4 total_amount = bill + bill * tip_percentage amount_each_person = total_amount / 2 result = amount_each_person return result
Student: A bakery uses 18 eggs to make 3 cakes. How many cakes can they make with 54 eggs?
def solve() -> int: eggs_per_cake = 18/3 cakes = 54/eggs_per_cake result = cakes return result
Student: Peggy scored 15 points lower than the average score on her English test. If the average score was 85, what score did Peggy receive on the English test?
def solve() -> int: average = 85 difference = 15 peggy = average - difference result = peggy return result
In a class, all students are required to take 4 exams. Each exam is worth 100 points. If Olivia receives a 90, 86, 95, 92 on her first four exams, what score does she need to receive on the last exam to have an average of 90?
def solve() -> int: num_exams = 5 desired_average = 90 scores_so_far = [90, 86, 95, 92] total_needed = desired_average * num_exams - sum(scores_so_far) score_needed = total_needed / (num_exams - len(scores_so_far)) result = round(score_needed) return result
David bought a dozen apples for $9 and a dozen oranges for $7. What is the average cost of each fruit?
def solve() -> int: money_spent_on_apples = 9 money_spent_on_oranges = 7 total_money_spent = money_spent_on_apples + money_spent_on_oranges total_fruits = 12 + 12 average_cost_per_fruit = total_money_spent / total_fruits result = average_cost_per_fruit return result
A tank can hold 1200 liters of water. If the tank is already half full, how many liters of water can it still hold?
def solve() -> int: tank_capacity = 1200 percent_full = 50 remaining_space_percent = 100 - percent_full remaining_space_liters = (remaining_space_percent/100)*tank_capacity result = remaining_space_liters return result
How many liters of water are needed to fill a rectangular pool with dimensions 6m x 4m x 2m?
def solve() -> int: length = 6 width = 4 height = 2 volume = length * width * height liters = volume * 1000 result = liters return result
A bookshop has 45 books, 30 of them are fiction books, and 1/3 of the remaining are books on science, and 20% of the remainder are history books. How many history books does the bookshop have?
def solve() -> int: fiction = 30 remaining = 45 - fiction science = remaining / 3 remaining = remaining - science history = remaining * 0.20 result = history return result
The school bus can carry 3 times as many students as the car, and the car can carry 4 more students than the bicycle. If the bus can carry 60 students, how many students can the bicycle carry?
def solve() -> int: bus_capacity = 60 car_capacity = bus_capacity / 3 bicycle_capacity = car_capacity - 4 result = bicycle_capacity return result
A museum has 30 exhibits, and each exhibit has eight display cases. Each display case has 50 items on display. How many items are on display in total in the museum?
def solve() -> int: exhibits = 30 display_cases_per_exhibit = 8 items_per_display_case = 50 total_items_on_display = exhibits * display_cases_per_exhibit * items_per_display_case result = total_items_on_display return result
There are 5 more pencils in Mike's pencil box than in Tim's pencil box. Together they have 17 pencils. How many pencils are in Tim's pencil box?
def solve() -> int: result = 6 print return result
If a shape has an area of 72 square meters and a length of 12 meters, what is the width of the shape?
def solve() -> int: area = 72 length = 12 width = area / length result = width return result
There are 20 people attending a party and each person will get 4 slices of pizza. If each pizza has 8 slices, how many pizzas should be ordered?
def solve() -> int: people = 20 slices_per_person = 4 slices_per_pizza = 8 pizzas = (people*slices_per_person)/slices_per_pizza result = pizzas return result
Rachel has 32 books. She gave away 8 books. She gave away half of the remaining books to her classmates and kept the rest. How many books did she keep?
def solve() -> int: books = 32 given_away_books = 8 remaining_books = books - given_away_books classmates_books = remaining_books / 2 kept_books = remaining_books - classmates_books result = kept_books return result
A car rental company charges $40 for the first day and $20 for each additional day. If John rents a car for 5 days, how much does he pay?
def solve() -> int: first_day_cost = 40 additional_day_cost = 20 rental_days = 5 additional_days = rental_days - 1 total_cost = first_day_cost + additional_days * additional_day_cost result = total_cost return result
Brad buys 36 oranges, but gives 9 away. How many oranges does he have left in the end?
def solve() -> int: oranges = 36 oranges_given = 9 oranges_left = oranges - oranges_given result = oranges_left return result
A company earned a total of $8400 in profits, which is 35% more than last year. What was the company's profit last year?
def solve() -> int: current_profit = 8400 percent_increase = 0.35 last_year_profit = current_profit / (1 + percent_increase) result = last_year_profit return result
Student: Matt is going on a trip and he wants to exchange $500 to euros. The exchange rate is $1.2 for 1 euro and there is a 2% commission fee. How many euros would Matt receive?
def solve() -> int: dollars = 500 rate = 1.2 fee = 0.02 dollars_after_fee = dollars * (1 - fee) euros = dollars_after_fee / rate result = euros return result
During a family camping trip, Susan's parents brought their dog, two cats, and a parrot with them. How many legs' worth of pets are on the camping trip?
def solve() -> int: dog_legs = 4 cat_legs = 4 parrot_legs = 2 total_legs = dog_legs + (2 * cat_legs) + parrot_legs result = total_legs return result
Tyler is 65 years old. His wife is 3 years older than him. If they had their first child 20 years ago and their child is 1/4 of their combined age, how old is their child now?
def solve() -> int: tyler_age = 65 wife_age = tyler_age + 3 combined_age = tyler_age + wife_age child_age_20_years_ago = combined_age / 4 child_age_now = child_age_20_years_ago + 20 result = child_age_now return result
A rectangular pool is 15 feet long and 10 feet wide. Miguel wants to put a fence around the entire pool. If the fence costs $2 per foot, how much will Miguel spend​?
def solve() -> int: length = 15 width = 10 perimeter = 2 * (length + width) cost_per_foot = 2 total_cost = perimeter * cost_per_foot result = total_cost return result
Student: There are 100 students in a school. If 70% of them passed a test, how many failed the test?
def solve() -> int: total_students = 100 passed_students = total_students * 0.7 failed_students = total_students - passed_students result = failed_students return result
Student: Lucas has 3 quarters, 5 dimes, and 4 nickels in his pocket. How much money does he have in total?
def solve() -> int: quarters = 3 dimes = 5 nickels = 4 total_amount = quarters * 0.25 + dimes * 0.10 + nickels * 0.05 result = total_amount return result
Bryan has a lemonade stand on a hot day. He starts with a gallon of lemonade and 50 cups. Each cup uses 1/10 of the gallon of lemonade. After every 10 cups sold, Bryan adds 1 cup of ice to the remaining lemonade. How much lemonade does Bryan have left after selling all 50 cups?
def solve() -> int: gallon_of_lemonade = 1 cups = 50 cups_per_gallon = 10 cups_sold = 0 ice_added = 0 while cups_sold < cups: cups_sold += 1 gallon_of_lemonade -= 1/10 if cups_sold % cups_per_gallon == 0: ice_added += 1 gallon_of_lemonade -= ice_...
Student: If a car has a gas tank capacity of 18 gallons and you put 9 gallons of gas in it, what percentage of the tank capacity is filled?
def solve() -> int: tank_capacity = 18 gas_in_tank = 9 percentage_filled = (gas_in_tank / tank_capacity) * 100 result = percentage_filled return result
Alex purchased 800 marbles and shared them among three friends, Tom, Jill, and Ben, in the ratio 1:2:3. If the friend who received the smallest share gave two-thirds of their share to the friend who received the largest share, how many marbles does the largest share recipient now have?
def solve() -> int: marbles = 800 ratio = [1, 2, 3] total_ratio = sum(ratio) tom_share = (ratio[0] / total_ratio) * marbles jill_share = (ratio[1] / total_ratio) * marbles ben_share = (ratio[2] / total_ratio) * marbles smallest_share = min(tom_share, jill_share, ben_share) larg...
Student: A tropical rainforest contains 1/3 more palm trees than a nearby desert. If the desert contains 1000 palm trees, how many palm trees are in the rainforest?
def solve() -> int: desert_palm_trees = 1000 rainforest_palm_trees = desert_palm_trees + desert_palm_trees/3 result = rainforest_palm_trees return result
There are 4 books on each shelf. If Emily's 2 sisters each read one-third of the books on their respective shelves, how many books are still on the shelves altogether?
def solve() -> int: books_per_shelf = 4 sisters = 2 books_read_per_sister = books_per_shelf / 3 books_remaining = (books_per_shelf - books_read_per_sister) * sisters result = books_remaining return result
Student: A car is moving at a constant speed of 60 km/hr. If it takes 2 hours to reach its destination, how much distance does it cover?
def solve() -> int: speed = 60 time = 2 distance = 0 distance = speed * time result = distance return result
A rectangular garden has dimensions of 10 meters by 15 meters. If you want to add a 1 meter wide flower bed around the garden, what is the area of the flower bed?
def solve() -> int: length = 15 width = 10 border_width = 1 flower_bed_length = length + (2 * border_width) flower_bed_width = width + (2 * border_width) flower_bed_area = (flower_bed_length * flower_bed_width) - (length * width) result = flower_bed_area return result
Student: Fiona has 60 stickers. She gives away 2 stickers to each of her friends. How many friends does she have if she has 12 stickers left after giving them away?
def solve() -> int: stickers = 60 stickers_given_away = 2 friends = stickers // stickers_given_away stickers_left = 12 result = (stickers - stickers_left) // stickers_given_away return result
Nancy has a savings plan of investing $200 every month for 10 years. How much money does she have saved at the end?
def solve() -> int: monthly_savings = 200 num_months = 120 result = monthly_savings * num_months return result
Martha collects coins. She has 34 quarters, 25 dimes and 17 nickels. How much money does Martha have in total?
def solve() -> int: quarter_value = 0.25 num_quarters = 34 dime_value = 0.1 num_dimes = 25 nickel_value = 0.05 num_nickels = 17 result = quarter_value * num_quarters + dime_value * num_dimes + nickel_value * num_nickels return result
There are 4 slices of pizza left and 5 children who want to have an equal share of pizza. How many slices will the children each receive?
def solve() -> int: slices_per_child = 4//5 result = slices_per_child return result
Kim wants to buy 8 DVDs which cost $9 each and 10 books which cost $7 each. How much money will Kim spend in total?
def solve() -> int: total_cost = 0 total_cost = total_cost + 9 total_cost = total_cost + 9 total_cost = total_cost + 9 total_cost = total_cost + 9 total_cost = total_cost + 9 total_cost = total_cost + 9 total_cost = total_cost + 9 total_cost = total_cost + 9 total_cost ...
am has 36 coins, and he wants to arrange them in rows of 6. How many rows can he make with his coins?
def solve() -> int: rows = 36 / 6 result = rows return result
A box contains 24 balls numbered 1 to 24. What is the average of all the numbers on each ball?
def solve() -> int: total_balls = 24 sum_of_numbers = total_balls * (total_balls + 1)/2 average = sum_of_numbers/total_balls result = average return result
Ms. Jones bought 6 packs of pencils for a class. Each pack has 12 pencils. She gave 2 pencils to each student. There are 24 students in the class. How many pencils did she have left?
def solve() -> int: total_pencils = 6 * 12 given_pencils = 2 * 24 left_pencils = total_pencils - given_pencils result = left_pencils return result
Here are some possible questions and programs: Anna has 12 candies in a jar. She gives 4 candies to her friend Ben and 3 candies to her sister Claire. Then she finds out that 2 of the candies in the jar are spoiled and throws them away. How many candies does Anna have left in the jar?
def solve() -> int: candies = 12 candies = candies - 4 - 3 candies = candies - 2 result = candies return result
Max has $500 in his bank account. He deposits $75 every week and withdraws $50 every two weeks. How much money will he have in his account after 8 weeks?
def solve() -> int: balance = 500 weeks = 8 deposit = 75 * weeks withdrawal = 50 * (weeks // 2) total = balance + deposit - withdrawal result = total return result
Books cost $5 each. Cathy wants to buy 20 books for her book club. She gets a 10% discount for buying more than 10 books, and a free book for every 5 books she buys. How much does she pay?
def solve() -> int: price = 5 quantity = 20 discount = 0.10 discounted_price = price * (1 - discount) free_books = quantity // 5 cost = discounted_price * (quantity - free_books) result = cost return result
During a road trip, the family stopped at a gas station. They saw 4 trucks and 3 cars filling up. If there were also 2 gas station employees and 20 other customers, how many vehicles and people are there in total?
def solve() -> int: trucks = 4 cars = 3 employees = 2 customers = 20 vehicles = trucks + cars people = employees + customers result = vehicles + people return result
During a holiday sale, Rachel received a 30% discount on her purchase of a TV. If the discount was $120, how much did she pay in total? Ariana practices the piano for an average of 4 hours a day. Her little cousin practices 1.8 times as much as Ariana does. Because her mother is so exhausted from working, for every 45 ...
def solve() -> int: discount = 120 original_price = discount / 0.3 total_price = original_price - discount result = total_price hours_per_day = 4 cousin_hours = hours_per_day * 1.8 minutes_practiced = cousin_hours * 60 minutes_slept = minutes_practiced / 45 * 15 hours_slept = mi...
Carmelo bought 3 boxes of donuts for his party. Each box contains 10 donuts. After the party he found that 1/4 of the donuts was left uneaten. How many donuts were eaten in total?
def solve() -> int: boxes = 3 donuts_per_box = 10 left_percentage = 1/4 total_donuts = boxes * donuts_per_box eaten_donuts = total_donuts - (total_donuts * left_percentage) result = eaten_donuts return result
If Linda spends $8 on breakfast every morning, how much does she spend on breakfast in 1 month?
def solve() -> int: cost_of_breakfast = 8 total_cost_for_month = cost_of_breakfast * 28 result = total_cost_for_month return result
Joey has 24 marbles in his collection. He lost 5 marbles and gained 7 more. How many marbles does Joey have now?
def solve() -> int: starting_marbles = 24 lost_marbles = 5 gained_marbles = 7 total_marbles = starting_marbles - lost_marbles + gained_marbles result = total_marbles return result
-Put each new question in a **new cell** Possible format and solutions are: --- Jim collects 36 stamps and gives 12 of them to his friend. He then buys 8 more stamps and trades 4 of them for different ones. How many stamps does he have left?
def solve() -> int: stamps = 36 stamps = stamps - 12 stamps = stamps + 8 stamps = stamps - 4 result = stamps return result