question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A playground has a total of 300 toys. One-sixth of them are cars and two-thirds of the remaining are dolls. How many dolls are there in the playground?
def solve() -> int: toys = 300 cars = 1/6 * toys remaining = toys - cars dolls = 2/3 * remaining result = dolls return result
Will is buying 8 notebooks and 4 packs of pens for school. The notebooks cost $4 each and the packs of pens cost $2.00 each. If he gets 3 notebooks for the price of 2, how much will he spend in total?
def solve() -> int: cost_notebooks = 4 cost_pens = 2 quantity_notebooks = 8 discount_notebooks = 3 quantity_pens = 4 cost_discount_notebooks = cost_notebooks*(discount_notebooks/3) cost = quantity_notebooks*cost_notebooks + quantity_pens*cost_pens - cost_discount_notebooks resu...
If Liam saves $25 in the bank every month for three years and his sister Olivia saves 1/2 times less money per month than Liam, how much money do they have in their savings account together?
def solve() -> int: liam_monthly_savings = 25 olivia_monthly_savings = liam_monthly_savings / 2 months_in_three_years = 36 liam_total_savings = liam_monthly_savings * months_in_three_years olivia_total_savings = olivia_monthly_savings * months_in_three_years total_savings = liam_total_...
Sam purchased a T-shirt for $20, pants for $35 and shoes for $50. If the store offered a discount of 15%, how much did Sam pay in total?
def solve() -> int: tshirt_price = 20 pants_price = 35 shoes_price = 50 discount = 0.15 total_price = tshirt_price + pants_price + shoes_price discounted_price = total_price * discount final_price = total_price - discounted_price result = final_price return result
Emily works as an event planner. She earns a basic salary of $3500 per month and receives 8% commission on the total cost of the event. Last month, she organized an event worth $50000. If she saves 20% of her earnings, how much did she spend last month?
def solve() -> int: event_cost = 50000 basic_salary = 3500 percent_commission = 8 percent_savings = 20 commission_amount = event_cost * (percent_commission/100) total_earnings = basic_salary + commission_amount savings = total_earnings * (percent_savings/100) expenses = total_earnings - ...
A fruit seller sells 20 kg of apples each day for 5 days at $2.50 per kg. How much money does the seller make in those 5 days?
def solve() -> int: apple_kg_per_day = 20 total_days = 5 price_per_kg = 2.50 total_apple_kg_sold = apple_kg_per_day * total_days total_money_made = total_apple_kg_sold * price_per_kg result = total_money_made return result
Student: David spends 1/4 of his salary on food, 1/3 of his salary on housing, and 1/2 of his salary on other expenses. If his total salary is $25,000, how much does he spend on housing?
def solve() -> int: food_fraction = 1/4 housing_fraction = 1/3 other_fraction = 1/2 salary = 25000 food_expense = salary * food_fraction housing_expense = salary * housing_fraction other_expense = salary * other_fraction result = food_expense + housing_expense + other_expense return...
Student: 9. Paul planted 20 trees. 2 weeks later, he planted 8 more. How many trees does he have now?
def solve() -> int: trees_planted_1 = 20 trees_planted_2 = 8 total_trees = trees_planted_1 + trees_planted_2 result = total_trees return result
Jane is hiking a dangerous trail up a steep hill. She moves 80 feet horizontally for every 200 feet she gains in altitude. If she wants to climb up 1500 feet, how far will she travel horizontally?
def solve() -> int: altitude_gain = 1500 horizontal_distance = (altitude_gain / 200) * 80 result = horizontal_distance return result
Samuel has a watering can with a capacity of 1.5 gallons. He fills it up at the rate of 50 milliliters every 10 seconds. If he fills it for 5 minutes, how many more milliliters does he need to add to fill up the watering can?
def solve() -> int: capacity_gallons = 1.5 fill_rate_milliliters_per_second = 50 / 10 fill_time_minutes = 5 fill_time_seconds = fill_time_minutes * 60 total_fill_milliliters = fill_rate_milliliters_per_second * fill_time_seconds remaining_milliliters = capacity_gallons * 1000 - total_fill_m...
Lisa and Mike have to pay for their daughter's college tuition. They agreed that Lisa would pay 40% of the tuition fee. If the tuition fee is $30,000, how much does Mike need to contribute to cover the cost?
def solve() -> int: tuition_fee = 30000 lisa_contribution = tuition_fee * 0.4 mike_contribution = tuition_fee - lisa_contribution result = mike_contribution return result
Here are some possible questions and programs: Anna has a lemonade stand and sells each cup for 50 cents. She made 12 cups of lemonade in the morning and sold 7 of them. Then she made 8 more cups in the afternoon and sold 5 of them. How much money did she earn in total?
def solve() -> int: price = 0.50 morning_cups = 12 morning_sold = 7 afternoon_cups = 8 afternoon_sold = 5 total_sold = morning_sold + afternoon_sold total_money = total_sold * price result = total_money return result
A farmer is having trouble with his farmyard. He has a total of 92 animals in his chicken and goat collection. When he counted the legs, he found that he had a total of 296 legs. How many goats does he have?
def solve() -> int: from sympy.solvers import solve from sympy import Symbol x = Symbol('x') y = Symbol('y') eq1 = x + y - 92 eq2 = 2*x + 4*y - 296 sol = solve((eq1,eq2), (x,y)) result = sol[y] return result
Student: A book costs $24.95, but the store offers a 40% discount. If the tax rate is 6%, what is the total cost of the book?
def solve() -> int: book_price = 24.95 discount = 0.4 tax_rate = 0.06 discount_amount = book_price * discount discounted_price = book_price - discount_amount tax_amount = discounted_price * tax_rate total_cost = discounted_price + tax_amount result = total_cost return result
ix students participated in a 5 km race. The first student finished the race in 25 minutes, the second student finished the race in 10 minutes, and the third student finished the race in 15 minutes. What time did the fourth student take to finish the race if the following students ran the same amount of time as the pre...
def solve() -> int: time_first = 25 time_second = 10 time_add = time_first - time_second time_third = time_second + time_add time_fourth = time_third + time_add result = time_fourth return result
Joseph has spent 3 hours completing an assignment. If he spends another 2 hours and 15 minutes finishing the assignment, what is the total time in minutes that Joseph spent to complete the assignment?
def solve() -> int: total_time = 3 * 60 + 2 * 60 + 15 result = total_time return result
Student: A lifeguard on duty for 8 hours drinks 3 bottles of water per hour. How many bottles of water does the lifeguard need for their shift?
def solve() -> int: hours = 8 bottles_per_hour = 3 total_bottles = hours * bottles_per_hour result = total_bottles return result
Student: Anya drove her car from her home to her job which was 16 miles away. If she drove her car with an average speed of 28 miles per hour, how many hours did Anya's drive take?
def solve() -> int: distance = 16 speed = 28 time = distance / speed result = time return result
A credit card company charges 16% annual interest rate on unpaid balances. If a customer has an unpaid balance $1,000, how much interest will they owe in one month?
def solve() -> int: unpaid_balance = 1000 annual_rate = 0.16 monthly_rate = annual_rate / 12 interest = unpaid_balance * monthly_rate result = interest return result
Student: James has 6 pencils that cost $1 each. He buys three more pencils. How much money did he spend in total?
def solve() -> int: pencils = 6 cost = 1 total_cost = pencils * cost pencils_bought = 3 cost_bought = pencils_bought * cost new_total_cost = total_cost + cost_bought result = new_total_cost return result
A food truck sells hot dogs for $3 each and hamburgers for $5 each. On Monday, they sold 25 hot dogs and 12 hamburgers. How much money did they make in total?
def solve() -> int: hot_dogs_sold = 25 hamburgers_sold = 12 total_money = hot_dogs_sold * 3 + hamburgers_sold * 5 result = total_money return result
In a basket, there are 6 plums, 1/2 the number of oranges, and twice the number of apples. How many apples are in the basket?
def solve() -> int: plums=6 oranges=plums/2 apples=oranges*2 result = apples return result
Student: Julie bought an item from the store for $67. She spends an additional 23% of the original cost on taxes. How much was the total cost with taxes added?
def solve() -> int: cost = 67 tax_percentage = 23 tax_amount = cost * (tax_percentage/100) total_cost = cost + tax_amount result = total_cost return result
A bakery sells 60 pastries in a day. If the bakery closes for 2 days each month, how many pastries can they sell in 1 year (365 days)?
def solve() -> int: pastries_per_day = 60 days_per_month = 30 closed_days_per_month = 2 total_days_per_year = 365 pastries_per_year = (pastries_per_day * (total_days_per_year - (days_per_month * closed_days_per_month * 12))) + (pastries_per_day * (days_per_month * (12 - closed_days_per_month))) ...
Lucy has 2 packs of stickers with 15 stickers in each pack. She gave Chris 2 more stickers than she gave to Avery. If Lucy gave 5 stickers to Avery, how many stickers does she have left? Samantha bought a phone for $400, which is 25% less than what David paid for the same phone. How much did David pay for his phone?
def solve() -> int: packs_of_stickers = 2 stickers_per_pack = 15 stickers_given_to_avery = 5 total_stickers = packs_of_stickers * stickers_per_pack stickers_given_to_chris = stickers_given_to_avery + 2 stickers_left = total_stickers - (stickers_given_to_avery + stickers_given_to_c...
In a survey, 6/7 of 5000 people answered that they have used smartphones before. How many people have not used smartphones before?
def solve() -> int: people = 5000 fraction_used_smartphones = 6/7 not_used_smartphones = people - people*fraction_used_smartphones result = not_used_smartphones return result
Leslie types at a speed of 40 words per minute. If she works for 8 hours with a 15-minute break every 2 hours, how many words can she type in 6 days?
def solve() -> int: speed_per_min = 40 hours_per_day = 8 num_days = 6 break_in_min = 15 hours_in_2days = hours_per_day * 2 num_of_breaks = hours_in_2days // 2 total_min_for_break = num_of_breaks * break_in_min total_min_for_typing = hours_in_2days * 60 - total_min_for_break word...
Student: A rectangular plot of land is 30 feet wide and 60 feet long. Find the area of the plot?
def solve() -> int: width = 30 length = 60 area = width * length result = area return result
A concert hall has a seating capacity of 1,000, but only 60% of the seats were occupied for a classical music concert. Because of an emergency, 80 people had to leave early. How many people stayed until the end of the concert?
def solve() -> int: seating_capacity = 1000 occupied_seats = seating_capacity * 0.6 early_leavers = 80 people_stayed = occupied_seats - early_leavers result = people_stayed return result
A recipe calls for 1 1/4 cups of flour to make 24 cookies. How many cups of flour are needed to make 72 cookies?
def solve() -> int: cookies_needed = 72 flour_per_cookie = 1.25 / 24 flour_needed = flour_per_cookie * cookies_needed result = flour_needed return result
A company produces 1500 units in 8 hours. At this rate, how many units will they produce in a 40 hour week?
def solve() -> int: rate = 1500/8 time = 40 units = rate * time result = units return result
Student: A year has 365 days. How many hours are there in a year?
def solve() -> int: days_in_year = 365 hours_in_day = 24 hours_in_year = days_in_year * hours_in_day result = hours_in_year return result
Possible additional questions and programs: - A pack of yogurt cups contains 12 cups and costs $4.80. 4 friends want to each eat 3 cups. How much money will they spend in total?
def solve() -> int: cost_per_cup = 4.8 / 12 cups_eaten = 4 * 3 total_cost = cost_per_cup * cups_eaten result = total_cost return result
John works at a pet store. There are 12 birds and 7 snakes in the store. Each bird has 2 claws, and each snake has 20 scales. How many claws and scales does John need to handle?
def solve() -> int: num_birds = 12 num_snakes = 7 bird_claws = 2 snake_scales = 20 total_claws = num_birds * bird_claws total_scales = num_snakes * snake_scales result = total_claws + total_scales return result
Jane can sew 100 dresses a day. She buys the fabric for $10 per dress. She sells the dresses for $25 each. She could sell 120 dresses a day if she could sew more. How much money does she save a week by not buying more fabric?
def solve() -> int: dresses_per_day = 100 fabric_per_dress = 10 sell_per_dress = 25 sales_per_day = 120 days_per_week = 7 revenue_per_dress = sell_per_dress - fabric_per_dress revenue_per_day_100 = revenue_per_dress * dresses_per_day revenue_per_day_120 = revenue_per_dress...
John wants to buy a bag of candy that costs $4.59. He has $10. How much change will he get back?
def solve() -> int: money_left = 10 - 4.59 result = money_left return result
Emily spent 2/5 of her allowance on a book and used the remaining $9 to buy a toy. How much was her allowance?
def solve() -> int: remaining_money = 9 percent_spent = 2/5 total_money = remaining_money / percent_spent result = total_money return result
Student: Susan is making necklaces with a repeating pattern that has 2 green beads, 4 yellow beads, and 3 times as many red beads as green beads. If the pattern repeats four times per necklace and she wants to make 5 necklaces, how many beads does she need?
def solve() -> int: green_beads = 2 yellow_beads = 4 red_beads = 3 * green_beads repeats = 4 necklaces = 5 beads_needed = green_beads * repeats * necklaces + yellow_beads * repeats * necklaces + red_beads * repeats * necklaces result = beads_needed return result
Mike bought 15 shares of a company at $50 per share. The company's dividend yield is 4%. What is the total dividend that Mike will receive annually?
def solve() -> int: number_of_shares = 15 price_per_share = 50 dividend_yield = 0.04 annual_dividend = number_of_shares * price_per_share * dividend_yield result = annual_dividend return result
A student needs to get a score of 80 or higher on his math final exam to pass the class. If he scored a 75 on the first exam and a 78 on the second exam, what is the minimum score he needs to get on the final exam to pass the class?
def solve() -> int: required_grade = 80 exam1_score = 75 exam2_score = 78 total_possible_points = required_grade * 3 points_earned = exam1_score + exam2_score points_needed = total_possible_points - points_earned min_grade_needed = points_needed / 3 result = min_grade_needed return r...
A company has a total budget of $50,000. It spends 30% of its budget in the first quarter and 40% of the remaining budget in the second quarter. What is the total amount of money spent by the company after the second quarter?
def solve() -> int: budget = 50000 spent_first_quarter = budget * 0.30 remaining_budget = budget - spent_first_quarter spent_second_quarter = remaining_budget * 0.40 total_spent = spent_first_quarter + spent_second_quarter result = total_spent return result
Becky has a jar with 50 beads. She takes out 25 and adds 10 more. How many beads are in the jar now?
def solve() -> int: beads = 50 beads = beads - 25 beads = beads + 10 result = beads return result
Student: 1. Marie has 3 different containers with capacities of 2, 4, and 5 liters, respectively. Right now, all of the containers have 2 liters of water in them. If she decides to equal out the water among all the containers, how much water will remain in the 5-liter container?
def solve() -> int: container_1 = 2 container_2 = 4 container_3 = 5 water_1 = 2 water_2 = 2 water_3 = 2 total_water = water_1 + water_2 + water_3 total_capacity = container_1 + container_2 + container_3 result = total_capacity - total_water return result
A car is traveling at 60km/h for 2 hours. How far has it traveled in total?
def solve() -> int: speed = 60 time = 2 distance = speed * time result = distance return result
amira made some bracelets to sell at a craft fair. She used $18 worth of beads and $12 worth of elastic. If each bracelet used 0.2 yards of elastic and the elastic cost $0.30 per yard, how many bracelets did she make?
def solve() -> int: elastic_yards = 12 / 0.30 brackets = elastic_yards / 0.2 result = brackets return result
Sarah runs at a pace of 8 minutes per mile. If she ran for 1 hour and 20 minutes, how many miles did she run?
def solve() -> int: total_time = 80 pace = 8 num_miles = total_time/pace result = num_miles return result
Leo loves painting and wants to finish a mural on his wall. He can paint 2 square meters of the wall per hour. He already painted 6 square meters on the first day and plans to paint 20% more each day. How many hours will he spend painting in total during the first week?
def solve() -> int: day = 1 area = 6 time = 3 while day < 7: area = area + area * 0.2 time = time + area / 2 day = day + 1 time = round(time, 2) result = time return result
Emy wants to build a rectangular swimming pool that is 30 m long, 10 m wide and 3 m deep. She can buy aquatic plants in 5 sq m packages at $50 per package. How much will it cost Emy to cover the pool floor with plants?
def solve() -> int: surface_area = 30*10 packages = surface_area/5 package_cost = packages * 50 result = package_cost return result
The Handyman Service charges $25 per hour for labor, plus a $15 flat fee for materials. If they work on 12 different projects in one month, and each project takes an average of 3 hours to complete, what was their total income for the month?
def solve() -> int: hourly_rate = 25 material_fee = 15 projects = 12 average_hours = 3 labor_income = hourly_rate * (projects * average_hours) material_income = material_fee * projects total_income = labor_income + material_income result = total_income ...
A restaurant ordered 400 pounds of fish, but due to storms, the fishermen only caught 60% of their usual catch. If each dish requires 2 pounds of fish, how many dishes can the restaurant make?
def solve() -> int: fish_ordered = 400 catch_percentage = 0.6 fish_caught = fish_ordered * catch_percentage dishes_per_fish = 2 dishes = fish_caught / dishes_per_fish result = dishes return result
Ava is measuring the temperature of a glass of juice. The juice was at 18 degrees Celsius at the start. It increased by 10 degrees Celsius in the first hour. It increased by 5 degrees Celsius in both the second and third hour. What is the average temperature increase per hour?
def solve() -> int: start_temp = 18 hour1_increase = 10 hour2_increase = 5 hour3_increase = 5 total_increase = hour1_increase + hour2_increase + hour3_increase average_increase = total_increase / 3 result = average_increase return result
At a book fair on the opening day, 80 novels were sold. The following day, 30 more novels were sold than the first day. On the third day, the fair sold 2 times the number of novels sold on the second day. How many novels were sold during the fair?
def solve() -> int: first_day = 80 second_day = first_day + 30 third_day = 2 * second_day total_sold = first_day + second_day + third_day result = total_sold return result
Olivia is a seamstress. She can sew 4 dresses per day. She gets paid $25 for each short dress and $35 for each long dress. Olivia works for 8 hours per day. If she always sews the maximum number of dresses possible and half of the dresses she sews are long dresses, how much money does she make in a week where she works...
def solve() -> int: dresses_per_day = 4 hours_per_day = 8 short_dress_payment = 25 long_dress_payment = 35 days_per_week = 5 total_dresses = dresses_per_day * hours_per_day * days_per_week long_dresses = total_dresses / 2 short_dresses = total_dresses / 2 total_payment = (s...
A manufacturer produces 27 radios and 42 TVs in a single day. If the total production time for both was 36 hours, how many hours did it take to make each radio?
def solve() -> int: time_per_radio = 36.0 / 27 result = time_per_radio return result
John has some bronze pennies. If he spends them in a shop, they are worth the regular amount. If he melts them down, he can get $50 per ounce. Each penny weighs 1/10 of an ounce. How many times more money would he get from melting them down instead of spending them in a shop?
def solve() -> int: pennies = 1000 worth_spending = pennies * 0.01 weight = pennies * 0.1 worth_melting = weight / 16 * 50 times_more = worth_melting / worth_spending result = times_more return result
Oscar invested $32,000 in the stock market and earned 9% in one year. How much money did he earn?
def solve() -> int: investment = 32000 interest_rate = 9 gain = investment * (interest_rate/100) result = gain return result
Below are 10 possible math questions and python programs to solve them: The Larkspur lake has six times as many ducks as the Meadowbrook pond. If there are 15 ducks in Meadowbrook pond, how many ducks would remain in Larkspur lake if half of the ducks fly away for the winter?
def solve() -> int: meadowbrook_ducks = 15 larkspur_ducks = 6 * meadowbrook_ducks larkspur_ducks_after = larkspur_ducks - (larkspur_ducks / 2) result = larkspur_ducks_after return result
Two plus two times two is what number?
def solve() -> int: two_plus_two = 2 + 2 two_times_two = two_plus_two * 2 result = two_times_two return result
There are 320 chairs in a room. On Monday, 140 chairs were moved to the classroom next door. On Wednesday, 30 chairs were moved back. On Thursday, another 10 chairs were moved. How many chairs are still in the room?
def solve() -> int: num_chairs = 320 num_moved1 = 140 num_moved2 = 30 num_moved3 = 10 total_moved = num_moved1 + num_moved2 + num_moved3 result = num_chairs - total_moved return result
Nate is making a pizza. He wants to use 2/3 of the dough to make the pizza crust, throw away 1/5 of the cheese that has gone bad, and save the rest for future pizzas. If he has a total of 2 pounds of dough and 1 pound of cheese, how many pounds of cheese will he throw away?
def solve() -> int: dough = 2 cheese = 1 dough_for_crust = dough * (2/3) cheese_thrown_away = cheese * (1/5) result = cheese_thrown_away return result
Student: Jack bought a laptop for $899. He then negotiated and got a 7% discount for it. How much did he pay for the laptop?
def solve() -> int: price = 899 discount = 0.07 discounted_price = price * (1 - discount) result = discounted_price return result
A student reads 20 pages in the morning and 30 pages in the evening. How many days will it take for the student to read a 500-page book?
def solve() -> int: morning_pages = 20 evening_pages = 30 total_pages = 500 pages_per_day = morning_pages + evening_pages days = total_pages / pages_per_day result = days return result
There are 15 students in a class. The average salary of 9 of them is $50,000 per year. If the average salary of 6 other students is $70,000 per year, what is the overall average salary of the class?
def solve() -> int: total_salary_1 = 9 * 50000 total_salary_2 = 6 * 70000 new_total_salary = total_salary_1 + total_salary_2 overall_average_salary = new_total_salary / 15 result = overall_average_salary return result
Harry bought three more times as many balloons as Jenny, who bought five balloons. How many balloons did Harry buy?
def solve() -> int: jenny_balloons = 5 harry_balloons = 3 * jenny_balloons result = harry_balloons return result
John saves $10 a day for three weeks. Over the next month, he saves the same total amount as the first three weeks. In the next two weeks, he saves $20 a day. What is his average savings per week over this period of 7 weeks?
def solve() -> int: savings_first_three_weeks = 10 * 7 * 3 savings_next_month = savings_first_three_weeks savings_last_two_weeks = 20 * 7 * 2 total_savings = savings_first_three_weeks + savings_next_month + savings_last_two_weeks average_savings_per_week = total_savings / 7 ...
Daniel is trying to lose weight and has set a goal of losing 5 pounds per month for 6 months. If he loses 3 pounds in the first month, how much weight does he need to lose per month for the remaining 5 months to reach his goal?
def solve() -> int: goal_weight_loss = 5 * 6 weight_loss_first_month = 3 remaining_months = 5 remaining_weight_loss = goal_weight_loss - weight_loss_first_month weight_loss_per_month = remaining_weight_loss / remaining_months result = weight_loss_per_month return result
Student: A team of 12 engineers is working on a project. Each engineer will spend 200 hours on the project. They want to finish the project in 6 months. How many hours will each engineer need to work per month in order to achieve this goal?
def solve() -> int: total_hours = 200 total_engineers = 12 total_months = 6 hours_per_month = total_hours / (total_engineers * total_months) result = hours_per_month return result
Student: Mr. Adams has two identical 5-story buildings. The first floor has 4 apartment units while the rest of the floors have 7 apartment units on each floor. How many apartment units does Mr. Adams have in all?
def solve() -> int: num_buildings = 2 num_floors = 5 num_units_first_floor = 4 num_units_other_floors = 7 total_units = num_buildings * (num_units_first_floor + (num_floors - 1) * num_units_other_floors) result = total_units return result
Tom buys seven gold rings at $500 each and three diamond necklaces at $1200 each. He gets a 20% discount on all the items he purchased. How much does he pay in all?
def solve() -> int: gold_ring_price = 500 diamond_necklace_price = 1200 gold_ring_quantity = 7 diamond_necklace_quantity = 3 discount_percentage = 20 gold_ring_total_price = gold_ring_price * gold_ring_quantity diamond_necklace_total_price = diamond_necklace_price * diamond_ne...
A class has 40 students. If 15% of them are absent, how many students are present?
def solve() -> int: students_total = 40 absent_students = students_total*0.15 present_students = students_total - absent_students result = present_students return result
Student: David and Emma are saving money for a vacation. David saves $100 every month, while Emma saves $80 every month plus $20 for every book she reads. If they both want to save $1500 and Emma reads 2 books per month, how many months will it take them to reach their goal?
def solve() -> int: david_monthly_savings = 100 emma_monthly_savings = 80 emma_book_savings = 20 goal = 1500 emma_books_per_month = 2 total_monthly_savings = david_monthly_savings + emma_monthly_savings + (emma_book_savings * emma_books_per_month) months_needed = goal / total_monthly_savings...
A baker is making chocolate chip cookies and needs 12 ounces of chocolate chips for every 24 cookies. The baker has a 5 pound bag of chocolate chips and wants to make as many cookies as possible. How many cookies can the baker make with the bag of chocolate chips?
def solve() -> int: ounces_per_pound = 16 chocolate_weight = 5 * ounces_per_pound chocolate_per_cookie = 12 / 24 cookies = chocolate_weight / chocolate_per_cookie result = int(cookies) return result
John has $180. He spends 25% of the money on groceries and 50% of what is left on a video game. How much money does he have left?
def solve() -> int: money = 180 groceries = money * 0.25 money_left = money - groceries video_game = money_left * 0.5 remaining = money_left - video_game result = remaining return result
A jar has 60 marbles. If 12 marbles are removed from the jar, what percentage of marbles remain?
def solve() -> int: remaining_percentage = ( (60-12) / 60 ) * 100 result = remaining_percentage return result
Here are some possible new questions and programs: You can buy 3 pencils or 2 erasers for the same price. You bought 48 items evenly split between pens, pencils and erasers, and the price of 1 pen is $0.75. How much does 1 eraser cost if your total bill was $72?
def solve() -> int: pen_price = 0.75 total_items = 48 pens = total_items / 3 pencils = total_items / 3 erasers = total_items / 3 pen_cost = pen_price * pens remaining_cost = 72 - pen_cost pencil_eraser_ratio = 3 / 2 eraser_price = remaining_cost / (pencil_eraser_ratio * pencils + era...
A car travels 90 miles in 1.5 hours. What is the average speed of the car in miles per hour?
def solve() -> int: distance = 90 time = 1.5 speed = distance / time result = speed return result
A band has 8 members and they want to record their own CD. The cost of recording is $500. If they collect $200 from their last concert, and each member contributes $50, how much will each member have to pay to record the CD?
def solve() -> int: members = 8 recording_cost = 500 last_concert_collected = 200 member_contribute = 50 total_recording_cost = recording_cost - last_concert_collected - (member_contribute * members) result = total_recording_cost / members return result
Alvin is visiting Disneyland with his friends. Disneyland consists of 8 different sections and three of them have an admission fee of $20 per person. If Alvin and his friends wish to visit all 8 sections, how much money should they prepare in total?
def solve() -> int: sections = 8 fee = 20 total_fee = sections * fee result = total_fee return result
Liam has 15 books and decides to donate some of them to a library. He gives away one-third of his books and then buys 4 new books. He realizes that he still has too many books and decides to donate 6 more books. How many books does he have left?
def solve() -> int: books = 15 books_donated = books * (1/3) books -= books_donated books += 4 books -= 6 result = books return result
Tom has 75 books on his bookshelf. He has 3 times as many fiction books as non-fiction, and twice as many non-fiction books as suspense books. How many suspense books does Tom have?
def solve() -> int: s = None n = None f = None s = 75 / 11 result = s return result
In a bakery, there were 80 cakes, and 1/5 of the cakes were chocolate flavored. If 2/3 of the chocolate cakes were sold by noon, how many chocolate cakes were left in the bakery?
def solve() -> int: cakes = 80 chocolate_cakes = cakes * (1/5) sold_cakes = chocolate_cakes * (2/3) remaining_cakes = chocolate_cakes - sold_cakes result = remaining_cakes return result
A factory produces 5000 products each day. If the factory operates for 30 days, what is the total number of products produced in a month?
def solve() -> int: daily_production = 5000 days_in_month = 30 total_production = daily_production * days_in_month result = total_production return result
How much longer is a 25 yard pool compared to an 8 yard pool?
def solve() -> int: total = 25 - 8 result = total return result
Sarah swims at the pool every morning, 6 days a week for 25 minutes. She plays basketball every evening, 3 days a week, for 1 hour. She doubles her swimming time on Sundays. How many minutes does Sarah spend exercising in 1 week?
def solve() -> int: swimming_days = 6 swimming_time = 25 basketball_days = 3 basketball_time = 60 total_swimming_time = swimming_days * swimming_time total_basketball_time = basketball_days * basketball_time sunday_swimming_time = 2 * swimming_time total_exercise_time...
Erika has 100 coins. She spends 4/5 of them. How many coins does Erika have left?
def solve() -> int: number_of_coins = 100 fraction = 4/5 remaining_coins = number_of_coins * (1-fraction) result = remaining_coins return result
A recipe calls for 3/4 cup of sugar. How many cups of sugar are needed to make 6 batches of the recipe?
def solve() -> int: num_batches = 6 sugar_per_batch = 3 / 4 total_sugar = num_batches * sugar_per_batch result = total_sugar return result
A rectangle has a width of 6 cm and an area of 42 cm squared. What is the length of the rectangle?
def solve() -> int: area = 42 width = 6 length = area / width result = length return result
A pizza costs $12.50. If it is shared equally between four people, how much does each person pay?
def solve() -> int: pizza_price = 12.50 number_of_people = 4 per_person_price = pizza_price / number_of_people result = per_person_price return result
Student: John and his brother are eating pizza. John ate 3/4 of the pizza and his brother ate 1/3 of the remaining. If there were 48 slices of pizza, how many slices did John eat?
def solve() -> int: total_slices = 48 john_slices = total_slices * 3/4 remaining_slices = total_slices - john_slices brother_slices = remaining_slices * 1/3 john_eaten_slices = john_slices result = john_eaten_slices return result
Mark has a rectangular garden with a length of 10 feet and a width of 8 feet. He buys enough fertilizer to cover a square area of 40 square feet. How much of the garden remains without fertilizer?
def solve() -> int: garden_area = 10 * 8 fertilizer_area = 40 remaining_area = garden_area - fertilizer_area result = remaining_area return result
If 3 is added to twice a number, the result is 19. What is the number?
def solve() -> int: result = (19-3)/2 return result
Emily spent 2 hours completing 800 work tasks for $0.15 each. Later she spent 30 minutes doing 6 tasks for $1.00 each. What is the difference between Emily's earnings in the two tasks?
def solve() -> int: hours_spent = 2 tasks_completed = 800 task_pay = 0.15 earnings_first = hours_spent * tasks_completed * task_pay time_spent = 0.5 tasks_completed_second = 6 task_pay_second = 1.0 earnings_second = time_spent * tasks_completed_second * task_pay_second ...
David is ordering pizza for his party. He knows that he always eats 1/12 a pizza. His friend Maria eats 1/3 of a pizza, his friend Ben eats 1/4 of a pizza, his friend Alex eats 1/6 of a pizza, and his friend Emma eats 1/9 of a pizza. How many pizzas does he need to order?
def solve() -> int: david_eats = 1/12 maria_eats = 1/3 ben_eats = 1/4 alex_eats = 1/6 emma_eats = 1/9 total_eaten = david_eats + maria_eats + ben_eats + alex_eats + emma_eats pizzas_needed = total_eaten / (1/1) result = pizzas_needed return result
The cost of a dozen eggs is $2.40. If Joe wants to make pancakes for 20 people, how many dozen eggs should he buy?
def solve() -> int: eggs_per_dozen = 12 cost_per_dozen = 2.40 people_to_serve = 20 eggs_per_person = 2 total_eggs_needed = eggs_per_person * people_to_serve dozen_eggs_needed = total_eggs_needed / eggs_per_dozen result = dozen_eggs_needed return result
In a bakery, there are twice as many croissants as cinnamon rolls. If the bakery has 54 pastries in total, how many cinnamon rolls are there?
def solve() -> int: total = 54 croissants = total / 2 rolls = total - croissants result = rolls return result
If Aleena and her sister decided to share all of her gold bars equally, how many gold bars would each of them receive?
def solve() -> int: legacy_bars = 5 aleena_bars = legacy_bars - 2 sister_bars = aleena_bars // 2 each_person_bars = (aleena_bars + sister_bars) // 2 result = each_person_bars return result
A farmer had 20 chickens but had to sell 3/4 of them. How many chickens does he have left?
def solve() -> int: chickens = 20 chickens_sold = chickens * 3/4 chickens_left = chickens - chickens_sold result = chickens_left return result
The number of deer at The Safari Reserve is 8 times as many as the number of deer at The African Wilderness. If there are 63 deer at The African Wilderness, calculate the total number of deer in the two parks.
def solve() -> int: african_deer = 63 safari_deer = african_deer * 8 total_deer = african_deer + safari_deer result = total_deer return result
A sports shop sells three types of sneakers: running, basketball, and hiking. 10% of customers bought running shoes, 30% bought basketball shoes, and 50% bought hiking shoes. The rest bought other types. If the shop had 200 customers for the month, how many didn't buy any of the three types of shoes?
def solve() -> int: total_customers = 200 running_shoes = total_customers * 0.1 basketball_shoes = total_customers * 0.3 hiking_shoes = total_customers * 0.5 other_shoes = total_customers - running_shoes - basketball_shoes - hiking_shoes no_shoes = total_customers - (running_shoes + basketball_s...
Student: During a sale, a store sold 400 items, 75% of which were electronics. How many items were not electronics?
def solve() -> int: items = 400 percentage_electronics = 0.75 not_electronics = items - (items * percentage_electronics) result = not_electronics return result