question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A bakery have stocked up 70 different types of biscuits and each biscuit cost 32 cents. What is the total cost of all the biscuits together?
def solve() -> int: counter = 0 cost = 0 while counter < 70: cost += 0.32 counter += 1 if counter == 70: result = cost return result
- Ryan has a collection of 50 coins, consisting of quarters, dimes, and nickels. He counts the coins and finds that he has 15 quarters, 10 dimes, and the rest are nickels. How much money does he have in total?
def solve() -> int: quarters = 15 dimes = 10 nickels = 50 - quarters - dimes quarter_value = 25 dime_value = 10 nickel_value = 5 total_value = quarters * quarter_value + dimes * dime_value + nickels * nickel_value total_dollars = total_value / 100 result = t...
A football team has scored a total of 32 goals in their last 8 matches. What is the average number of goals per match?
def solve() -> int: goals = 32 matches = 8 average_goals = goals / matches result = average_goals return result
Student: A square painting has a perimeter of 28 inches. What is the length of each side?
def solve() -> int: perimeter = 28 side_length = perimeter / 4 result = side_length return result
A photograph measures 6 inches by 8 inches. It has a resolution of 300 dots per inch. What is the total number of pixels in the photo?
def solve() -> int: width = 6 height = 8 resolution = 300 total_pixels = width * resolution * height * resolution result = total_pixels return result
A factory produces 1000 widgets every hour and sells them for $5 each. The production cost is $2 per widget, and the fixed cost is $1000 per hour. The factory operates for 12 hours a day. How much profit does the factory make in one day?
def solve() -> int: widgets = 1000 price = 5 cost = 2 fixed_cost = 1000 hours = 12 revenue = widgets * price * hours variable_cost = widgets * cost * hours total_cost = variable_cost + fixed_cost * hours profit = revenue - total_cost result = profit return result
Sofia is trying to find the best workout routine for her fitness goals. She goes through 12 different workout programs but doesn't like any of them after trying them out for a day each. She repeats this process twice more before she finds the perfect program. If she chooses the 10th workout program on the final list, h...
def solve() -> int: num_programs = 12 num_trials = 3 days_per_trial = 1 total_days = num_programs * num_trials * days_per_trial result = total_days return result
A hospital has 20 doctors. The average number of patients treated by each doctor in a day is twice the number of hours spent seeing patients. If each doctor spends an average of 3 hours seeing patients per day, calculate the total number of patients treated by the doctors in a week.
def solve() -> int: doctors = 20 hours_per_day = 3 patients_per_hour = 0.5 patients_per_day = hours_per_day * patients_per_hour patients_per_week = patients_per_day * doctors * 7 result = patients_per_week return result
Tom buys notebooks for his study group. He gives each member 2 notebooks. His group has 6 members and a 10 pack of notebooks costs $3. How much did he spend on them all?
def solve() -> int: num_members = 6 num_notebooks_per_member = 2 num_notebooks_total = num_members * num_notebooks_per_member num_packs_of_notebooks = num_notebooks_total / 10 cost_per_pack = 3 total_cost = num_packs_of_notebooks * cost_per_pack result = total_cost return result
Eva is shopping for a new laptop. She finds one that costs $1,200 and is on sale for 20% off. She also has a coupon that gives her an extra 10% off the discounted price. What is the final price she pays for the laptop?
def solve() -> int: laptop_price = 1200 sale_rate = 0.20 coupon_rate = 0.10 discounted_price = laptop_price * (1 - sale_rate) final_price = discounted_price * (1 - coupon_rate) final_price = round(final_price, 2) result = final_price return result
Possible new questions and programs are: A magician can turn 3 rabbits into 5 doves in 10 seconds. How many times more doves can he make in a minute than rabbits?
def solve() -> int: rabbits_per_minute = 3 * 6 doves_per_minute = 5 * 6 ratio = doves_per_minute / rabbits_per_minute times_more = ratio - 1 result = times_more return result
Jonathan and his brother Josh decided to run a race. Jonathan ran 3 km/h faster than Josh and was able to finish the race 30 minutes before his brother. If the race was 8 km long, what was the speed of Josh?
def solve() -> int: speed_difference=3 total_time=(8/speed_difference)*60 time_josh=total_time-30 speed_josh=8/time_josh result = speed_josh return result
Neil is setting out to buy a new car. The car is listed for $20,000 and there is an additional 10% sales tax. How much will Neil need to pay for the car?
def solve() -> int: car_price = 20000 sales_tax = car_price * 0.1 result = car_price + sales_tax return result
In a certain country, there are 6 political parties: A, B, C, D, E, and F. There is a total of 20000 registered voters in the country. Party A has 30% of all registered voters, and Party B has 20%. There are as many voters in parties C and D combined as in Party E. How many voters are in Party F?
def solve() -> int: total_voters = 20000 party_A = 0.3 * total_voters party_B = 0.2 * total_voters party_E = (total_voters - party_A - party_B) / 4 party_F = total_voters - party_A - party_B - 2 * party_E result = party_F return result
A recipe calls for 2 cups of flour for every 1 cup of sugar. If the recipe requires 4 cups of sugar, how many cups of flour are needed?
def solve() -> int: sugar = 4 flour_ratio = 2 sugar_ratio = 1 flour = sugar * flour_ratio / sugar_ratio result = flour return result
A pizza restaurant sold 150 pizzas on Monday, 180 pizzas on Tuesday and 200 pizzas on Wednesday. If the cost of each pizza is $10, how much money did the restaurant make in total in 3 days?
def solve() -> int: monday_pizzas = 150 tuesday_pizzas = 180 wednesday_pizzas = 200 pizza_price = 10 total_sales = (monday_pizzas + tuesday_pizzas + wednesday_pizzas) * pizza_price result = total_sales return result
Kim had 60 candies in a bag. She shared them equally with her three siblings and then ate 5 candies from her share. How many candies did Kim have left?
def solve() -> int: each = 60 / 4 ate = 5 remain = each - ate result = remain return result
Emma has five times as many stickers as Amy has dolls. If Emma has 60 stickers, how many dolls and stickers do Emma and Amy have altogether?
def solve() -> int: stickers = 5 dolls = 12 emma_stickers = stickers * dolls total = emma_stickers + dolls result = total return result
Mason and Charlotte went to a water park, Mason played in the wave pool four times, Charlotte rode the water slide six times, and they both went on the lazy river twice. If a ticket for the wave pool costs $7, a ticket for the water slide costs $9, and a ticket for the lazy river costs $4, how much money did they spend...
def solve() -> int: wave_pool_cost = 7 water_slide_cost = 9 lazy_river_cost = 4 mason_wave_pool = 4 charlotte_water_slide = 6 both_lazy_river = 2 mason_spent = mason_wave_pool * wave_pool_cost charlotte_spent = charlotte_water_slide * water_slide_cost both_spent = both_lazy...
A pizza restaurant increased their pizza toppings by 35%. If they originally had 10 toppings, how many toppings do they have now?
def solve() -> int: original_toppings = 10 increase_percentage = 35 increase_amount = original_toppings * (increase_percentage / 100) new_toppings = original_toppings + increase_amount result = new_toppings return result
Ali works as a waiter at a restaurant. He earns $7 per hour plus 15% of the total bill as tips. He works 8 hours a day for 4 days a week. He serves an average of 10 tables per day, with an average bill of $40 per table. He also has to pay 10% of his tips as a tip-out to the kitchen staff. How much money, in dollars, do...
def solve() -> int: hourly_earnings = 7 * 8 tip_earnings = 0.15 * 40 * 10 daily_earnings = hourly_earnings + tip_earnings weekly_earnings = daily_earnings * 4 tip_out = tip_earnings * 0.1 net_earnings = weekly_earnings - tip_out result = net_earnings return result
A recipe calls for 2 cups of flour for every 3 cups of sugar. If you have 6 cups of flour, how many cups of sugar do you need?
def solve() -> int: flour = 6 flour_to_sugar_ratio = 2/3 sugar = (flour/flour_to_sugar_ratio) * (3/2) result = sugar return result
A store raises the price of an item from $10 to $15. What is the percentage increase in the price?
def solve() -> int: original_price = 10 new_price = 15 price_increase = new_price - original_price percentage_increase = (price_increase / original_price) * 100 result = percentage_increase return result
Mark was repairing his fence. On Tuesday he fixed 12 feet, on Wednesday he fixed 5 feet more than Tuesday and on Thursday he fixed 4 feet less than Wednesday. If the total number of feet he fixed during the week was 26 feet, how many feet did he fix on Thursday?
def solve() -> int: length_tuesday = 12 length_wednesday = length_tuesday + 5 length_thursday = length_wednesday - 4 total_length = length_tuesday + length_wednesday + length_thursday result = length_thursday return result
Sarah is filling a gas tank that can hold 50 liters of gasoline. She fills it up two-thirds, but then her son drives the car and uses up a quarter of the gasoline in the tank. Sarah refills the tank and adds 12 liters of gasoline, but then her daughter drives the car and uses up 5 liters of gasoline. After that, Sarah ...
def solve() -> int: total_capacity = 50 initial_fill = (2/3) * total_capacity son_drives = (1/4) * initial_fill refill = initial_fill - son_drives + 12 daughter_drives = 5 final_fill = refill - daughter_drives + 15 initial_fill = (final_fill - total_capacity) / 2 result = initi...
In a stadium, there are 48 seats in each row. There are eight times that many rows as there are sections. There are four sections in the stadium. How many seats are there in the stadium in total?
def solve() -> int: rows = 4 * 8 total = 48 * rows * 4 result = total return result
Mike and Anna are collecting cans for recycling. Mike has 48 cans and Anna has 36 cans. They get $0.05 for each can. How much money will they have together after recycling all the cans?
def solve() -> int: mike_money = 48 * 0.05 anna_money = 36 * 0.05 total_money = mike_money + anna_money result = total_money return result
Anna runs a lemonade stand. She buys lemons and sugar for $2 per kilogram and $1 per kilogram respectively. She uses 0.5 kilograms of lemons and 0.2 kilograms of sugar to make 10 liters of lemonade. She sells each liter of lemonade for $0.8. How much money does she make in a day if she sells all her lemonade?
def solve() -> int: cost_per_lemon = 2 cost_per_sugar = 1 lemon_per_liter = 0.5 / 10 sugar_per_liter = 0.2 / 10 price_per_liter = 0.8 liters_per_day = 10 cost_per_liter = (lemon_per_liter * cost_per_lemon) + (sugar_per_liter * cost_per_sugar) revenue_per_day = liters_per_d...
Student: Hari baked 150 cookies for a party. He ate 1/6 of the cookies before the party, and 1/5 of the remaining cookies during the party. He then gave half of the rest to his guests as a gift. How many cookies did he have left after the party?
def solve() -> int: cookies_baked = 150 cookies_before_party = cookies_baked * (5/6) cookies_during_party = cookies_before_party * (4/5) cookies_left = cookies_during_party / 2 result = cookies_left return result
Alex drives 105 km in 1.5 hours. How many km can he travel in 5 hours?
def solve() -> int: distance_one = 105 time_one = 1.5 speed = distance_one / time_one time_two = 5 distance_two = speed * time_two result = distance_two return result
Student: 3. Alina went shopping and bought a laptop and a cellphone. The laptop cost $550 and the cellphone cost $200. How much did Alina spend in total?
def solve() -> int: laptop_cost = 550 cellphone_cost = 200 total_cost = laptop_cost + cellphone_cost result = total_cost return result
A pizza costs $24 and is cut into 8 equal slices. If 5 people eat pizza and each person wants 2 slices, how much money will each person pay?
def solve() -> int: pizza = 24 slices = 8 people = 5 slices_person = 2 total_slices = people * slices_person price_per_slice = pizza / slices price_per_person = total_slices * price_per_slice each_person = price_per_person / people result = each_person return result
Daniel owns a farm with 5 cows. Every week, the number of cows increases by 3. On the second week, he sells half of the cows. On the fifth week, he sells one-third of the remaining cows. On the eighth week, he buys 8 more cows. How many cows does he have in total?
def solve() -> int: week = 1 cows = 5 while week < 8: cows += 3 week += 1 if week == 2: cows /= 2 if week == 5: cows -= cows / 3 if week == 8: cows += 8 result = cows return result
Lisa can knit a scarf in 20 minutes. Mary takes 6 minutes longer than Lisa to knit the same scarf while Nancy can knit it 4 minutes faster than Mary. If they each knit three scarves every week, how many minutes do they spend knitting scarves each week?
def solve() -> int: lisa_time = 20 mary_time = lisa_time + 6 nancy_time = mary_time - 4 lisa_total = lisa_time * 3 mary_total = mary_time * 3 nancy_total = nancy_time * 3 total = lisa_total + mary_total + nancy_total result = total return result
Kevin has 4 apples and he wants to share them equally with his 3 friends. He cuts each apple into 6 pieces and gives each friend the same number of pieces. How many pieces of apple will Kevin have for himself?
def solve() -> int: p = 6 result = p return result
John is creating a stadium with 20 rows. Every 4th row has an attendant who checks the tickets, which takes a minute. To go from one row to the next, the fans need to climb 10 steps at a rate of 2 steps/second. How long does it take for fans to reach the lowest row starting from the highest row in seconds?
def solve() -> int: num_rows = 20 attendant_rows = 4 attendant_time = 1 steps_per_row = 10 steps_per_second = 2 total_steps = num_rows * steps_per_row total_attendant_time = (num_rows // attendant_rows) * attendant_time total_climbing_time = total_steps / steps_per_second t...
John walks to the store, which takes him 15 minutes. He spends 25 minutes shopping in the store, then walks back home, another 15 minutes on foot. How many minutes does John spend on this trip in total?
def solve() -> int: time_to_store = 15 time_shopping = 25 time_back_home = 15 total_time = time_to_store + time_shopping + time_back_home result = total_time return result
Derek bought 3 shirts. The first one costed $25, the second one was $40, and the third one was $45. How much more does he need to pay, if he wants to make the average cost of the three shirts to be $40?
def solve() -> int: a=25 b=40 c=45 d=40 result = (d*3)-(a+b+c) return result
Jacob has a water bottle that can hold 750 mL of liquid. He drinks 150 mL of water every hour while studying. If he studies for 5 hours a day, how many times does he need to refill his water bottle in a day?
def solve() -> int: bottle_capacity = 750 water_consumption_per_hour = 150 study_hours_per_day = 5 total_water_consumption = water_consumption_per_hour * study_hours_per_day refills_per_day = total_water_consumption // bottle_capacity + 1 result = refills_per_day return resu...
Max has to walk 4 and 3/4 miles to reach his friend's house. He has already walked 1 and 1/2 miles. How much further does Max have to walk to reach his friend's house?
def solve() -> int: total_distance = 4 + 3/4 distance_walked = 1 + 1/2 distance_left = total_distance - distance_walked result = distance_left return result
A bag contains 18 red balls and 22 blue balls. What percentage of the balls are blue?
def solve() -> int: total_balls = 18 + 22 percentage_blue = 100 * (22/total_balls) result = f'{percentage_blue}% of the balls are blue' result = percentage_blue return result
A driver has to deliver 75 packages. There are 9 buildings on the block. 2 of the buildings have 8 floors, and the rest have 10 floors each. How many packages will each floor receive in the buildings with 10 floors?
def solve() -> int: total_packages = 75 num_buildings = 9 num_8floor_buildings = 2 num_10floor_buildings = num_buildings - num_8floor_buildings num_10floor_floors = 10 num_8floor_floors = 8 total_floors = (num_10floor_buildings * num_10floor_floors) + (num_8floor_buildings * num_8floor_...
Jamie bought 4 pencil boxes for $16 and received a 10% discount. How much money did she save?
def solve() -> int: total_cost = 4 * 16 discount = total_cost * 0.10 result = discount return result
A farmer has a total of 360 animals on his farm. 30% of the animals are cows and the rest are chickens. If there are 25 more cows than chickens, how many chickens does the farmer have?
def solve() -> int: total_animals = 360 cow_percent = 30 chicken_percent = 100 - cow_percent cows = (cow_percent/100) * total_animals chickens = (total_animals - cows)/(1 + 25/ cows) result = chickens return result
If Miriam works for 10 days and can take care of 72 flowers in one day, how many flowers will she have taken care of in total?
def solve() -> int: flower_one_day = 72 total_days = 10 result = flower_one_day * total_days return result
A fruit seller has 450 apples. If the seller sells 3/5 of the apples, how many apples will be left with the seller?
def solve() -> int: apples = 450 sold_apples = apples * (3/5) remaining_apples = apples - sold_apples result = remaining_apples return result
Student: A company has 15 employees. Each employee gets a salary of $3000 per month. What is the total monthly wage bill of the company?
def solve() -> int: num_employees = 15 salary_per_employee = 3000 total_monthly_wage_bill = num_employees * salary_per_employee result = total_monthly_wage_bill return result
Michael makes sandwiches in batches of 5. He eats 2 sandwiches every day. It takes him 10 minutes to make a batch. How many hours does he spend making sandwiches over 20 days?
def solve() -> int: batch_size = 5 sandwiches_eaten_per_day = 2 time_per_batch = 10 days = 20 total_sandwiches = batch_size * days sandwiches_eaten = sandwiches_eaten_per_day * days sandwiches_left = total_sandwiches - sandwiches_eaten time_spent = (total_sandwiches // batch_size) ...
In a classroom, there are 25 students. If the ratio of boys to girls is 3:2, how many boys are there?
def solve() -> int: total_students = 25 boy_ratio = 3/5 boys = total_students * boy_ratio result = boys return result
A camera was originally priced at $1000 but went on sale for 40% off. If Sophia bought the camera and paid 4% sales tax, how much did she pay in total?
def solve() -> int: price = 1000 discount = 40 tax = 4 total = (price - (price*discount/100)) + ((price - (price*discount/100))*tax/100) result = total return result
Sophie saved $50 and her best friend saved $75. Sophie wants to save at least $35 more than her friend. How much more money does Sophie need to save if her friend saves another $20?
def solve() -> int: sophie_saved = 50 friend_saved = 75 additional_saving = 20 sophie_needed = friend_saved + 35 sophie_needed -= sophie_saved sophie_needed -= additional_saving result = sophie_needed return result
Andy has a jar of coins with 20 quarters, 15 dimes and 10 nickels. He takes out 5 quarters, 3 dimes and 2 nickels and puts them in his wallet. How much money does he have in his wallet and how much money does he have left in the jar?
def solve() -> int: value_of_quarter = 0.25 value_of_dime = 0.1 value_of_nickel = 0.05 number_of_quarters_in_wallet = 5 number_of_dimes_in_wallet = 3 number_of_nickels_in_wallet = 2 amount_of_money_in_wallet = (number_of_quarters_in_wallet * value_of_quarter) + (number_of_dimes_in_wallet * v...
Jacob has a drawer full of socks. He takes 7 socks out and divides them evenly between his two drawers. He then adds another 21 socks to the original drawer. If Jacob now has 78 socks in the drawer, how many socks did he have in the drawer to begin with?
def solve() -> int: socks_taken_out = 7 socks_added = 21 total_socks = 78 initial_socks = (total_socks - socks_added) * 2 - socks_taken_out result = initial_socks return result
If an ant has six legs, and one ant queen can lay 10,000 eggs, how many ant legs would be in 9 less than 15 egg batches?
def solve() -> int: legs_per_ant = 6 eggs_per_batch = 15 legs_per_batch = legs_per_ant * 6 total_legs = (eggs_per_batch - 9) * legs_per_batch result = total_legs return result
Possible math questions and python programs: Gita has a flock of chickens that lay eggs every day. During the first month, her 12 chickens laid 8 times as many eggs as the number of chickens she has, and she sold half of the eggs at the market. 6 of the eggs were bad and had to be thrown away. During the next month, he...
def solve() -> int: eggs_1 = 12 * 8 eggs_sold_1 = eggs_1 / 2 eggs_bad_1 = 6 eggs_left_1 = eggs_1 - eggs_sold_1 - eggs_bad_1 eggs_2 = 72 eggs_given_2 = 12 eggs_left_2 = eggs_2 - eggs_given_2 chickens = 12 eggs_total = eggs_left_1 + eggs_left_2 + chickens result ...
Cindy was paid $15 for every hour of babysitting. She worked 3 hours on Monday and 4 hours on Tuesday. She then bought a gift for $32. How much money does Cindy have left?
def solve() -> int: hours_worked_monday = 3 hours_worked_tuesday = 4 hourly_rate = 15 gift_cost = 32 total_earned = (hours_worked_monday + hours_worked_tuesday) * hourly_rate money_left = total_earned - gift_cost result = money_left return result
Clara has nine notebooks that weigh the same as Thomas’s three notebooks. One of Thomas’s notebooks weighs one pound and the other weighs three. All of Clara’s notebooks weigh the same amount. How much does one of Clara’s notebooks weigh?
def solve() -> int: x = 4/9 result = x return result
Tom drove 325 miles in 5 hours. If he continues driving at that speed, how many miles will he have driven in 7 hours?
def solve() -> int: speed = 325/5 distance = speed*7 result = distance return result
A rectangle has a width of 5 cm and a perimeter of 18 cm. What is its length?
def solve() -> int: width = 5 perimeter = 18 length = (perimeter - 2 * width) / 2 result = length return result
Ben has 15 candy bars that he wants to divide into 3 equal bags. If each bag has 4 candy bars, how many candy bars will Ben need to buy to fill up the bags?
def solve() -> int: candy_bars = 15 bags = 3 candy_per_bag = 4 candy_needed = bags * candy_per_bag candy_short = candy_needed - candy_bars result = candy_short return result
Ethan wants to buy a new laptop. He plans to tutor 3 students for 2 hours each at $18 per hour and work at a movie theater for 8 hours at $10 per hour. If his earnings just cover the cost of the laptop, how much does it cost?
def solve() -> int: num_students = 3 hours_per_student = 2 hourly_rate_tutoring = 18 hours_worked_movie_theater = 8 hourly_rate_movie_theater = 10 earnings_tutoring = num_students * hours_per_student * hourly_rate_tutoring earnings_movie_theater = hours_worked_movie_theater * hourl...
A soccer team won 270 points in the year and there were 9 players on the team. If 4 players scored 50 points each, how many points did the remainder average?
def solve() -> int: total_points = 270 total_players = 9 each_player_points = 50 remaining_points = (total_points - each_player_points*4) / (total_players-4) result = remaining_points return result
Kevin wants to buy a new video game that costs $60. He has saved $15 from his allowance and $10 from his birthday money. He also earns $5 for every hour he helps his neighbor with chores. How many hours does Kevin need to work to afford the game?
def solve() -> int: money_needed = 60 - (15 + 10) hours_needed = money_needed / 5 result = hours_needed return result
Student: A nurse earns a salary of $45,000. She pays 18% of her earnings in taxes, 5% towards her 401k, and pays $500 monthly for rent. How much money will she take home after her expenses if there are 28 pay periods?
def solve() -> int: salary = 45000 taxes = salary * 0.18 retirement = salary * 0.05 rent = 500 * 28 take_home = salary - taxes - retirement - rent result = take_home return result
Student: A rope of length 50 meters is cut into three pieces with the lengths in the ratio of 3:4:5. What is the length of the longest piece?
def solve() -> int: length = 50 ratio_1 = 3 ratio_2 = 4 ratio_3 = 5 piece_1 = length * (ratio_1 / (ratio_1 + ratio_2 + ratio_3)) piece_2 = length * (ratio_2 / (ratio_1 + ratio_2 + ratio_3)) piece_3 = length * (ratio_3 / (ratio_1 + ratio_2 + ratio_3)) longest_piece = max(piece_1, piece_2...
A car can travel 30 km on 1 liter of petrol. If petrol costs $0.80 per liter, how much does it cost to travel 180 km?
def solve() -> int: distance = 180 fuel_efficiency = 30 cost_per_liter = 0.8 fuel_required = distance/fuel_efficiency cost = fuel_required*cost_per_liter result = cost return result
In a footrace, Anna runs 120 meters in the first lap. In the second lap, Anna runs 3/4 as much as she ran in her first lap. What is the total distance Anna runs in both laps?
def solve() -> int: first_lap = 120 second_lap = 3/4 * first_lap total_distance = first_lap + second_lap result = total_distance return result
A car travels 120 km in 2 hours. If it maintains the same speed, how long will it take to travel 200 km?
def solve() -> int: speed = 120 / 2 distance = 200 t = distance / speed result = f"The car will take {t:.2f} hours to travel 200 km" return result
A car travels 500 km in 8 hours. What is its average speed in km/hour?
def solve() -> int: distance = 500 time = 8 speed = distance/time result = speed return result
A painter charges $150 for painting a room. He also charges $10 for each window and $20 for each door in the room. He paints 10 rooms in a week. Each room has 2 windows and 1 door. What is his income for the week?
def solve() -> int: room_charge = 150 + 10 * 2 + 20 * 1 income = room_charge * 10 result = income return result
If it takes 3 hours for John to paint a house, and it takes 5 hours for Jack to paint the same house, how long would it take them if they work together?
def solve() -> int: time1 = 3 time2 = 5 finished_house = 1 john_speed = finished_house/time1 jack_speed = finished_house/time2 combined_speed = john_speed + jack_speed time_needed = finished_house/combined_speed result = time_needed return result
Student: Jonah is digging a tunnel through a rocky hill. He uses a drill that can break six large rocks per minute. Every rock has four smaller pieces inside it. He needs to clear 120 pieces of rock to make one meter of the tunnel. How many minutes will it take him to dig a tunnel that is 15 meters long?
def solve() -> int: rocks_per_minute = 6 pieces_per_rock = 4 pieces_per_meter = 120 meters = 15 total_pieces = pieces_per_meter * meters total_rocks = total_pieces / pieces_per_rock minutes = total_rocks / rocks_per_minute result = minutes return result
Milo the wolf relies on deer to get his protein. He hunts 3 deer in the morning and twice as much in the evening. When he's not hunting, he's drinking from the nearby river. How many deer does he hunt in a day?
def solve() -> int: morning_deer = 3 evening_deer = 2 * morning_deer total_deer = morning_deer + evening_deer result = total_deer return result
Two tanks are each filled with half a liter of liquid. If the liquids are mixed together, how many liters of liquid will there be?
def solve() -> int: tank_1 = 0.5 tank_2 = 0.5 total_liters = tank_1 + tank_2 result = total_liters return result
A pizza place has 3 toppings available: pepperoni, mushrooms, and onions. A customer orders a pizza with 2 toppings. How many different types of pizzas can they order?
def solve() -> int: toppings_available = 3 toppings_ordered = 2 pizza_choices = toppings_available * (toppings_available - 1) result = pizza_choices return result
A drawer has 10 dozen socks and 4 dozen more gloves than socks. How many pieces of clothing are in the drawer?
def solve() -> int: socks = 10 gloves = socks + 4 socks = socks * 12 gloves = gloves * 12 clothing = socks + gloves result = clothing return result
Student: A garden is 12 feet wide and 16 feet long. What is its area in square feet?
def solve() -> int: width = 12 length = 16 area = width * length result = area return result
Some possible questions and programs are: A third-grade class of 15 students collected 120 acorns for a science project. They decided to share the acorns equally among themselves and their teacher. How many acorns did each person get?
def solve() -> int: total_people = 15 + 1 acorns_per_person = 120 / total_people result = acorns_per_person return result
Tim buys 3 packs of pens for $24 in total. Each pack contains 5 pens. If Tim sells each pen for $2, what is his profit?
def solve() -> int: total_packs = 3 pack_price = 24 pens_per_pack = 5 pen_price = 2 total_pens = total_packs * pens_per_pack total_sales = total_pens * pen_price total_cost = pack_price profit = total_sales - total_cost result = profit return result
In a math class, 45% of the students are girls. If there are 40 students in the class, how many are girls?
def solve() -> int: total_students = 40 percent_girls = 0.45 num_girls = total_students * percent_girls result = num_girls return result
Bob paid $8.00 for 4 gallons of gas. How much would he pay for 5 gallons of gas at the same price per gallon?
def solve() -> int: price_per_gallon = 8.00 / 4 total_cost = price_per_gallon * 5 result = f'<<<{total_cost}>>>' result = total_cost return result
Emma has 20 books of the same size. The books each weigh 1.5 kg. What is the total weight in kilograms of all 20 books?
def solve() -> int: num_books = 20 weight_per_book = 1.5 total_weight = num_books * weight_per_book result = total_weight return result
Student: David's mother got a new job halfway through May, and it takes her an extra 6 hours per week to commute to work. How many extra hours of commuting did David's mother have compared to the hours she commuted at the beginning of May?
def solve() -> int: beginning_of_May_hours = 0 extra_hours_per_week = 6 extra_hours = extra_hours_per_week * 2 result = extra_hours - beginning_of_May_hours return result
Sophia is counting coins for her piggy bank. She adds up the 5 bags of coins she has and the 47 coins already in her piggy bank. If she counts a total of 171 coins, how many coins were in each bag?
def solve() -> int: num_bags = 5 coins_in_bank = 47 total_coins = 171 coins_per_bag = (total_coins - coins_in_bank) / num_bags result = coins_per_bag return result
Student: Christine has enough money for 12 hotdogs. Each hotdog costs $1.50. She spent 1/3 of the money for drinks. How much money did she spend on drinks?
def solve() -> int: hotdogs = 12 cost_per_hotdog = 1.50 fraction_for_drinks = 1/3 total_cost_hotdogs = hotdogs * cost_per_hotdog amount_spent_drinks = total_cost_hotdogs * fraction_for_drinks result = amount_spent_drinks return result
On Wednesday, eight children and three adults went to the movie theater. Tickets for children cost $7 and tickets for adults cost $11. How much money did the theater make?
def solve() -> int: price_children = 7 price_adult = 11 num_children = 8 num_adult = 3 total_cost_children = price_children * num_children total_cost_adult = price_adult * num_adult total_cost = total_cost_children + total_cost_adult result = total_cost return re...
It takes 10 minutes to paint a wall, 15 minutes to hang a picture, and 20 minutes to clean a window. If Tanya painted 5 walls, hangs 7 pictures and cleaned 3 windows, how many total minutes did she take?
def solve() -> int: painting = 5 hanging = 7 cleaning = 3 time_paint = painting * 10 time_hang = hanging * 15 time_clean = cleaning * 20 result = time_paint + time_hang + time_clean return result
Michael bought some oranges. He bought 3 bags for $5 each. Each bag contained 15 oranges. How much money did he spend for all the oranges?
def solve() -> int: pp = 5 numo = 15 bags = 3 result = pp * bags * numo return result
Ethan is buying candy for Halloween. He wants to give each trick-or-treater a maximum of 3 pieces of candy. If he expects 50 trick-or-treaters and each piece of candy costs $0.25, how much money will he spend in total and what percentage of his budget will he use?
def solve() -> int: trick_or_treaters = 50 max_candy_per_person = 3 cost_per_candy = 0.25 total_candy = trick_or_treaters * max_candy_per_person total_cost = total_candy * cost_per_candy budget = total_candy * cost_per_candy percentage_of_budget = (total_cost / budget) * 100 ...
Student: Kelly spent $25 from her monthly income on gas and saved 1/3 of her remaining income. If she now has $300 left, how much was her monthly income?
def solve() -> int: gas = 25 saved = 1/3 left = 300 before_saving = left / (1 - saved) before_gas = before_saving + gas result = before_gas return result
Jane has 3 bags of fruits. She has 10 apples, 8 oranges, and 6 bananas. How many fruits in total does she have?
def solve() -> int: fruits_total = 10 + 8 + 6 result = fruits_total return result
Student: A man bought 20 books for $100. He sold half of them for $7 each, and the rest for $5 each. What did he make in profit?
def solve() -> int: num_books = 20 cost_per_book = 100 / num_books num_books_sold_7 = num_books / 2 num_books_sold_5 = num_books / 2 profit_7 = num_books_sold_7 * 7 profit_5 = num_books_sold_5 * 5 total_profit = profit_7 + profit_5 result = total_profit return result
Eve earns $12 an hour for the first 40 hours worked each week and $18.50 each hour of overtime after that. In a certain week she worked 53 hours, how much money did she make?
def solve() -> int: hours_worked = 53 overtime_hours = hours_worked - 40 normal_hours_pay = 12*40 normal_overtime_pay = 18.50* overtime_hours result = normal_hours_pay + normal_overtime_pay return result
Brandon rode his bicycle on a circular track. His average speed for the first lap was 12 miles/hour, and he completed the lap in 12 minutes. He then completed the second lap at an average speed of 15 miles/hour, and he completed the lap in 10 minutes. What is the length of the track in miles?
def solve() -> int: time_first_lap = 12/60 time_second_lap = 10/60 speed_first_lap = 12 speed_second_lap = 15 distance_first_lap = time_first_lap * speed_first_lap distance_second_lap = time_second_lap * speed_second_lap total_distance = 2 * (distance_first_lap + distance_second_lap) res...
Jacob and Anna went to the batting cages. Each token gets you 12 pitches. Jacob used 13 tokens and Anna used 19 tokens. Jacob hit the ball 56 times. Anna hit the ball 73 times. How many total pitches did Jacob and Anna miss?
def solve() -> int: token_jacob = 13 pitches_jacob = 12 * token_jacob token_anna = 19 pitches_anna = 12 * token_anna total_pitches = pitches_jacob + pitches_anna result = total_pitches - (56 + 73) return result
A highway tunnel is 8000 feet long. A car travels through the tunnel at an average speed of 65 mph. If the car takes 2 minutes to enter and exit the tunnel, how long does it take to travel through the tunnel?
def solve() -> int: tunnel_length = 8000 average_speed = 65 time_to_enter_exit = 2/60 time_to_travel = tunnel_length/average_speed total_time = time_to_enter_exit * 2 + time_to_travel result = total_time return result
Ava is spending 3 hours at a water park. The wait for the surfing simulator is 20 minutes, the wait for the lazy river is 40 minutes, and the wait for the water playground is 15 minutes. If Ava uses the surfing simulator 6 times and the lazy river 3 times, how many times can she visit the water playground?
def solve() -> int: hours_spent = 3 surfing_wait = 20 lazy_river_wait = 40 water_playground_wait = 15 surfing_times = 6 lazy_river_times = 3 total_surfing_wait = surfing_wait * surfing_times total_lazy_river_wait = lazy_river_wait * lazy_river_times remaining_time = ho...
A piece of wood, 6 meters long, is cut into two pieces such that one piece is twice the length of the other. What is the length of the longer piece?
def solve() -> int: longer_piece = 4 shorter_piece = 2 result = longer_piece return result
A coffee shop charges $3.49 for a cup of coffee and $4.99 for a bagel with cream cheese. If Jane buys 2 cups of coffee and a bagel with cream cheese, how much will she spend?
def solve() -> int: coffee_price = 3.49 num_coffees = 2 bagel_price = 4.99 num_bagels = 1 total_cost = (coffee_price * num_coffees) + (bagel_price * num_bagels) result = total_cost return result
A restaurant has 30 tables. On average, each table can be served in 30 minutes. If the restaurant has a maximum capacity of 100 diners per hour, how many diners can the restaurant serve in 8 hours?
def solve() -> int: num_tables = 30 time_per_table = 30 max_capacity = 100 hours_open = 8 diners_per_hour = (60 / time_per_table) * num_tables total_diners = diners_per_hour * max_capacity * hours_open result = total_diners return result