question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
John spent 1/3 of his money on food and then spent 1/2 of what was left on clothes. If he had $60 left, how much money did he initially have?
def solve() -> int: money = 60/(1-1/2) result = money/(1/3) return result
Student: Haley is installing a carpet in her room. Her room is a rectangle that is 15 feet by 12 feet. The carpet comes in rolls that are 6 feet wide. If the carpet costs $12 per square feet, how much will it cost Haley to carpet her room?
def solve() -> int: room_length = 15 room_width = 12 carpet_width = 6 carpet_price = 12 room_area = room_length * room_width carpet_rolls = (room_width // carpet_width) + (room_width % carpet_width > 0) carpet_cost = room_area * carpet_price + carpet_rolls * carpet_width result = ...
Mark wants to make a sandwich. He needs twice as much bread as meat. If he has 3 pounds of meat and already has 8 pounds of bread, and the bread comes in 1-pound loaves, how many loaves does he need to buy? Kyle has 240 dimes in his wallet. He spends $14 on lunch. How many dimes does Kyle have left?
def solve() -> int: meat = 3 bread = 8 bread_needed = 2 * meat - bread loaves_needed = abs(bread_needed) result = loaves_needed dimes = 240 spent = 14 dimes_left = dimes - (spent * 10) result = dimes_left return result
Jack has 10 red balls, 2 blue balls, and 3 green balls. What is the probability of picking a green ball?
def solve() -> int: green_balls = 3 total_balls = 10 + 2 + 3 probability = green_balls / total_balls result = probability return result
Student: Marco is painting a rectangular wall that is 12 feet long and 8 feet high. He can paint 6 square feet of the wall in one hour. How many hours will it take him to paint the entire wall?
def solve() -> int: length = 12 height = 8 area_per_hour = 6 total_area = length * height total_time = total_area / area_per_hour result = total_time return result
Rachel has a total of $1500. She spends 2/5 on a new phone, 3/10 on clothes, and the remaining on books. How much money does she spend on books?
def solve() -> int: total = 1500 phone = total*2/5 clothes = total*3/10 books = total - phone - clothes result = books return result
In a forest, there are 36 deer, 15 rabbits, and 9 foxes. What is the ratio of deer to rabbits to foxes in the forest?
def solve() -> int: deer = 36 rabbits = 15 foxes = 9 deer_to_rabbits = deer / rabbits deer_to_foxes = deer / foxes rabbits_to_foxes = rabbits / foxes result = f'{deer_to_rabbits:.2f}:{deer_to_foxes:.2f}:{rabbits_to_foxes:.2f}' return result
A company's revenue for the year is $120,000. If its expenses for the year were $80,000, what was its profit for the year?
def solve() -> int: revenue = 120000 expenses = 80000 profit = revenue - expenses result = profit return result
A toy factory produces 600 toys in a day. If 20% of them are defective, how many toys are good?
def solve() -> int: total_toys = 600 defective_percent = 20 good_percent = 100 - defective_percent good_toys = (good_percent/100)*total_toys result = good_toys return result
A coffee mug is being emptied through a tiny hole at the bottom and filled with hot coffee using a spoon. The hole can empty the mug in 10 hours and the spoon can fill the mug in 2 hours. If the mug starts filled with coffee and has a capacity of 350 milliliters, how much coffee will be left after 6 hours?
def solve() -> int: capacity = 350 empty_rate = 1/10 fill_rate = 1/2 empty_volume = empty_rate * 6 * capacity fill_volume = fill_rate * 6 * capacity remaining_volume = capacity - empty_volume + fill_volume result = remaining_volume return result
Mary deposited $5600 in her saving account which pays an annual interest rate of 4%. If she deposits the same amount again after one year, how much will she have in her saving account after two years?
def solve() -> int: amount = 5600 interest = 0.04 amount_in_one_year = amount + (amount * interest) amount_in_two_years = amount_in_one_year + (amount_in_one_year * interest) result = amount_in_two_years return result
Caterpillar, a multi-legged insect, faces difficulty when trying to buy shoes because they can only be bought in pairs. If Caterpillar already possesses one pair of shoes, how many more pairs of shoes will they need to purchase to own 6 complete sets of shoes?
def solve() -> int: one_pair = 1 total_sets = 6 pairs_needed = (total_sets * 2) - one_pair result = pairs_needed return result
Jake has to drive 375 miles to reach his destination. He can drive at a maximum speed of 60 miles per hour, but he is not driving at full speed. He drives at 50 miles per hour on average. He also has to make a couple of rest stops totaling 1 hour. How long will it take to reach his destination in hours?
def solve() -> int: distance = 375 speed = 50 driving_time = distance / speed rest_time = 1 total_time = driving_time + rest_time result = total_time return result
A car dealership produces 50 cars per day. They sell each car for $10,000. If they sold 1 month's worth of production, how much money will the dealership earn?
def solve() -> int: cars_per_day = 50 price_per_car = 10000 days_in_month = 30 cars_in_month = cars_per_day * days_in_month total_earnings = cars_in_month * price_per_car result = total_earnings return result
arah is having a party and needs to buy snacks for her guests. The snacks come in packs of 8 and cost $4 per pack. She is expecting 25 guests. How much money will Sarah need to spend on snacks?
def solve() -> int: pack_size = 8 pack_cost = 4 guests = 25 packs_needed = (guests // pack_size) + 1 total_cost = packs_needed * pack_cost result = total_cost return result
A rectangle has a length of 15cm and a width of 10cm. What is the area of the rectangle?
def solve() -> int: length = 15 width = 10 area_of_rectangle = length * width result = area_of_rectangle return result
Student: Lucy is filling up her aquarium, which can hold 40 liters of water. The faucet she uses drips water at a rate of 30 ml/minute. If she fills up the aquarium to its capacity, how long would it take for the aquarium to be filled?
def solve() -> int: liters = 40 milliliters = liters * 1000 drip_rate = 30 time = milliliters / drip_rate result = time return result
Student: A rectangular garden is 20 feet wide and 30 feet long. What is the perimeter of the garden?
def solve() -> int: width = 20 length = 30 perimeter = 2 * (width + length) result = perimeter return result
Student: A customer wants to buy $40 worth of merchandise from a store. If the store offers a 20% discount, how much does the customer need to pay including taxes if the sales tax is 5%?
def solve() -> int: price = 40 discount = 0.2 tax = 0.05 discounted_price = price * (1 - discount) total_price = discounted_price * (1 + tax) result = total_price return result
During a storm, the Martinez's outdoor chair flew 20 feet across the porch. Along with the chair, a hat was also blown twice as far as the chair had flown. Also in the yard was a basketball that had rolled three times farther than the hat. How far, in feet, had the basketball rolled?
def solve() -> int: chair_distance = 20 hat_distance = 2 * chair_distance basketball_distance = 3 * hat_distance result = basketball_distance return result
A car can go 30 miles per gallon. If gas costs $3.50 per gallon, how much does it cost to drive 150 miles?
def solve() -> int: miles = 150 mileage = 30 gas_price = 3.50 gallons = miles / mileage total_cost = gallons * gas_price result = total_cost return result
Student: The seats of a bus are arranged in 8 rows of 8 seats. At the start, 68 people climb. At the first stop, 3 people board the bus and 4 get off. At the second stop, 7 people get on the bus and 12 get off. How many empty seats are there after the second stop?
def solve() -> int: rows = 8 seats_per_row = 8 passengers = 68 total_seats = rows * seats_per_row passengers = passengers + 3 - 4 passengers = passengers + 7 - 12 empty_seats = total_seats - passengers result = empty_seats return result
If Maria can complete a project in 18 hours and her teammate Mark can complete the same project in 20 hours, how long will it take for them to complete the project if they work together?
def solve() -> int: hours_maria = 18 hours_mark = 20 project = 1 maria_rate = project / hours_maria mark_rate = project / hours_mark combined_rate = maria_rate + mark_rate time_together = project / combined_rate result = time_together return result
A box contains 50 chocolates. If 10 chocolates are removed from the box, what percentage of chocolates are left?
def solve() -> int: total_chocolates = 50 removed_chocolates = 10 left_chocolates = total_chocolates - removed_chocolates percentage_left = (left_chocolates/total_chocolates) * 100 result = percentage_left return result
Mark and Lisa book a hotel room for $230 per night, but they receive a $35 discount for each night since they are staying for a week. How much will their week-long stay cost?
def solve() -> int: nightly_rate = 230 discount_per_night = 35 number_of_nights = 7 total_discount = discount_per_night * number_of_nights total_cost = (nightly_rate * number_of_nights) - total_discount result = total_cost return result
In 2 years, William will be seventeen times older than Laura is now. Laura is 2 years old. How much older is William than Laura, right now, in years?
def solve() -> int: laura_age = 2 william_age = 0 william_age_in_2_years = (laura_age + 2) * 17 age_difference = william_age_in_2_years - laura_age william_age = age_difference result = william_age return result
A library had 100 books on its shelves at the start of the year. The librarian predicted that every week would have twice as many books being borrowed as the previous week due to school assignments. If this continued for 8 more weeks, how many books would have been borrowed including those at the start of the year?
def solve() -> int: start_books = 100 total_borrowed = 0 previous_week_borrowed = 0 for i in range(1, 9): current_week_borrowed = previous_week_borrowed * 2 if i > 1 else 1 total_borrowed += current_week_borrowed previous_week_borrowed = current_week_borrowed total_...
A box contains 250 pencils. If each pencil costs $0.50, how much would it cost to buy 3 of them?
def solve() -> int: num_of_pencils = 250 cost_per_pencil = 0.50 num_of_pencils_required = 3 total_cost = cost_per_pencil * num_of_pencils_required result = total_cost return result
Student: A pizza has 8 slices. Tom ate three slices and his friend ate two slices. How many slices of pizza are left?
def solve() -> int: slices_total = 8 slices_tom = 3 slices_friend = 2 slices_left = slices_total - slices_tom - slices_friend result = slices_left return result
Kelly enjoys running on a treadmill for 45 minutes. On Tuesday, she ran several times on the treadmill that totaled 3 hours and 45 minutes. On Wednesday, she ran twice as many times as she did on Tuesday. What is the maximum number of times Kelly could have run on the treadmill in total? In 10 years, Sarah will be thri...
def solve() -> int: kelly_time = 45 tuesday_time = 3 * 60 + 45 wednesday_time = tuesday_time * 2 total_time = tuesday_time + wednesday_time max_runs = total_time // kelly_time result = max_runs return result
Joseph studies for 2 hours every day. He decides to increase his study time by 1 hour every day. How many hours will Joseph study in a week?
def solve() -> int: hours_per_day = 2 days_per_week = 7 study_time_per_week = hours_per_day * days_per_week result = study_time_per_week return result
Sarah runs a catering business and needs to know how much she spends on food. She buys 15 pounds of chicken at $2.50 per pound, 10 pounds of potatoes at 0.50 per pound and 5 pounds of carrots at $1.25 per pound. How much does she spend on food in total?
def solve() -> int: chicken_cost = 15 * 2.5 potato_cost = 10 * 0.5 carrot_cost = 5 * 1.25 total_cost = chicken_cost + potato_cost + carrot_cost result = total_cost return result
Student: A cyclist travels at an average speed of 15 miles per hour. If the cyclist travels for 4 hours, how far will they travel?
def solve() -> int: average_speed = 15 time = 4 distance = average_speed * time result = distance return result
Student: Tom works at a grocery store for $10/hour. He worked 40 hours last week and also got a $50 bonus. What is his total pay last week?
def solve() -> int: hourly_wage = 10 hours_worked = 40 bonus = 50 total_pay = hourly_wage * hours_worked + bonus result = total_pay return result
A park has a rectangular playground with a length of 35 feet and a width of 25 feet. A circular sandbox with a radius of 6 feet is located inside the playground. How many feet of fencing are needed for both areas?
def solve() -> int: length_playground = 35 width_playground = 25 radius_sandbox = 6 perimeter_playground = 2 * (length_playground + width_playground) circumference_sandbox = 2 * 3.14159 * radius_sandbox total_length_fencing = perimeter_playground + circumference_sandbox r...
If Maria weighs 120 pounds, and she weighs 6 times as much as her pet chinchilla, what is the total weight of Maria and her chinchilla?
def solve() -> int: maria_weight = 120 chinchilla_weight = maria_weight / 6 total_weight = maria_weight + chinchilla_weight result = total_weight return result
Madison has to walk a distance of 36 meters. On the first day, she walks eleven meters. On the second day, she walks six meters, but then walks backwards by three meters. On the third day, she walks forward by nine meters. How many more meters does she have to walk to reach her destination?
def solve() -> int: distance_to_walk = 36 day_one_distance = 11 day_two_distance = 6 - 3 day_three_distance = 9 total_distance_walked = day_one_distance + day_two_distance + day_three_distance distance_left_to_walk = distance_to_walk - total_distance_walked result = distance_left_t...
Zoe opened a savings account with $1,000 in 2017, earning an annual interest rate of 4.5%. How much money will be in her savings account by 2025?
def solve() -> int: investment = 1000 rate = 0.045 years = 2025 - 2017 total_interest = (investment * rate) * years final_amount = total_interest + investment result = final_amount return result
John purchases $6 worth of paint to make paintings. He makes 18 paintings and sells them for $15.00 each at an art show. After selling 12 paintings, he reduces the price of the remaining 6 to $10.00 each and sells them soon after. What is his net profit?
def solve() -> int: paint_cost = 6 num_paintings = 18 selling_price = 15.00 num_sold = 12 reduced_price = 10.00 num_remaining = 6 total_cost = paint_cost total_revenue = num_sold * selling_price + num_remaining * reduced_price net_profit = total_revenue - total_cost res...
If a bag can hold 50 candy bars altogether, and there are four times as many chocolate bars as peanut butter bars, how many peanut butter bars are there?
def solve() -> int: total_bars = 50 chocolate_bars = 0 peanut_butter_bars = 0 chocolate_bars = total_bars // 5 * 4 peanut_butter_bars = total_bars - chocolate_bars result = peanut_butter_bars return result
Jenny has 180 cards. She trades a sixth of her cards with her friend. From her remaining cards, she gives a third of them to her cousin. Then she purchases 20 new cards from the store. How many cards does Jenny have now?
def solve() -> int: initial_cards = 180 cards_traded = initial_cards / 6 remaining_cards = initial_cards - cards_traded cards_given_to_cousin = remaining_cards / 3 final_cards = remaining_cards - cards_given_to_cousin + 20 result = final_cards result return result
Student: A single slice of pizza contains 250 calories. If Mark ate 2 slices of pizza for lunch every day for a week (7 days), how many total calories did he consume from eating pizza for lunch?
def solve() -> int: calories_per_slice = 250 num_slices = 2 num_days = 7 total_calories = calories_per_slice * num_slices * num_days result = total_calories return result
A farmer had 68 chickens and 37 goats. If a head of goat costs thrice as much as a chicken, how much money can he gain by selling the whole flock?
def solve() -> int: numChickens = 68 numGoats = 37 costGoatperHead = 3 * 1 totalGain = 68 * 1 + 37 * 3 result = totalGain return result
Student: A recipe calls for 2 and 1/2 cups of sugar. How much sugar would be used for 3/4 of the recipe?
def solve() -> int: recipe_cups_sugar = 2.5 fraction_recipe = 0.75 result = recipe_cups_sugar * fraction_recipe return result
Jim drove to his friend's house at an average speed of 60 km/h. It took him 2 hours to get there. How many kilometers is his friend's house from Jim's house?
def solve() -> int: average_speed = 60 time = 2 distance = average_speed * time result = distance return result
A store is having a sale where everything is 30% off the original price. If a customer bought an item for $70, what was the original price of the item?
def solve() -> int: sale_price = 70 discount = 0.3 original_price = sale_price / (1 - discount) result = original_price return result
There are a total of 190 books in the library. If 57 of them are fiction books, how many are non-fiction books?
def solve() -> int: book_total = 190 fiction_books = 57 non_fiction_books = book_total - fiction_books result = non_fiction_books return result
Here are some possible questions and programs: There are 6 rooms that have 15 light bulbs each. There are 4 rooms that have 9 light bulbs each. Each light bulb consumes 40 watts of electricity. If all of the light bulbs are switched on for 3 hours, how much electricity is consumed in total?
def solve() -> int: total_bulbs = 6 * 15 + 4 * 9 total_power = total_bulbs * 40 total_energy = total_power * 3 result = total_energy return result
Jack is 9 years old today. In 5 years, he will be one-third the age of his grandfather. How old is his grandfather today?
def solve() -> int: jack_age = 9 years_in_future = 5 jack_age_in_future = jack_age + years_in_future grandfather_age_in_future = 3 * jack_age_in_future grandfather_age = grandfather_age_in_future - years_in_future result = grandfather_age return result
A person wants to drive 300 miles and has 6 hours to do so. If they travel at a constant speed, what is the minimum speed they need to maintain in miles per hour?
def solve() -> int: distance = 300 time = 6 minimum_speed = distance / time result = minimum_speed return result
Mr. Scott is buying a new car. The car costs $25,000 and he will make a $5000 down payment. He takes out a loan from the bank that bears an interest rate of 5%. He pays back the loan in monthly payments over 3 years. How much is his monthly payment?
def solve() -> int: car_price = 25000 down_payment = 5000 interest_rate = 5 loan_amount = car_price - down_payment years = 3 months = 12*years interest_rate_decimal = interest_rate/100 monthly_interest_rate = interest_rate_decimal/12 monthly_payment = ((loan_amount*monthly_inter...
Student: At a bakery, there are 240 pastries in a display. 30% of them are sold in the morning, and 70% of the remaining pastries are sold in the afternoon. How many pastries are left?
def solve() -> int: pastries = 240 morning_sold = pastries * 0.3 morning_left = pastries - morning_sold afternoon_sold = morning_left * 0.7 afternoon_left = morning_left - afternoon_sold result = afternoon_left return result
Every day, Alex runs along a circular track that is 1/8 mile long. He can complete one lap in 5 minutes. If Alex's sister, Bella, runs at twice Alex's speed and she runs along the same circular track as Alex, how many laps does Bella complete in the same amount of time it takes Alex to complete two laps? In a classroom...
def solve() -> int: lap_distance = 1/8 lap_time = 5 bella_speed = 2 * (1/lap_time) * lap_distance time_for_2_laps = 2 * lap_time bella_laps = time_for_2_laps / ((1/bella_speed) * lap_distance) total_students = 60 a_students = 12 b_students = 3 * a_students c_stude...
The sum of the ages of Anna and Tony is 64 years. Tony is 8 years older than Anna. What is the age of Tony?
def solve() -> int: anna_age = ((64-8)/2) tony_age = anna_age + 8 result = tony_age return result
Isla buys a dress for $500. Her friend purchases a dress that is four times as expensive and resells it for one-third of its original price. How much does Isla's friend spend out of pocket?
def solve() -> int: dress_price = 500 friend_dress_price = dress_price * 4 resell_price = friend_dress_price / 3 friend_out_of_pocket = friend_dress_price - resell_price result = friend_out_of_pocket return result
Four brothers each had the same number of coins. After the first two brothers each gave away 4 coins, the third brother gave away 5 coins. How many coins did each brother have originally?
def solve() -> int: num_coins = 0 total_coins = 0 brothers = 4 total_coins = brothers * num_coins num_coins = total_coins / brothers num_coins_1_2 = num_coins - 4 num_coins_3 = num_coins_1_2 - 5 result = num_coins_3 return result
Tina has 9 more stickers than Sarah, while Sarah has 2 more stickers than Rachel. If Rachel has 6 stickers, how many stickers do Tina, Sarah, and Rachel have in total?
def solve() -> int: Rachel = 6 Sarah = Rachel + 2 Tina = Sarah + 9 total = Rachel + Sarah + Tina result = total return result
There are 6 apples and 4 oranges. If each person is allowed to take 2 pieces of fruit, how many fruits will be left?
def solve() -> int: apples = 6 oranges = 4 people = 2 total_fruits = apples + oranges fruits_taken = people * 2 fruits_left = total_fruits - fruits_taken result = fruits_left return result
Charlie had 15 stickers in his album. He traded 5 stickers with his friend for 3 new stickers. He also bought 4 stickers from the store. How many stickers does Charlie have in his album now?
def solve() -> int: stickers_after_trading = 15 - 5 stickers_after_buying = stickers_after_trading + 3 + 4 result = stickers_after_buying return result
Olivia has a string that's 450 millimeters long. She cuts it into five equal parts and gives two parts to her friend. If she divides the remaining parts into five equal sections, what is the length of each part?
def solve() -> int: length_of_string = 450 parts_given_to_friend = 2 remaining_parts = length_of_string - parts_given_to_friend parts_after_division = remaining_parts / 5 result = parts_after_division return result
Alex has 8 bicycles. The first four bikes need 2 pumps of air each and the other four bikes need 1 fewer pump of air than the first four bikes. If Alex checks the air pressure every week, how many pumps of air will he need in 8 weeks?
def solve() -> int: num_bikes = 8 pumps_first_four = 2 pumps_last_four = pumps_first_four - 1 total_pumps = (pumps_first_four * 4) + (pumps_last_four * 4) num_weeks = 8 total_pumps_in_8_weeks = total_pumps * num_weeks result = total_pumps_in_8_weeks ret...
Alice has twice as many apples as Bob. Bob has 5 apples. How many apples does Alice have?
def solve() -> int: Bob = 5 Alice = 2 * Bob result = Alice return result
A rectangle has a length of 20 meters and a width of 10 meters. What is the perimeter of the rectangle in meters?
def solve() -> int: length = 20 width = 10 perimeter = 2*(length+width) result = perimeter return result
Melissa bought 3 pounds of grapes for $6.75. How many ounces did Melissa buy?
def solve() -> int: numOfPounds = 3 price = 6.75 ouncesPerPound = 16 totalOunces = numOfPounds * ouncesPerPound result = totalOunces return result
A bucket can hold 4 gallons of water. If it is filled 3/5 of the way, how many quarts of water are in the bucket?
def solve() -> int: bucket_capacity_gallons = 4 filled_ratio = 3/5 filled_gallons = bucket_capacity_gallons * filled_ratio quarts_per_gallon = 4 filled_quarts = filled_gallons * quarts_per_gallon result = filled_quarts return result
Jack has 50 marbles. On Mondays and Wednesdays, he plays with 4 marbles for each day and on the other days of the week he plays with 2 marbles for each day. In how many weeks will Jack run out of marbles?
def solve() -> int: marbles = 50 days_per_week = 7 marbles_per_monwed = 4 marbles_per_otherdays = 2 marbles_per_week = (marbles_per_monwed * 2) + (marbles_per_otherdays * 5) weeks = marbles // marbles_per_week result = weeks return result
Rachel and Ethan started a joint account for their vacation. Rachel saves $50 every week while Ethan saves $300 every month. If they decide to invest half of their savings in buying gifts for their family, and each gift costs $15, how many gifts can they buy after 8 months of saving?
def solve() -> int: rachel_weekly_savings = 50 ethan_monthly_savings = 300 ethan_weekly_savings = ethan_monthly_savings / 4 total_savings = (rachel_weekly_savings * 4 * 8) + (ethan_weekly_savings * 4 * 8) half_savings = total_savings / 2 num_gifts = half_savings // 15 ...
At a card tournament, Robby used a deck of 40 cards that were divided into 8 sets of 5 cards each. How many different card combinations can he make with this deck of 40 cards?
def solve() -> int: num_sets = 8 num_cards_per_set = 5 total_combinations = num_sets**num_cards_per_set result = total_combinations return result
Judy needs to print and bind 21 copies of a book that is 550 pages long. The binding will cost her $5.50 each and the copying will cost her $0.11 per page. How much will it cost her?
def solve() -> int: number_of_copies = 21 cost_for_binding = 5.50 cost_per_page = 0.11 pages = 550 total_cost_for_binding = number_of_copies * cost_for_binding total_cost_for_copying = pages * cost_per_page * number_of_copies result = total_cost_for_binding + total_cost_for_copying retu...
Tom has a pack of pencils with 24 pencils in it. If he uses 3 pencils every day for school, how many days will the pack last for?
def solve() -> int: pack_size = 24 pencils_per_day = 3 days = pack_size // pencils_per_day result = days return result
A company produces 5000 units of product A per day and 400 units of product B per day. If product A costs $1.25 to produce and product B costs $3 to produce, how much does the company spend on production in a week (assuming a 5-day work week)?
def solve() -> int: units_per_day_A = 5000 units_per_day_B = 400 cost_per_unit_A = 1.25 cost_per_unit_B = 3 work_days_per_week = 5 total_units_A = units_per_day_A*work_days_per_week total_units_B = units_per_day_B*work_days_per_week total_cost_A = total_units_A*cost_per_unit_A tota...
Tom had 18 apples which he gave away to his friends. He gave two apples to three of his friends, four apples to each of four of his friends, and five apples to one of his friends. How many apples were left?
def solve() -> int: a = 18 f1 = 3 f2 = 4 f3 = 1 left = a - 2*f1 - 4*f2 - 5*f3 result = left return result
A store sells apples for $0.75 each. If you buy 4 or more, the price drops to $0.50 each. How much will it cost to buy 8 apples?
def solve() -> int: if 8 >= 4: price = 0.50 else: price = 0.75 cost = 8 * price result = cost return result
Nick has a bag of 5 red balls, 10 blue balls and 15 yellow balls. How many ways can he choose 7 balls from the bag?
def solve() -> int: sum = 0 for i in range(5): for j in range(10): for k in range(15): for l in range(k+1,15): for m in range(l+1,15): for n in range(m+1,15): for o in range(n+1,15): ...
Student: Marcus had 288 peaches and he took out 12 of them. How many peaches does he have now?
def solve() -> int: peaches_original = 288 peaches_taken_out = 12 peaches_left = peaches_original - peaches_taken_out result = peaches_left return result
``` A baseball pitcher has a 3-2 record, meaning he has won 3 games and lost 2 games. If the pitcher's winning percentage is calculated as the number of games won divided by the total number of games played, what is his winning percentage?
def solve() -> int: total_games = 3 + 2 games_won = 3 winning_percentage = games_won / total_games result = winning_percentage return result
Leo wants to buy a video game that costs $12. He has $4 in his piggy bank and earns $2 per week for doing chores. How many weeks does he need to work for the remaining amount if he does not spend any money?
def solve() -> int: cost = 12 saved = 4 earn = 2 need = cost - saved weeks = need / earn result = weeks return result
Yesterday, Tom drank 3 glasses of water. Each day, he plans to drink 2 more glasses than the previous day. If he follows this pattern for 5 consecutive days, how much water will he have consumed on the fourth day?
def solve() -> int: initial_glasses = 3 additional_glasses = 2 days = 5 fourth_day_glasses = initial_glasses + (additional_glasses * (4 - 1)) result = fourth_day_glasses return result
A car rental service charges a basic fee of $50 for the first 100 miles and an additional fee of $0.25 per mile for any additional miles. If a car is rented for 350 miles, what is the total cost?
def solve() -> int: total_miles = 350 basic_fee = 50 additional_miles = total_miles - 100 additional_fees = additional_miles * 0.25 total_cost = basic_fee + additional_fees result = total_cost return result
Ali is driving from city A to city B. The distance between city A and B is 200km. On the first day, Ali drove 120km. On the second day, he drove 40% more than he did on the first day. How many km did he drive in total?
def solve() -> int: distance_cityA_cityB = 200 day1_distance = 120 day2_distance = day1_distance * 1.4 total_distance = day1_distance + day2_distance result = total_distance return result
If a tank can hold 100 liters of water and there are currently 60 liters of water in it, what is the percentage of water in the tank?
def solve() -> int: tank_capacity = 100 current_water = 60 percentage_water = (current_water / tank_capacity) * 100 result = percentage_water return result
A car travels at a constant speed of 50 miles per hour. How far will the car travel in 3 hours?
def solve() -> int: speed = 50 time = 3 distance = speed * time result = distance return result
A company sells a product for $50 and earns a profit of 20%. How much profit does the company earn if it sells 500 units of the product?
def solve() -> int: product_price = 50 profit_percentage = 0.20 num_products = 500 total_revenue = product_price*num_products total_profit = total_revenue*profit_percentage result = total_profit return result
arah has 3 boxes of cookies and wants to share them with her 5 friends. Each box has 12 cookies. How many cookies will each person get if they split them equally?
def solve() -> int: total_cookies = 3 * 12 total_people = 5 + 1 cookies_per_person = total_cookies / total_people result = cookies_per_person return result
A hardware store offers a 15% discount on all tools. How much will you pay for a set of wrenches that normally costs $80 and a hammer that normally costs $12?
def solve() -> int: discounted_wrenches = 80 * 0.85 discounted_hammer = 12 * 0.85 total_cost = discounted_wrenches + discounted_hammer result = round(total_cost, 2) return result
John works for 8 hours each day. If he takes breaks amounting to 30 minutes in total, how many hours does he work in a week?
def solve() -> int: total_minutes_breaks = 30 minutes_breaks_per_day = total_minutes_breaks / 7 minutes_worked_per_day = 480 - minutes_breaks_per_day hours_worked_per_day = minutes_worked_per_day / 60 hours_worked_per_week = hours_worked_per_day * 7 result = hours_worked_per_week return resu...
The F-22 Raptor fighter jet can fly at a speed of 1500 mph, but when it moves through a thunderstorm it travels eight times faster. If the fighter jet flies for six hours at its regular speed and then two hours through a thunderstorm, what would be the total distance it covers in miles?
def solve() -> int: regular_speed = 1500 thunderstorm_speed = regular_speed * 8 regular_time = 6 thunderstorm_time = 2 regular_distance = regular_speed * regular_time thunderstorm_distance = thunderstorm_speed * thunderstorm_time total_distance = regular_distance + thunderstor...
Ruby is 5 years younger than Tara. Tara is 4 times as old as Leo. If Leo is 9, how old is Ruby?
def solve() -> int: tara = 9 * 4 ruby = tara - 5 result = ruby return result
Sophia brought bags of chips to share with her friends. Each bag has 30 chips. She has 7 total bags. Her dad says that for every bag she brings, he will bring ten more identical ones. There are 52 friends. How many chips does each friend get?
def solve() -> int: bags_of_chips = 7 chips_per_bag = 30 total_chips = bags_of_chips * chips_per_bag dad_bags_of_chips = bags_of_chips * 10 dad_total_chips = dad_bags_of_chips * chips_per_bag total_friends = 52 total_people = total_friends + 1 total_chips_per_person = (tot...
On a seven-day road trip, Frank drove 146 miles the first day, 12 miles less the second day, then increased his distance by 8 miles each day for the next five days. If he had to fill his gas tank every 192 miles, how many times did he fill his gas tank for the whole trip?
def solve() -> int: distance1 = 146 distance2 = distance1 - 12 distance3 = distance2 + 8 distance4 = distance3 + 8 distance5 = distance4 + 8 distance6 = distance5 + 8 distance7 = distance6 + 8 fills = 0 total_distance = distance1 + distance2 + distance3 + distance4 + distance5 +...
There are 20 students in a class. If 3/4 of the class passed the exam, how many students passed?
def solve() -> int: total_students = 20 passing_percentage = 0.75 students_passing = total_students * passing_percentage result = students_passing return result
In a school, there are 3 classes with 20 students in each class. If each student has to bring 2 notebooks, how many more notebooks are needed for all the classes?
def solve() -> int: total_students = 3 * 20 total_notebooks = total_students * 2 more_notebooks_needed = total_notebooks - (3*20*1) result = more_notebooks_needed return result
Aidan is making a cake that requires 3 cups of flour, 1/2 cup of white sugar, a 1/4 cup of brown sugar, and a 1/3 cup of vegetable oil. He only has a 1/4 cup measuring scoop. How many times does he need to fill the scoop?
def solve() -> int: flour = 3 white_sugar = 0.5 brown_sugar = 0.25 vegetable_oil = 0.33 measuring_scoop = 0.25 total_cup = flour + white_sugar + brown_sugar + vegetable_oil result = total_cup / measuring_scoop return result
A laboratory has 100 test tubes, and each test tube contains 0.5 milliliter of solution. What is the total volume of the solution in all the test tubes combined (in liters)?
def solve() -> int: test_tubes = 100 volume_per_tube = 0.5 / 1000 total_volume = test_tubes * volume_per_tube result = total_volume return result
Sam has 20 marbles and gives 4 to his friend. Then he finds 6 more marbles and loses 3. How many marbles does he have now?
def solve() -> int: marbles_after_giving = 20 - 4 marbles_after_finding = marbles_after_giving + 6 marbles_after_losing = marbles_after_finding - 3 result = marbles_after_losing return result
A flower bed is to be planted with roses. If each rose bush is 2 feet wide and they need at least 1 foot of space between them or the edge of the bed, how many rose bushes can be planted in a flower bed that is 17 feet long and 5 feet wide?
def solve() -> int: max_length = (17 - 1) // (2 + 1) max_width = (5 - 1) // (2 + 1) result = max_length * max_width return result
Kayla is purchasing a new phone for $600.00, but it is on sale for 25% off. She also has a $50.00 off coupon, but it does not apply to sale items. How much will she pay including a 8.25% sales tax?
def solve() -> int: price = 600.00 discount1 = 0.25 price1 = price - price * discount1 coupon = 50.00 price2 = price - coupon discount2 = 0.25 price3 = price2 - price2 * discount2 tax = 0.0825 price4 = price3 + price3 * tax result = price4 return result
7. How many oranges do you need to have so that you can divide them between 5 people evenly?
def solve() -> int: people_num = 5 oranges_divide_evenly = people_num * people_num result = oranges_divide_evenly return result
A number is increased by 20% and the result is then decreased by 15%. If the final result is 136, what was the original number?
def solve() -> int: final_num = 136 num_before_decrease = final_num/(1-0.15) original_num = num_before_decrease/(1+0.2) result = original_num return result
Oliver has 22 pens with eight ink cartridges in each pen. If 1/4 of them have two empty cartridges each, how many cartridges are still full?
def solve() -> int: pens = 22 cartridges_per_pen = 8 total_cartridges = pens * cartridges_per_pen pens_with_empty_cartridges = pens / 4 empty_cartridges = pens_with_empty_cartridges * 2 full_cartridges = total_cartridges - empty_cartridges result = full_cartridg...