question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Jane reads 17 pages of a history book on weekdays and 22 pages on weekends. If it takes 4 weeks for Jane to finish her history book, how many pages that history book has?
def solve() -> int: weekday_pages = 17 weekend_pages = 22 weeks = 4 weekly_pages = weekday_pages * 5 + weekend_pages * 2 total_pages = weekly_pages * weeks result = total_pages return result
Ella's savings are 5/6 of what they used to be and Fred's savings are now half of what Ella used to have. How much do they have in savings combined if Ella used to have $9000?
def solve() -> int: ella_current = 9000 * 5/6 fred_current = 9000 / 2 combined_savings = ella_current + fred_current result = combined_savings return result
Student: A store restocks all of its merchandise every Monday. During the week, the store sold 10 baseballs, 16 basketballs, and 8 footballs. How many sports balls did the store need to restock on Monday?
def solve() -> int: baseballs_sold = 10 basketballs_sold = 16 footballs_sold = 8 total_sports_balls_sold = baseballs_sold + basketballs_sold + footballs_sold sports_balls_to_restock = total_sports_balls_sold result = sports_balls_to_restock return result
Rachel is going on a camping trip and needs to pack food. For every day, she needs 2 cans of soup, one-third as many cans of vegetables as soup, and 1/5 the number of cans of fruit as vegetables. If Rachel is camping for 5 days, how many cans of fruit does she need to pack?
def solve() -> int: days = 5 soup_per_day = 2 vegetables_per_day = soup_per_day / 3 fruit_per_day = vegetables_per_day / 5 total_fruit = fruit_per_day * days result = total_fruit return result
Kevin and Laura are making paper planes. Kevin makes 42 and then Laura makes 3/4 as many as Kevin. They each throw one plane away because they are not satisfied with them. Then they each fold one more plane. How many planes do they have on average?
def solve() -> int: kevin = 42 laura = 3/4 * kevin kevin -= 1 kevin += 1 laura -= 1 laura += 1 average = (kevin + laura) / 2 result = average return result
3 of each of the turtle's 20 eggs did not hatch. What percentage of the eggs hatched successfully?
def solve() -> int: total_eggs = 20 unhatched_eggs = 3 hatch_success = total_eggs - unhatched_eggs total_success_percentage = hatch_success / total_eggs * 100 result = total_success_percentage return result
Student: Mrs. Wong has some cupcakes, 10 cookies and some muffins. She has 2 times as many cupcakes as cookies and 4 times as many muffins as cupcakes. How many muffins does she have?
def solve() -> int: cupcakes = 0 cookies = 10 muffins = 0 cupcakes = cookies * 2 muffins = cupcakes * 4 result = muffins return result
A notebook costs $2.50. If you want to buy 5 notebooks, how much money will you need, including tax if there is a 6% sales tax?
def solve() -> int: total_cost = (2.50*5)*(1 + 0.06) result = total_cost return result
David and Emma are siblings. David’s age is 3 years more than twice Emma’s age. The sum of their ages is 31 years. Find the ages of David and Emma.
def solve() -> int: total_age = 31 david_age = (total_age - 3)/3 emma_age = total_age - david_age result = (david_age, emma_age) return result
Andrew is a photographer and has been hired to photograph a wedding. The only camera he has limited stock of is his film camera and he counts how much he needs. Each roll of film is enough for 24 pictures. Andrew decides to bring 8 rolls of film, each of which has 36 exposures, and this will be the exact amount he need...
def solve() -> int: rolls = 8 exposures_per_roll = 36 total_exposures = rolls * exposures_per_roll pictures_per_exposure = 1 total_pictures = total_exposures * pictures_per_exposure result = total_pictures return result
Student: The art class of Willow High School is making paper flowers for a project. Each flower requires 3 sheets of paper, 2 pipe cleaners, and 1 button. The class has 120 sheets of paper, 80 pipe cleaners, and 40 buttons. How many flowers can they make with the materials they have?
def solve() -> int: paper_per_flower = 3 pipe_cleaners_per_flower = 2 buttons_per_flower = 1 total_paper = 120 total_pipe_cleaners = 80 total_buttons = 40 max_flowers_paper = total_paper // paper_per_flower max_flowers_pipe_cleaners = total_pipe_cleaners // pipe_cleaners_per_flower m...
An online store offers a 20% discount on the first order a customer makes that costs $50 or more. If Jim's first order totals $60, how much will he pay after the discount?
def solve() -> int: first_order = 60 if first_order >= 50: first_order *= 0.8 result = first_order return result
Karen bought some strawberries. She gave a fourth of the strawberries to her brother and then gave away a third of the remaining strawberries. If she had 15 strawberries left, how many did she buy in the beginning?
def solve() -> int: karen_straws = 15 third_left = karen_straws * 3 total_straws = third_left / 4 result = total_straws return result
A store has a sale of 12% off on all items. How much will a customer pay for a $50 item after the sale?
def solve() -> int: discount_percent = 12 original_price = 50 discount_value = original_price * (discount_percent/100) sale_price = original_price - discount_value result = f'Sale price: ${sale_price}' result = sale_price return result
Bingley is driving from London to Manchester, which is a distance of 200 km. If he drives at an average speed of 80 km/h, how long will it take him to reach Manchester?
def solve() -> int: distance = 200 avg_speed = 80 result = distance / avg_speed return result
A music festival charges $50 per ticket for a one-day pass and $120 per ticket for a three-day pass. If they sold 100 one-day passes and 50 three-day passes, how much money did they make?
def solve() -> int: price_ticket_one_day = 50 price_ticket_three_day = 120 quantity_one_day = 100 quantity_three_day = 50 total_sales = price_ticket_one_day*quantity_one_day + price_ticket_three_day*quantity_three_day result = total_sales return result
A basketball team wins 60% of its home games and 20% of its away games. Given that the team played 20 games this season, how many home games did they win?
def solve() -> int: total_games = 20 home_win_rate = 0.6 away_win_rate = 0.2 home_games = total_games/3 away_games = total_games - home_games home_wins = home_win_rate*home_games result = home_wins return result
There are 50 parking spots, 10 of which are for customers with special privileges. What is the percentage of parking spots for customers with special privileges?
def solve() -> int: a = 50 b = 10 percentage = (b/a)*100 result = percentage return result
Max donated 20% of his monthly earnings to a nonprofit organization and used $75 to pay his phone bill. If he has $400 left, how much did he earn in a month?
def solve() -> int: donation_percentage = 20 phone_bill = 75 remaining_amount = 400 total_amount = remaining_amount + phone_bill earnings_before_donation = total_amount / (1 - donation_percentage / 100) result = earnings_before_donation return result
A polo team has 9 players. How many pairs of players can be created?
def solve() -> int: number_of_players = 9 result = number_of_players * (number_of_players - 1) / 2 return result
Alex has to upload all of her pictures on a website. If she can upload 40 pictures per minute, how many hours will it take her to upload all of them?
def solve() -> int: total_pictures = 960 pictures_per_minute = 40 time_to_upload_all = total_pictures / pictures_per_minute hours_to_upload_all = time_to_upload_all / 60 result = hours_to_upload_all return result
Julie is shopping at the mall and has already spent $180. She want to find shoes that cost $50 with additional taxes of 15%. How much money will Julie need total?
def solve() -> int: initial_cost = 180 shoe_cost = 50 tax_rate = 15 tax_amount = shoe_cost * (tax_rate/100) result = initial_cost + shoe_cost + tax_amount return result
Emily bakes a cake and uses 3 eggs for every 2 cups of flour. If she uses 10 cups of flour, how many eggs does she need?
def solve() -> int: flour = 10 eggs_per_flour = 3/2 eggs_needed = flour * eggs_per_flour result = eggs_needed return result
A soccer team had to split 45 oranges between 7 players. How many oranges did each player get?
def solve() -> int: oranges = 45 result = oranges // 7 return result
A farmer has 100 acres of land for his animals to graze. If each animal needs 1/4 acre to graze, how many animals can the farmer have on his land?
def solve() -> int: animals = 100 / 0.25 result = f'The farmer can have {int(animals)} animals on his land' result = int(animals) return result
You are making a loaf of bread using a recipe that requires 3 1/3 cups of flour. If you only have 1/2 cups of flour in your pantry, how many times will you need to multiply the recipe to have enough flour? Round up to the nearest whole number.
def solve() -> int: flour_required_for_one_loaf = 3+1/3 flour_in_pantry = 1/2 loaves_needed = (flour_required_for_one_loaf / flour_in_pantry) loaves_needed = int(loaves_needed)+1 result = loaves_needed return result
A restaurant bill comes out to $52.50. If Carol wants to leave a 20% tip, how much should she tip?
def solve() -> int: bill = 52.50 tip_percent = 0.20 tip_amount = bill * tip_percent result = tip_amount return result
Susan is planning to make a cake for her friend's birthday and she needs to know how many eggs to use. One cake requires 2 eggs. Once Susan knows how many eggs to use, she'll test the recipe. Each day she bDuring the first hour of a concert, the band played 12 songs. In the second hour, the band played 4 more songs tha...
def solve() -> int: eggs_per_cake = 2 total_cakes = 1 total_eggs = eggs_per_cake * total_cakes songs_first_hour = 12 songs_second_hour = (32 - songs_first_hour) / 2 - 4 result = songs_second_hour return result
Tony has a baggie of 50 candies in different colours. He has 15 candies that are red and 10 that are yellow. If Tony takes one candy out, what is the probability it will be either red or yellow?
def solve() -> int: total_candies = 50 red_candies = 15 yellow_candies = 10 red_or_yellow_candies = red_candies + yellow_candies probability = red_or_yellow_candies / total_candies result = probability return result
Andrew went on a road trip. He drove for the first 2 hours at a speed of 60 mph, needing to take a break. After a 30-minute break he drove for 2 more hours at a speed of 45 mph. What distance did he cover?
def solve() -> int: speed1 = 60 speed2 = 45 time1 = 2 time2 = 2 + 0.5 distance1 = speed1 * time1 distance2 = speed2 * time2 total_distance = distance1 + distance2 result = total_distance return result
Anna sold a total of 180 cupcakes and cookies at a bake sale. She sold cupcakes for $3 each and cookies for $1 each. She sold 3 times as many cookies as cupcakes. How much money did Anna make from the bake sale?
def solve() -> int: result = 135 + 135 return result
A bookstore sells 300 books a month. If the bookstore has a 15% increase in sales, how many books are sold in the second month?
def solve() -> int: increase = 300 * 0.15 total_sales = 300 + increase result = total_sales return result
A farmer has 22 parcels of land of the same size. If each parcel produces 3 kilograms of corn, how much corn does the farmer produce in total?
def solve() -> int: total = 0 for i in range(22): total = total + 3 result = total return result
am makes pizza for a party. He uses 2 cups of cheese for each pizza. He makes 10 pizzas. A 16-ounce package of cheese costs $4. How much does it cost?
def solve() -> int: ounces_to_cups = 0.0625 cheese_per_pizza = 2 total_pizzas = 10 total_cheese = cheese_per_pizza * total_pizzas cheese_per_package = 16 * ounces_to_cups packages_of_cheese = total_cheese / cheese_per_package cost_per_package = 4 total_cost = packages_of_cheese * cost_pe...
Cindy has 3 bags of candies, each with 15 candies inside. She wants to share them equally with her 5 friends, including herself. How many candies will each person get?
def solve() -> int: candies = (3 * 15) / 5 result = candies return result
Adam tried to improve his running distance, but his progress fluctuated. Firstly, he ran an extra 3 km. Next, he reduced his running distance by half of the extra distance he ran. After that, he ran three times more than the initial extra distance. But finally, he decreased his distance by one-third of the initial extr...
def solve() -> int: initial_distance = 10 extra_distance = 3 new_distance = initial_distance + extra_distance reduced_distance = new_distance - (extra_distance / 2) increased_distance = 3 * extra_distance final_distance = increased_distance - (extra_distance / 3) + reduced_distance result = ...
Jack puts $50 in his piggy bank every month for 4 years to save up for a car. He had to spend $1000 from his piggy bank savings last week to repair his house. How many dollars are left in his piggy bank?
def solve() -> int: amount_per_month = 50 no_of_month = 48 saving_before_repair = no_of_month * amount_per_month repair_cost = 1000 result = saving_before_repair - repair_cost return result
A library has 1239 books on its shelves. Each shelf can fit 27 books. How many shelves are there in total?
def solve() -> int: total_books = 1239 books_per_shelf = 27 total_shelves = total_books // books_per_shelf result = total_shelves return result
- Anna has 24 stickers and sticks them on 6 cards. She sticks the same number of stickers on each card. How many stickers does she stick on each card?
def solve() -> int: stickers_per_card = 24 / 6 result = stickers_per_card return result
There were 8 students in a class, and each student bought 4 textbooks costing $25 each. How much did they spend on textbooks altogether?
def solve() -> int: studentNum = 8 textbookCost = 25 textbookNum = 4 result = (studentNum * textbookNum)*textbookCost return result
Harry has 3 apples and Sara has 5 apples. How many more apples does Sara have than Harry?
def solve() -> int: apples_harry = 3 apples_sara = 5 more_apples = apples_sara - apples_harry result = more_apples return result
A train starts at a speed of 30 mph and then increases its speed by 5 mph every hour. How long does it take the train to reach a speed of 80 mph?
def solve() -> int: time_elapsed = 0 speed = 30 while speed < 80: speed += 5 time_elapsed += 1 result = time_elapsed return result
Student: In a school, 3/5 of the students are girls and the rest are boys. There are 150 more girls than boys. How many students are in the school?
def solve() -> int: girls = 0 boys = 0 girls = (3/5) * (girls + boys) boys = girls - 150 result = girls + boys return result
A recipe makes 20 cookies and requires 2 eggs. How many eggs are needed to make 60 cookies using the same recipe?
def solve() -> int: num_cookies = 60 eggs_per_cookie = 2/20 total_eggs = eggs_per_cookie*num_cookies result = total_eggs return result
Kevin and Lisa invested money in a new project. If Kevin invested $7000 and Lisa invested 2/3 of what Kevin invested, find the total amount they invested.
def solve() -> int: lisa_investment = 2/3 * 7000 total_investment = lisa_investment + 7000 result = total_investment return result
Samantha is going on vacation to the beach. She bought a new bikini for $50 and sunglasses, which were 30% of the price of the bikini. She also rented a surfboard for $80, but got a $20 discount for renting it for a week. How much did Samantha spend in total for her beach trip?
def solve() -> int: bikini_price = 50 sunglasses_price = 0.3 * bikini_price surfboard_price = 80 - 20 total_spent = bikini_price + sunglasses_price + surfboard_price result = total_spent return result
A cake recipe requires 2 cups of flour for every 1 egg. If the recipe calls for 12 eggs, how many cups of flour are needed?
def solve() -> int: eggs_required = 12 flour_per_egg = 2 flour_required = eggs_required * flour_per_egg result = flour_required return result
A triangle has a base of 10 cm and a height of 15 cm. What is the area of the triangle?
def solve() -> int: triangle_base = 10 triangle_height = 15 triangle_area = 0.5*triangle_base*triangle_height result = f'The area of the triangle is {triangle_area} square cm' result = triangle_area return result
Mary wants to purchase a gym membership. The gym charges $50/month or $250 for a 6-month membership. If Mary plans to go to the gym for 8 months, how much money will she save by paying for a 6-month membership?
def solve() -> int: months = 8 monthly_cost = 50 six_month_cost = 250 eight_month_cost = months * monthly_cost savings = eight_month_cost - six_month_cost result = savings return result
Jack is paid $25 per hour of work and he works 9 hours a day for a whole week. He received an extra bonus of $260 for completing extra tasks in the week. Calculate the total amount of money Jack would earn at the end of the week.
def solve() -> int: hourly_wage = 25 hours_worked_per_day = 9 days_of_the_week = 7 bonus = 260 total_hours = hours_worked_per_day * days_of_the_week total_earnings = hourly_wage * total_hours + bonus result = total_earnings return result
A survey found that only 35% of the 400 employees prefer an employer-sponsored healthcare system. How many employees do not prefer the healthcare system?
def solve() -> int: x = 400 y = 0.35 prefer = x * y not_prefer = x - prefer result = not_prefer return result
Peter and Anna took a taxi to the airport. When they arrived, Peter added a 18% tip of $14. Anna said that the driver was very friendly and they should leave a 22% tip instead. How much is a 22% tip?
def solve() -> int: tip_percentage = 22 total_bill = 14 / (tip_percentage / 100) result = total_bill return result
The speed of a train is 120 km/h. If the train travels for 6 hours a day, how many km does it travel in a week?
def solve() -> int: speed = 120 hours_per_day = 6 days_per_week = 7 distance_per_day = speed * hours_per_day distance_per_week = distance_per_day * days_per_week result = distance_per_week return result
A recipe calls for 2 and two-thirds cups of flour and the flour is sold in bags of two cups. How many bags will you need to buy?
def solve() -> int: num_of_cups = 2+2/3 num_of_bags = num_of_cups/2 result = num_of_bags return result
If a product is sold at a 20% discount, the selling price will be $240. What was the original price?
def solve() -> int: selling_price = 240 original_price = selling_price/(1 - 0.20) result = original_price return result
A rectangular field is 30 meters long and 40 meters wide. A fence is built around the field. If the fence is 2 meters high and costs $10 per meter to build, what is the total cost of the field including the fence?
def solve() -> int: length = 30 width = 40 height = 2 cost_per_meter = 10 perimeter = 2 * (length + width) fence_cost = perimeter * height * cost_per_meter field_cost = length * width * cost_per_meter total_cost = fence_cost + field_cost result = total_cost return result
A tree frog needs to climb a 5-story building, which is 75 feet tall. The tree frog can jump 3 feet tall and needs to rest for a foot for every story it moves. How many jumps does the tree frog need to make to get to the top of the building?
def solve() -> int: stories = 5 height = 75 jump_height = 3 rest_height = 1 total_feet = 0 jumps = 0 for story in range(stories): total_feet += jump_height + rest_height jumps += 1 while total_feet < height: total_feet += jump_height jumps += 1 ...
Jackson rides his bike for 15 minutes every day on weekdays. On the weekends he bikes an additional 3 hours in total. How many hours does he ride his bike in a year?
def solve() -> int: weekdays_minutes = 15 weekend_hours = 3 weekdays_hours = weekdays_minutes / 60 weekend_minutes = weekend_hours * 60 weekend_days = 2 weekend_total_minutes = weekend_minutes * weekend_days weekend_total_hours = weekend_total_minutes / 60 total_hours = (weekdays_ho...
At a shoe store, the cost of two pairs of sneakers is equal to the cost of one pair of boots. If one pair of sneakers costs $50, how much does a dozen pairs of boots cost, in dollars?
def solve() -> int: sneakers_cost = 50 pairs_of_sneakers = 2 pairs_of_boots = 1 cost_of_boots = (sneakers_cost * pairs_of_sneakers) / pairs_of_boots dozen_pairs_of_boots_cost = cost_of_boots * 12 result = dozen_pairs_of_boots_cost return result
A container is filled with three different types of beans with a ratio of 3:2:1. If the total weight of the container is 1800 grams and one type of bean weighs 400 grams, what was the weight of the entire container before filling?
def solve() -> int: bean1_weight = 400 total_ratio = 3 + 2 + 1 total_weight = 1800 / (2 + 3 + 1) bean1_total_weight = bean1_weight / 3 container_weight = total_weight * total_ratio + bean1_total_weight result = container_weight + bean1_weight return result
Larry has a garden with 8 types of vegetable. He grows 5 rows of the garden, with 16 vegetables in each row. He has 8 times more red vegetables than blue vegetables, and 6 times more yellow vegetables than blue vegetables. How many blue vegetables does Larry have?
def solve() -> int: veggies_row = 16 rows = 5 red = 8 yellow = 6 total_red_veggies = red * (rows * veggies_row) total_yellow_veggies = yellow * (rows * veggies_row) total_veggies = (rows * veggies_row) * (1 + red + yellow) result = total_veggies -...
A class of 25 students took a math test. The average score of the class was 80. The teacher noticed that one student's score was entered incorrectly as 100, when it should have been 40. What was the correct average score of the class after correcting the mistake?
def solve() -> int: total_students = 25 original_average = 80 wrong_score = 100 correct_score = 40 original_total = total_students * original_average correct_total = original_total - wrong_score + correct_score correct_average = correct_total / total_students result = correct_average...
Student: A bakery has 80 cupcakes that cost $0.50 each to make. They will sell the cupcakes for $1.00 each. What is the total profit?
def solve() -> int: cupcakes = 80 cost = 0.50 price = 1.00 profit = 0 total_cost = cupcakes * cost total_revenue = cupcakes * price profit = total_revenue - total_cost result = profit return result
Noah has a rectangular garden that is 6 meters long and 4 meters wide. He wants to plant sunflowers along the perimeter of the garden. Each sunflower seed costs $0.05 and he needs to plant one seed every 0.5 meters. How much does he need to spend on sunflower seeds for his garden?
def solve() -> int: perimeter = (6 + 4) * 2 seeds = perimeter / 0.5 cost = seeds * 0.05 result = cost return result
Possible new questions and programs: A bakery sells muffins and cookies. The cost of three muffins is equal to the cost of four cookies. If one cookie costs $0.75, how much does six muffins cost, in dollars?
def solve() -> int: cost_of_muffin = 0.75 * 4 / 3 cost_of_six_muffins = cost_of_muffin * 6 result = cost_of_six_muffins return result
Mr. Thompson delivers pizza twice a day. Yesterday morning, he delivered 16 pizzas and in the evening, he delivered 24 pizzas. This morning, he delivered 9 pizzas fewer than he did yesterday morning. After delivering some pizzas in the afternoon, Mr. Thompson has only 4 pizzas left. If each pizza costs $12.50, how much...
def solve() -> int: morning_delivery = 16 evening_delivery = 24 afternoon_delivery = morning_delivery - 9 total_delivery = morning_delivery + evening_delivery + afternoon_delivery remaining_pizzas = 4 total_pizzas = total_delivery - remaining_pizzas cost_per_pizza = 12.50 revenue = total...
A tech conference is to be held in a convention center. Each company can send up to five representatives. One-tenth of the total number of attendees will be speakers. The organizers will also invite 30 journalists and double the number of booth operators. If there are 200 companies participating, how many chairs must b...
def solve() -> int: num_companies = 200 num_representatives = 5 num_attendees = num_companies * num_representatives num_speakers = num_attendees // 10 num_journalists = 30 num_booth_operators = num_attendees * 2 total_attendees = num_attendees + num_speakers + num_journalists + num_booth_ope...
A car traveled 1500 miles in 25 hours. If the car traveled at a constant speed for the entire trip, how many miles per hour was it traveling?
def solve() -> int: distance = 1500 time = 25 speed = distance/time result = speed return result
A project requires 60 machine hours and 100 man hours. If there are 5 machines and 6 workers available, what is the total time needed to complete the project assuming all machines and workers are being used at maximum efficiency?
def solve() -> int: machine_hours_required = 60 man_hours_required = 100 available_machines = 5 available_workers = 6 machine_efficiency = 1 man_efficiency = 1 total_machines_efficiency = machine_efficiency * available_machines total_man_efficiency = man_efficiency * available_workers ...
Justin went to buy a toy car for his nephew. The toy car cost him $55. If the toy car was initially sold for $65 and Justin received a 15% discount, how much did he save?
def solve() -> int: original_price = 65 discount_percentage = 0.15 discount = original_price * discount_percentage total_cost = original_price - discount savings = original_price - total_cost result = savings return result
A teacher wants to buy school supplies for 25,000 dollars. They have already raised 12,000 dollars. They plan to sell chocolate bars for 2 dollars each, and want to know how many they need to sell to reach their goal.
def solve() -> int: total_needed = 25000 total_raised = 12000 supplies_needed = total_needed - total_raised bars_needed = supplies_needed / 2 result = bars_needed return result
Tim aims to practice playing guitar for a total of 20 hours. He practices for 2 hours every after 20 minutes. How many minutes will it take him to reach his target practice time?
def solve() -> int: total_hours = 20 practice_time = 2 practice_interval = 20 num_sessions = total_hours / (practice_time / 60) total_time = num_sessions * practice_interval result = total_time return result
ven has $9. He buys a drink that costs $2.50 and 3 chips that each cost $1. What is the total amount of money that Steven spent?
def solve() -> int: money = 9 cost_drink = 2.50 cost_chips = 1 * 3 total_cost = cost_drink + cost_chips result = total_cost return result
John has twice as much money as Jane. If Jane has $30, how much money does John have?
def solve() -> int: jane_money = 30 john_money = 2 * jane_money result = john_money return result
A carpenter made 8 chairs and each chair cost 8.50. How much did the carpenter make in total?
def solve() -> int: numberChairs = 8 priceChairs = 8.50 totalMade = numberChairs * priceChairs result = totalMade return result
20 glasses of water are poured into a bucket. If each glass contains 250 ml of water and 2 glasses are taken out, how much water is left?
def solve() -> int: glasses = 20 ml = 250 taken = 2 remaining = glasses * ml - taken result = remaining return result
Student: 40% of the people in the classroom are wearing glasses. If there are 90 people in the classroom, how many people are wearing glasses?
def solve() -> int: total_people = 90 people_wearing_glasses = total_people * 0.4 people_wearing_glasses = round(people_wearing_glasses) result = people_wearing_glasses return result
On a dinner plate, there are 8 slices of pizza, each slice has 8 small triangles. Tina eats 4 slices of pizza, how many small triangles did she eat in total?
def solve() -> int: total_triangles = 0 for i in range(4): total_triangles = total_triangles + (i+1) * 8 result = total_triangles return result
Jake and Mike have 800 marbles in total. If Jake has 30% more marbles than Mike, how many marbles does each have?
def solve() -> int: total_marbles = 800 jakes_marbles = (1+0.3)/(2.3)*total_marbles mikes_marbles = total_marbles - jakes_marbles result = (jakes_marbles, mikes_marbles) return result
A group of ten friends decide to share a cake equally among them. If the cake weighs 1.5 pounds, how much cake will each person get?
def solve() -> int: num_friends = 10 cake_weight = 1.5 cake_per_person = cake_weight / num_friends result = cake_per_person return result
Derrick had 20 doughnuts which he shared equally with 5 of his friends. How many doughnuts did each of his friends get?
def solve() -> int: n_doughnuts_initially = 20 n_friends = 5 n_doughnuts_per_friend = n_doughnuts_initially / n_friends result = n_doughnuts_per_friend return result
Student: 7. Among 15 friends, 8 said they like football, 6 said they like basketball, and 6 said they like both. How many people do not like either of these two sports?
def solve() -> int: num_friends = 15 num_likes_football = 8 num_likes_basketball = 6 num_likes_both = 6 num_likes_neither = num_friends - num_likes_football - num_likes_basketball + num_likes_both result = num_likes_neither return result
Possible questions and programs are: Jack collects stamps and he wants to trade some with his friend Jill. Jack has 36 stamps from Canada, 24 from Mexico, and 18 from Japan. He agrees to give Jill 25% of his Canadian stamps, 40% of his Mexican stamps, and 15% of his Japanese stamps. What percentage of Jack's remaining ...
def solve() -> int: canada_trade = 0.25 * 36 mexico_trade = 0.4 * 24 japan_trade = 0.15 * 18 canada_keep = 36 - canada_trade mexico_keep = 24 - mexico_trade japan_keep = 18 - japan_trade total_keep = canada_keep + mexico_keep + japan_keep perc_japan = japan_keep / total_keep * 100...
Mary plans to knit enough socks for her family for the winter. She estimates that a tenth of the socks will be too small or unwearable. Each ball of yarn can make 4 socks. How many balls of yarn should Mary buy?
def solve() -> int: total_socks = 0 unwearable_socks = 0 balls_of_yarn = 0 total_socks = 10 * 4 unwearable_socks = total_socks / 10 wearable_socks = total_socks - unwearable_socks balls_of_yarn = wearable_socks / 4 result = balls_of_yarn return result
A retail store has 70 televisions, each using 80 watts of power per day, and the electricity bill is twenty-five cents per power watt used. What is the cost of the store's electricity bill in November?
def solve() -> int: tv_count = 70 power_per_tv = 80 power_per_day = tv_count * power_per_tv power_per_month = power_per_day * 30 cost_per_watt = 0.25 total_cost = power_per_month * cost_per_watt result = total_cost return result
John buys a car for $25,000. He takes a loan of $15,000 from a bank with an interest rate of 5% per annum. He sells the car after 2 years for $20,000. How much profit or loss did John make?
def solve() -> int: loan_amount = 15000 interest_rate = 0.05 time_period = 2 car_cost = 25000 total_interest = loan_amount * interest_rate * time_period loan_repayment = loan_amount + total_interest selling_price = 20000 profit_loss = selling_price - (car_cost - loan_repayment) resul...
Sarah and Jake went to a toy store. Sarah bought 5 times as many toys as Jake. If Sarah bought 25 toys, how many toys did Jake buy?
def solve() -> int: jake_toys = 25 / 5 result = jake_toys return result
There are 35 students in David's class. The teacher bought 80 pencils to be split among them. How many pencils will each student receive?
def solve() -> int: num_of_students = 35 num_of_pencils = 80 result = num_of_pencils // num_of_students return result
A can of soda weighs 0.4 pounds, and a bottle of juice weighs 1.2 pounds. If Ashlee buys 12 cans of soda and 9 bottles of juice, how many ounces does she have to carry?
def solve() -> int: soda_weight = 6.4 juice_weight = 10.8 num_soda = 12 num_juice = 9 total_weight = soda_weight * num_soda + juice_weight * num_juice result = total_weight return result
**** An orchard produces oranges at a rate of 847 oranges every 300 seconds. After 900 seconds, how many oranges has the orchard produced?
def solve() -> int: rate = 847/300 oranges = rate * 900 result = 2541 return result
Kevin has 8 fruit trees in his backyard: 3 apple trees, 2 peach trees, and 3 cherry trees. He prunes the apple trees every fall, the peach trees every spring, and the cherry trees once every 2 years. How many times does he prune the trees in a 5-year period?
def solve() -> int: apple_trees = 3 peach_trees = 2 cherry_trees = 3 prune_per_year = apple_trees + peach_trees + cherry_trees/2 prune_per_5_years = prune_per_year * 5 result = prune_per_5_years return result
Justin, Ryan, and Ethan decided to split a taxi ride. Justin travels $6 worth, Ryan travels $12 worth, and Ethan travels $18 worth. How much should each of them pay in tips if they want to split a 10% tip for the whole ride evenly?
def solve() -> int: justin = 6 ryan = 12 ethan = 18 total_cost = justin + ryan + ethan tip = total_cost * 0.1 total_cost_with_tip = total_cost + tip justin_tip = tip / 3 ryan_tip = tip / 3 ethan_tip = tip / 3 result = justin_tip return result
A geometric shape has a perimeter of 20 cm and one side that is 4 cm long. What is the perimeter of the shape if the length of that side is doubled?
def solve() -> int: total_perimeter = 20 original_side_length = 4 new_side_length = original_side_length * 2 new_perimeter = total_perimeter - original_side_length + new_side_length result = new_perimeter return result
If Alice has 30 oranges and she decides to give away 3 oranges to each child in the neighborhood, how many children will she be able to give oranges to?
def solve() -> int: oranges = 30 per_child = 3 children = oranges // per_child result = children return result
Juan has $1200 to spend on a new computer. If he purchased a processor for $180, a monitor for $360, a keyboard for $90, and a mouse for $60, how much money did he have left after the purchase?
def solve() -> int: total_amount = 1200 cost_processor = 180 cost_monitor = 360 cost_keyboard = 90 cost_mouse = 60 total_cost = cost_processor + cost_monitor + cost_keyboard + cost_mouse result = total_amount - total_cost return result
**** Laura has 10 orange jerseys, 4 yellow jerseys, and 3 blue jerseys. What is the total number of jerseys Laura has?
def solve() -> int: orange = 10 yellow = 4 blue = 3 total_jerseys = orange + yellow + blue result = total_jerseys return result
Rina made $150 more than Ty. Ty made one-third as much as Sara. Sara made $300. How much did Rina make?
def solve() -> int: a = 300/3 b = a+150 result = b return result
Ten students and two teachers go on a camping trip and spend $50 on food. If the total cost of the trip is $300, and each teacher's ticket costs $25, how much, in dollars, is each student's ticket?
def solve() -> int: students = 10 teachers = 2 total_cost = 300 food_cost = 50 teacher_ticket_cost = 25 students_ticket_cost = total_cost - (food_cost + (teachers * teacher_ticket_cost)) cost_per_student = students_ticket_cost / students result = cost_per_student retur...
At a store, a customer can buy 2 items in a set at a 10% discounted rate if they are bought together. One item was originally priced at $75, how much would the customer pay in total after the discount?
def solve() -> int: price1_original = 75 price2_original = price1_original discount = 10/100 price1_discounted = price1_original * (1 - discount) price2_discounted = price2_original * (1 - discount) total = price1_discounted + price2_discounted result = total retur...
Jeff earned $60 and also got a bonus of $25. How much money did Jeff earn altogether?
def solve() -> int: total = 0 total = 60 + 25 result = total return result