question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
The community park has a capacity of 1000 people. If the park is at 50% capacity for 2 weeks and parking costs $5 per car, how much money is collected in that time?
def solve() -> int: capacity = 1000 parking_cost = 5 park_capacity = capacity * 0.5 total_parking_cars = park_capacity * 14 total_money_collected = total_parking_cars * parking_cost result = total_money_collected return result
Josh has a box of 10 candles. He used 4 candles in his room and then he shared the remaining candles with his neighbor. How many candles does he have left?
def solve() -> int: n_begin = 10 n_use = 4 n_share = (n_begin - n_use ) / 2 result = n_begin - n_use - n_share print (result) return result
There are 5 red and 3 blue pencils in a box. If two pencils are taken out randomly without replacement, what is the probability that one is red and one is blue?
def solve() -> int: total_pencils = 8 red_pencils = 5 blue_pencils = 3 probability_one_red_one_blue = (2*(red_pencils/total_pencils)*(blue_pencils/(total_pencils-1))) result = probability_one_red_one_blue return result
A fundraiser sold 500 tickets for their event. Adult tickets cost $10 each and children's tickets cost $5 each. If 300 adult tickets and 200 children's tickets were sold, how much money was raised?
def solve() -> int: adult_ticket_price = 10 childrens_ticket_price = 5 total_adult_tickets_sold = 300 total_childrens_tickets_sold = 200 total_money_raised = (total_adult_tickets_sold * adult_ticket_price) + (total_childrens_tickets_sold * childrens_ticket_price) result = total_money_raised ...
Since Emily started her education fund, she has earned the same amount she invested twice over in 6 months. If Emily's education fund is currently worth $1,200, how much has she been earning per month from her investment assuming she has been earning an equal amount of returns each month?
def solve() -> int: investment = 1200 / 2 returns_per_month = investment / 6 result = returns_per_month return result
A rectangular garden is twice as long as it is wide. If the perimeter is 36 meters, what are the dimensions of the garden?
def solve() -> int: perimeter = 36 x = perimeter / 6 length = x * 2 width = x result = (length, width) return result
John has two bikes - one is a mountain bike and the other is a road bike. He rides the road bike four miles for every seven miles he rides the mountain bike. If he rides the mountain bike for 28 miles, how many total miles does he ride both bikes?
def solve() -> int: mountain_bike_miles = 28 road_bike_miles = (4/7) * mountain_bike_miles total_miles = mountain_bike_miles + road_bike_miles result = total_miles return result
A rug is 12 feet long and 8 feet wide. It costs $5 per square foot. What is the total cost of the rug?
def solve() -> int: length = 12 width = 8 price_per_square_foot = 5 area = length * width total_cost = area * price_per_square_foot result = total_cost return result
Student: Leah is making pancakes for a breakfast potluck. She needs 1 cup of flour, 1/3 cup of sugar, 2 eggs and 1.5 cups of milk for each pancake. If she starts with 15 cups of flour, 6 cups of sugar, 18 eggs and 9 cups of milk, how many pancakes can Leah make?
def solve() -> int: flour = 15 sugar = 6 eggs = 18 milk = 9 pancakes_flour = flour // 1 pancakes_sugar = sugar // (1/3) pancakes_eggs = eggs // 2 pancakes_milk = milk // 1.5 result = min(pancakes_flour, pancakes_sugar, pancakes_eggs, pancakes_milk) return result
A gym charges a sign-up fee of $50, plus $30 per month for membership. If a customer signs up for a 6-month membership, what is their total cost?
def solve() -> int: sign_up_fee = 50 monthly_membership_fee = 30 membership_duration_in_months = 6 total_cost = (sign_up_fee + (monthly_membership_fee * membership_duration_in_months)) result = total_cost return result
Rachel went to the fabric store to buy lace. They sell it for 2 dollars per yard. She spent 16 dollars. How many yards of lace did she buy?
def solve() -> int: price_per_yard = 2 total_spent = 16 yards_bought = total_spent / price_per_yard yards_bought = round(yards_bought) result = yards_bought return result
Kelly and Ryan have a joint bank account that earns 2% annual interest compounded monthly. They deposit $500 at the end of each month into the account. How much money will they have in the account after 5 years?
def solve() -> int: balance = 0 deposit = 500 rate = 0.02 years = 5 for i in range(years * 12): balance = (balance + deposit) * (1 + rate / 12) result = round(balance, 2) return result
Susan saved $2000 for a trip and bought the ticket for $150. If each day she spends $30 on average, how long can she enjoy her trip?
def solve() -> int: total_savings = 2000 ticket_price = 150 daily_spending = 30 days_of_trip = (total_savings - ticket_price)/daily_spending result = days_of_trip return result
10. If 2 apples cost $0.75, calculate the total cost of 20 apples?
def solve() -> int: price = 0.75 result = price * 20 return result
A farmer harvested 500 vegetables from his garden. He sold 150 vegetables at the local market and donated 50 vegetables to his church. How many vegetables are left with the farmer?
def solve() -> int: vegetables_harvested = 500 vegetables_sold = 150 vegetables_donated = 50 vegetables_left = vegetables_harvested - vegetables_sold - vegetables_donated result = vegetables_left return result
A zoo has 50 different animal species. If on average each species has 20 animals, and 5 die every day, how many total animals are in the zoo (including those that died) at the end of 14 days if there were 50,000 animals at the beginning?
def solve() -> int: num_species = 50 avg_animals = 20 initial_animals = 50000 days = 14 death_rate = 5 total_animals = num_species * avg_animals total_animals_with_death = total_animals - death_rate total_animals_at_end = initial_animals + (total_animals_with_death * days) ...
Student: Sandy purchased 5 t-shirts for $18 each and a pair of sunglasses for $25. How much did Sandy pay for these items in total?
def solve() -> int: t_shirts = 5 t_shirt_price = 18 sunglasses = 1 sunglasses_price = 25 t_shirt_cost = t_shirts * t_shirt_price sunglasses_cost = sunglasses * sunglasses_price total_cost = t_shirt_cost + sunglasses_cost result = total_cost return result
Jane's dad wants to buy her a new car. Jane found a new car that she likes at a dealer that costs $20,000. Her dad has $5,000 to chip in for the car, and she plans to borrow the rest of the money from the bank. She has to pay 8% of interest for a year. How much will she have to pay back to the bank?
def solve() -> int: car_cost = 20000 money_from_dad = 5000 money_to_borrow = car_cost - money_from_dad interest_rate = 0.08 interest = money_to_borrow * interest_rate total_to_pay_back = money_to_borrow + interest result = total_to_pay_back return result
Alex went to the store to buy some items for school. He bought 4 notebooks, 2 pencils, and 3 highlighters. He paid in total $8. If each notebook costs $1 and each highlighter costs $2, how much did each pencil cost?
def solve() -> int: notebook_cost = 1 highlighter_cost = 2 total_cost = 8 pencil_cost = (total_cost - 4 * notebook_cost - 3 * highlighter_cost)/2 result = pencil_cost return result
If a pet store has 5 bags of dog food that each contain 3 kg, how many kilograms of dog food are there in total?
def solve() -> int: number_bags = 5 weight_bag = 3 total_weight = number_bags * weight_bag result = total_weight return result
Ryan's group held a book sale to raise money for their library. They sold novels, comics, magazines, and puzzles. After summing up all of their income, Ryan found out that they had made $520. The group made $160 from novels and the sales of the comics are twice as much as the sales of novels. Then, their sales for the ...
def solve() -> int: total = 520 novels = 160 comics = 2 * novels magazines = comics / 2 - 20 puzzles = total - novels - comics - magazines result = puzzles return result
In a jar of coins, there are 120 coins composed of quarters, nickels, and dimes in equal amounts. There were initially 30 dimes. If Mike takes an amount of coins equal to twice the difference between the number of nickels and the number of dimes, how many coins are remaining in the jar?
def solve() -> int: total_coins = 120 num_coins = total_coins / 3 initial_dimes = 30 initial_nickels = num_coins - initial_dimes coins_taken = 2 * (initial_nickels - initial_dimes) coins_remaining = total_coins - coins_taken result = coins_remaining ret...
A librarian has 500 books in her adult section and 800 books in her children's section. If she removes 50 adult books and four times as many children's books as adult books (without looking), how many books in total does she have left?
def solve() -> int: adult_books = 500 children_books = 800 removed_adult_books = 50 removed_children_books = 4 * removed_adult_books total_books = adult_books + children_books total_removed_books = removed_adult_books + removed_children_books books_left = total_books - total_remove...
Two athletes named Mary and Jack are training for a race. Mary earns $40 an hour while Jack earns $55 an hour. Jack runs for 2 hours every day. How many hours a day should Mary train to earn the same amount as Jack in a week?
def solve() -> int: jack_hourly_earnings = 55 jack_daily_hours = 2 jack_weekly_earnings = jack_hourly_earnings * jack_daily_hours * 7 mary_hourly_earnings = 40 mary_daily_hours = (jack_weekly_earnings / mary_hourly_earnings) / 7 result = mary_daily_hours return result
In a geography exam, Sara and David are on one team. The team's final score is obtained by adding the scores of the students of the same team. Out of the 30 questions, Sara got 3 mistakes while David got one-third of the score of Sara. How many incorrect answers did their team get?
def solve() -> int: sara_mistakes = 3 sara_score = 30 - sara_mistakes david_score = sara_score / 3 team_score = sara_score + david_score team_mistakes = 30 - team_score result = team_mistakes return result
A music store has 200 CDs. Emily and her 3 siblings take 1/6 of the CDs and decide to divide them equally among themselves. One of Emily's siblings doesn't like music very much and returns 2 CDs to the store. Later, Emily's friend Samantha comes to the store and takes 7 fewer CDs than those taken in total by Emily and ...
def solve() -> int: total_cds = 200 emily_and_siblings = total_cds * (1/6) cds_per_person = emily_and_siblings / 4 returned_cds = 2 cds_taken_by_samantha = emily_and_siblings - returned_cds - 7 cds_left = total_cds - emily_and_siblings - returned_cds - cds_taken_by_samantha result = cds...
John wants to make a cake. The recipe calls for 2 cups of sugar. He only has 1 cup of sugar. If he wants to make half the amount of cake, how much sugar does he need?
def solve() -> int: sugar_needed_full_recipe = 2 sugar_available = 1 cake_portion = 1/2 sugar_needed = sugar_needed_full_recipe * cake_portion result = sugar_needed - sugar_available return result
A pizza is cut into 8 slices and 4 people eat 2 slices each. How many slices are left?
def solve() -> int: num_slices = 8 num_people = 4 slices_per_person = 2 total_slices_eaten = num_people * slices_per_person slices_left = num_slices - total_slices_eaten result = slices_left return result
In a restaurant, there are 150 seats. 1/6th of them got reserved for a private party. 1/3rd of the remaining tables were closed due to maintenance work, and 15% of the remaining seats were empty throughout the evening. How many customers were served?
def solve() -> int: total_seats = 150 reserved_seats = total_seats / 6 remaining_seats = total_seats - reserved_seats closed_tables = remaining_seats / 3 remaining_seats = remaining_seats - closed_tables empty_seats = remaining_seats * 0.15 occupied_seats = remaining_seats - empty_seats ...
A pizza costs $12 and has 8 slices. How much does each slice cost?
def solve() -> int: cost = 12 slices = 8 cost_per_slice = cost / slices result = cost_per_slice return result
A movie theater has 150 seats. If all the tickets are sold and 25% of them were sold at a discount, how many tickets were sold at full price?
def solve() -> int: total_seats = 150 discount_percent = 0.25 discounted_tickets = total_seats * discount_percent full_price_tickets = total_seats - discounted_tickets result = full_price_tickets return result
A devious airline charges customers extra for their carry-on luggage during baggage check. If a customer's baggage weight is 20lbs and the charge is $1.50 per pound, how much would that person be charged?
def solve() -> int: baggage_weight = 20 charge_per_pound = 1.50 total_charge = baggage_weight * charge_per_pound result = total_charge return result
Ben is baking cupcakes for his class. He has a recipe that makes 12 cupcakes with 150 g of flour, 100 g of sugar, 75 g of butter, and 2 eggs. How many eggs does he need to make 60 cupcakes?
def solve() -> int: cupcakes_per_egg = 12 / 2 eggs_needed = 60 / cupcakes_per_egg result = eggs_needed return result
If the total value of a collections of quarters, dimes, and nickels is $6.55 and there are 67 coins with a total weight of 340 g, how many dimes are in the collection?
def solve() -> int: numOfDimes = (455 - 55 - 25)/10 result = int(numOfDimes) return result
Claire has 50 stamps. She gave away 30% of her stamps to her neighbor and 10% of remaining to her friend. How many stamps does she have now?
def solve() -> int: total_stamps = 50 stamps_given_to_neighbor = 0.3*total_stamps stamps_left = total_stamps - stamps_given_to_neighbor stamps_given_to_friend = 0.1*stamps_left result = stamps_left - stamps_given_to_friend return result
A number is increased by 20%, then the result is decreased by 20%. Find the final number if the original number is 100.
def solve() -> int: x = 100 x_increase = x + (x*0.2) x_decrease = x_increase - (x_increase*0.2) result = x_decrease return result
Tim drives at a speed of 60 km/hr for 2 hours and 80 km/hr for 3 hours. What is his average speed for the entire journey?
def solve() -> int: total_distance = 60*2 + 80*3 total_time = 2+3 average_speed = total_distance / total_time result = average_speed return result
Mark has 20 candies, he gives 3 to his friend on Monday, 4 on Tuesday, and 2 on Wednesday, how many candies does he have left?
def solve() -> int: candies = 20 candies -= 3 candies -= 4 candies -= 2 result = candies return result
A store offers a buy-one-get-one-free promotion on all items. If an item originally costs $20, how much will it cost to buy 3 of these items?
def solve() -> int: original_price = 20 total_items = 3 price_of_two = original_price * 2 price_of_third = original_price total_price = (total_items//2) * price_of_two + (total_items%2) * price_of_third result = total_price return result
Student: Tom and his four friends decided to take a road trip. It costed $100 in total to rent a car. How much money did each person contribute for the rental fee?
def solve() -> int: total_cost = 100 num_people = 5 contribution_per_person = total_cost / num_people result = contribution_per_person return result
Sophie is a pilot and needs to make sure her plane doesn't exceed its weight limit. Her plane can hold a maximum weight of 2000 lbs and there are 5 passengers on board. Each passenger has 2 bags, each weighing 50 lbs. How much weight will Sophie need to remove so the plane doesn't exceed the weight limit?
def solve() -> int: max_weight = 2000 num_passengers = 5 bag_weight = 50 total_bag_weight = num_passengers * 2 * bag_weight weight_to_remove = total_bag_weight - max_weight result = weight_to_remove return result
For every 30 minutes that Jack spends coding, he spends an additional 10 minutes debugging and 15 minutes browsing social media. If he codes for a total of 2 hours, how much time did he spend debugging and browsing social media? Lena is 25 years old. She has a younger sister, Emily, who is 8 years younger. If Lena and ...
def solve() -> int: coding_time = 2 * 60 debugging_time = 0 social_media_time = 0 debugging_time = (coding_time // 30) * 10 social_media_time = (coding_time // 30) * 15 total_time = debugging_time + social_media_time result = total_time return result
Amanda has 4 tubs of ice cream to share with her friends of 10 and her babysitter. If each tub had 16 scoops and Amanda, her friends, and her babysitter each had 3 scoops, how many scoops are left?
def solve() -> int: tubs_of_ice_cream = 4 friends = 10 babysitter = 1 scoops_per_tub = 16 scoops_per_person = 3 total_scoops = tubs_of_ice_cream * scoops_per_tub total_people = friends + babysitter + 1 scoops_taken = total_people * scoops_per_person scoops_left = total_scoo...
Peter ran 12 laps in half an hour. What is his average speed in miles/hour if each lap is 300 meters and 1 mile equals 1609 meters?
def solve() -> int: n_laps = 12 lap_distance = 300 run_time_in_hours = 0.5 mile_distance = 1609 total_dist = n_laps*lap_distance total_dist_in_miles = total_dist/mile_distance speed = total_dist_in_miles/run_time_in_hours result = speed return result
- If a caterpillar has 16 segments and each segment has two legs, how many legs would be on 3 more than 7 caterpillars?
def solve() -> int: caterpillars = 7 + 3 segments = caterpillars * 16 legs = segments * 2 result = legs return result
Two sisters, Emily and Grace, have $25 and $35 respectively. If they want to share their money equally, how much money will Emily give to Grace?
def solve() -> int: emily_money = 25 grace_money = 35 total_money = emily_money + grace_money money_per_person = total_money / 2 emily_gives = emily_money - money_per_person result = emily_gives return result
Student: At the pet shelter, there are 12 cats, 9 dogs, and 4 parrots. How many animals in total are in the pet shelter?
def solve() -> int: cats = 12 dogs = 9 parrots = 4 total_animals = cats + dogs + parrots result = total_animals return result
-Possible questions and programs: Mia buys 4 packs of cookies for her party. Each pack has 12 cookies and costs $3. She also buys 3 bottles of juice for $2 each. How much did she spend in total?
def solve() -> int: packs = 4 cookies_per_pack = 12 pack_cost = 3 bottles = 3 bottle_cost = 2 cookie_cost = packs * pack_cost juice_cost = bottles * bottle_cost total_cost = cookie_cost + juice_cost result = total_cost return result
In a restaurant, 9 out of 36 customers are drinking wine. The rest of the customers are drinking beer and cocktails. The number of customers drinking cocktails is four times as many as the ones drinking wine. How many customers are drinking beer?
def solve() -> int: wine = 9 total_customers = 36 cocktails = 4 * wine beer = total_customers - wine - cocktails result = beer return result
Student: In a bicycle race, there are 22 bicycles. How many wheels and pedals are there in total on the race track?
def solve() -> int: bicycles = 22 wheels = bicycles * 2 pedals = bicycles * 2 result = wheels + pedals return result
Jason has two shelves of books. One shelf is made up of 4 books that weigh 4.2kg each and the other shelf has 5 books that weigh 2.3kg each. How much does all the books weigh together?
def solve() -> int: weight_of_books_shelf1 = 4.2 * 4 weight_of_books_shelf2 = 2.3 * 5 total_weight = weight_of_books_shelf1 + weight_of_books_shelf2 result = total_weight return result
A farmers' market sells apples and oranges. If the market sold 163 kilos of apples and 97 kilos of oranges, and each box only contains fruit of the same kind weighing 5 kilos, how many boxes are incomplete?
def solve() -> int: apples_weight = 163 oranges_weight = 97 box_weight = 5 apples_boxes = apples_weight // box_weight oranges_boxes = oranges_weight // box_weight incomplete_boxes = (apples_weight % box_weight > 0) + (oranges_weight % box_weight > 0) result = incomplete_boxes ...
A group of 20 people went out to eat and want to split the cost of the bill evenly. If the total bill, including tax and tip, came out to $276.80, how much does each person need to contribute?
def solve() -> int: total_bill = 276.80 num_people = 20 amount_per_person = total_bill / num_people result = amount_per_person return result
Student: 4. Mia went to the supermarket and bought 48 crackers. She gives away 7/8 of the crackers to her friends. Of the remaining crackers, she eats 1/2 of them. How many crackers does she have left?
def solve() -> int: crackers_bought = 48 crackers_given_away = 7/8 * crackers_bought crackers_remaining = crackers_bought - crackers_given_away crackers_eaten = 1/2 * crackers_remaining result = crackers_remaining - crackers_eaten return result
A couple is saving for their dream wedding. They save $200 each per week. If they saved a total of $7,200 in 3 months, how much more do they need to save to reach their goal of $15,000?
def solve() -> int: amount_saved_per_week = 200 total_saved_in_3_months = amount_saved_per_week * 12 amount_still_needed = 15000 - total_saved_in_3_months result = amount_still_needed return result
Student: A car travels a distance of 240 km in 3 hours. What is the average speed of the car?
def solve() -> int: distance = 240 time = 3 speed = distance / time result = speed return result
A high school basketball team is holding a fundraiser by selling popcorn. Each bag of popcorn weighs 5 ounces and each plastic bag can hold a maximum of 80 ounces of popcorn before it breaks. The team wants to fill each bag with an equal number of popcorn bags and they need 6 full bags. How many bags of popcorn should ...
def solve() -> int: num_bags = 6 max_weight = 80 popcorn_weight = 5 num_popcorn_bags = max_weight // popcorn_weight result = num_popcorn_bags * num_bags return result
A college has 3000 students. If 40% of them are women and 60% of the women have brown eyes, how many students are women with brown eyes?
def solve() -> int: num_students = 3000 num_women = num_students * 0.4 num_women_with_brown_eyes = num_women * 0.6 result = num_women_with_brown_eyes return result
Jane had $500 in her savings account. She deposits an additional $100. What percentage increase is there in her savings account?
def solve() -> int: initial_savings = 500 additional_deposit = 100 total_savings = initial_savings + additional_deposit percentage_increase = ((total_savings - initial_savings) / initial_savings) * 100 result = percentage_increase return result
Bob has 48 stickers. He has 20 animal stickers, 12 sports stickers, and the rest are superhero stickers. How many superhero stickers does Bob have?
def solve() -> int: animal_stickers = 20 sports_stickers = 12 total_stickers = 48 superhero_stickers = total_stickers - animal_stickers - sports_stickers result = superhero_stickers return result
At the shoe store, Mark bought 2 pairs of shoes and 3 pairs of socks for $120 total, and Sarah bought 4 pairs of socks for $40 total. Each pair of shoes cost the same price, and each pair of socks cost the same price. What is the cost of 1 pair of shoes?
def solve() -> int: result = 45 return result
In a pastry shop, a cupcake is priced at $3.50, a muffin is priced at $2.50, and a slice of cake is priced at $4. If they sell 60 cupcakes, 40 muffins, and 30 slices of cake in one day, what was their total revenue for the day?
def solve() -> int: price_cupcake = 3.50 price_muffin = 2.50 price_cake = 4 num_cupcakes = 60 num_muffins = 40 num_cake = 30 total_rev = (num_cupcakes*price_cupcake) + (num_muffins*price_muffin) + (num_cake*price_cake) result = total_rev return result
Amy runs a flower shop. She counted 30 flowers left at the end of the day but had 50 flowers at the start of the day. During the day, Amy sold 15 flowers and some wilted during the day. How many flowers wilted during the day?
def solve() -> int: start_of_day = 50 end_of_day = 30 sold = 15 wilted = start_of_day - end_of_day - sold result = wilted return result
Joseph buys 20 bags of flour for $8 each. He wants to sell them for $12 per bag. What is his total profit?
def solve() -> int: bags_of_flour = 20 cost_per_bag = 8 selling_price_per_bag = 12 total_cost = bags_of_flour * cost_per_bag total_revenue = bags_of_flour * selling_price_per_bag total_profit = total_revenue - total_cost result = total_profit return result
Two pipes of length 40 m and 30 m respectively can fill a swimming pool in 20 hours and 30 hours respectively. How long will it take to fill the pool when both pipes are used together? Let's assume that the swimming pool requires a total of x hours to fill up. The work and time formula here is Work = Rate x Time. The r...
def solve() -> int: pipe1_length = 40 pipe2_length = 30 time1 = 20 time2 = 30 rate1 = pipe1_length / time1 rate2 = pipe2_length / time2 total_rate = rate1 + rate2 time_to_fill_pool = pipe1_length * pipe2_length / (pipe1_length + pipe2_length) / total_rate result = round((time_to_fill...
Ava plays tennis for 45 minutes before breakfast and 1 hour after dinner 5 days a week. She plays for 3.5 hours on weekends. How many hours of tennis does she do over 4 weeks?
def solve() -> int: minutes_before_breakfast = 45 hours_after_dinner = 1 days_per_week = 5 hours_on_weekends = 3.5 weeks = 4 total_hours_per_week = (minutes_before_breakfast + hours_after_dinner) * days_per_week / 60 total_hours_over_4_weeks = total_hours_per_week * weeks + hours_o...
Mark made 15 sandwiches and 6 burgers. He served 10 sandwiches and 3 burgers. How many sandwiches and burgers are left for Mark?
def solve() -> int: sandwiches_made = 15 burgers_made = 6 sandwiches_served = 10 burgers_served = 3 sandwiches_left = sandwiches_made - sandwiches_served burgers_left = burgers_made - burgers_served result = f'Sandwiches left: {sandwiches_left}, Burgers left: {burgers_left}' ...
5. Gina has a stock of 500 donuts. She wants to package them in boxes of 50. How many boxes does she need?
def solve() -> int: number_of_boxes = 500 / 50 result = number_of_boxes return result
A car traveled at 60 kph for the first 120 kilometers and then traveled at 80 kph for the remaining distance. If the distance of the trip is 200 kilometers, how long was the trip in hours?
def solve() -> int: distance_1 = 120 distance_2 = 200 - distance_1 time_1 = distance_1 / 60 time_2 = distance_2 / 80 total_time = time_1 + time_2 result = total_time return result
A car rental company offers a car for $50 per day plus $0.20 per mile. You plan on renting the car for 3 days and driving 200 miles. How much will you pay?
def solve() -> int: price_per_day = 50 price_per_mile = 0.2 total_days = 3 total_miles = 200 total_price = total_days * price_per_day + total_miles * price_per_mile result = total_price return result
Joe is driving from city A to city B, which is 120 km away. He then turns around and drives back to city A. Later, he drives from city A to city C, which is 180 km away. Finally, he drives back to city A. How many kilometers did he drive in total?
def solve() -> int: distance_AB = 120 distance_AC = 180 total_distance = (2*distance_AB) + (2*distance_AC) result = total_distance return result
Liam can run at three times the speed that Ethan can. Ethan can run at half the speed that Alex can. If Alex can run at 12 miles per hour, at what speed can Liam run?
def solve() -> int: alex_speed = 12 ethan_speed = alex_speed / 2 liam_speed = ethan_speed * 3 result = liam_speed return result
Kevin earns an hourly wage of $16.50. If he works 40 hours a week, how much does he earn in a year before taxes? Assume he works 52 weeks per year.
def solve() -> int: hourly_wage = 16.50 weekly_hours = 40 weeks_per_year = 52 income_per_year = hourly_wage * weekly_hours * weeks_per_year result = income_per_year return result
Charles needs to take a trip of 600 miles from his home. He drives for 2 hours and 50 minutes at 70 miles/hour and then speeds up to 90 miles/hour for 4 hours. How far is he from his destination?
def solve() -> int: time_1 = 2.8333 speed_1 = 70 time_2 = 4 speed_2 = 90 distance_1 = time_1 * speed_1 distance_2 = time_2 * speed_2 total_distance = distance_1 + distance_2 total_distance_remain = 600 - total_distance result = total_distance_remain r...
You want to give 84 baseballs to 7 kids so that each kid gets the same number of baseballs. How many baseballs will each kid get?
def solve() -> int: total_baseballs = 84 num_of_kids = 7 baseballs_per_kid = total_baseballs // num_of_kids result = baseballs_per_kid return result
Mike swims 6 laps per minute. He swims for 45 minutes on Monday, 1 hour on Tuesday, 45 minutes on Wednesday, and 15 minutes on Thursday. If he wants to swim 200 laps for the week, how many minutes should he swim on Friday? Sarah has the option of getting a $400 purse with a 25% discount or a $300 purse. How much money ...
def solve() -> int: laps_per_minute = 6 monday_minutes = 45 tuesday_minutes = 60 wednesday_minutes = 45 thursday_minutes = 15 total_laps = monday_minutes * laps_per_minute + tuesday_minutes * laps_per_minute + wednesday_minutes * laps_per_minute + thursday_minutes * laps_per_minute friday_la...
A group of 6 friends rent a cabin in the woods for a weekend. The cabin costs $500 for the weekend and $30 per person for food. Half of the group decides to rent a boat for $100 for the day. If the weekend gets cancelled due to a forest fire and the group gets an 85% refund, how much money do they lose?
def solve() -> int: cabin_cost = 500 food_cost_per_person = 30 num_friends = 6 boat_rental_cost = 100 refund_percentage = 0.85 total_cost = cabin_cost + (food_cost_per_person * num_friends) + boat_rental_cost refund_amount = total_cost * refund_percentage money_lost = total_cost - r...
A store sells 500 items, with 70% of them being electronics and the rest being non-electronics. If the store has 35% off electronics and 20% off non-electronics, what is the total price?
def solve() -> int: total_items = 500 electronics_percent = 0.7 non_electronics_percent = 1 - electronics_percent electronics_price = 100 non_electronics_price = 50 electronics_discount = 0.35 non_electronics_discount = 0.2 electronics_count = total_items * electronics_percent non_el...
A group of 5 friends want to split a $50 gift card equally. Initially, only 4 were present, so they decided to split the cardAt least 25% of Lily's pencils are mechanical. All of the rest are wooden, except for 6 that are colored. If she has 48 pencils, how many of them are wooden?
def solve() -> int: total_pencils = 48 mechanical_pencils_percentage = 25 colored_pencils = 6 mechanical_pencils = total_pencils * mechanical_pencils_percentage / 100 wooden_pencils = total_pencils - mechanical_pencils - colored_pencils result = wooden_pencils return resu...
Samuel is planning to purchase a new mattress which costs $1200. The furniture store allows payment in installments of $150 if a 20% down payment is made. If Samuel wants to pay an additional $100 for the down payment, what will be his remaining balance after paying for 10 months?
def solve() -> int: price_of_mattress = 1200 down_payment = 150 + 100 remaining_balance = price_of_mattress - down_payment monthly_payment = 150 months = 10 total_paid = down_payment + (monthly_payment * months) remaining_balance -= total_paid result = remaining_balance return r...
A circular garden has a radius of 12 feet. What is the area of the garden in square feet?
def solve() -> int: radius = 12 pi = 3.14 area = pi * radius ** 2 result = area return result
Student: Joey went to the store and bought 12 apples that cost $0.75 each, 4 pizzas that cost $10.00 each and 7 juices that cost $2.00 each. How much more money will Joey need to spend to be eligible for free shipping which requires a purchase of $50.00 or more?
def solve() -> int: apples = 12 pizzas = 4 juices = 7 apple_cost = 0.75 pizza_cost = 10.00 juice_cost = 2.00 total_cost = apples * apple_cost + pizzas * pizza_cost + juices * juice_cost needed_cost = 50.00 - total_cost result = needed_cost return result
Tom wants to buy a car worth $8000. He has saved half the amount. His father gives him 20% of the remaining amount. How much more does he need to buy the car?
def solve() -> int: car_price = 8000 saved_amount = car_price / 2 remaining_amount = car_price - saved_amount father_contribution = remaining_amount * 20 / 100 needed_amount = remaining_amount - father_contribution result = needed_amount return result
(check the format of the sample problem) Possible new questions and programs are: Alice is baking a cake and needs 3 cups of flour, 2 cups of sugar and 1 cup of butter. She has a measuring cup that can hold 1/4 cup of any ingredient. How many times does she need to fill and empty the measuring cup to get all the ingred...
def solve() -> int: fillings = 0 for ingredient in [3, 2, 1]: fillings += ingredient / 0.25 result = fillings return result
Possible questions and programs are: There are 6 boxes of chocolates and each box has 15 pieces. If each chocolate piece weighs 10 grams, how much chocolate is there in total in 2 boxes?
def solve() -> int: pieces = 2 * 15 weight = pieces * 10 result = weight return result
Student: Tony bought 4 textbooks for $25 each and 8 notebooks for $10 each. What is the total cost of all the books Tony bought?
def solve() -> int: textbooks = 4 textbook_price = 25 notebooks = 8 notebook_price = 10 total_textbook_cost = textbooks * textbook_price total_notebook_cost = notebooks * notebook_price total_cost = total_textbook_cost + total_notebook_cost result = total_cost return result
Student: A factory produces 100 units in 4 hours. How many units will it produce in 10 hours?
def solve() -> int: units_produced = 100 hours_taken = 4 hours_required = 10 units_produced_in_10_hours = units_produced * (hours_required / hours_taken) result = units_produced_in_10_hours return result
Alex pays for a bag of chips with 2 quarters, 4 nickels, and 2 pennies. He gets 11 cents back in change. How many cents did the bag of chips cost?
def solve() -> int: quarters = 2 nickels = 4 pennies = 2 change = 11 total_paid = quarters * 25 + nickels * 5 + pennies cost = total_paid - change result = cost return result
Jane has 60% more candies than Jessica. Jessica has 90 candies. How many candies does Jane have?
def solve() -> int: jessica_candies = 90 jane_candies = jessica_candies + (jessica_candies * 60)/100 result = jane_candies return result
Student: The price of a concert ticket is $75. If there are 1500 tickets available and 900 are sold, how much money did the promoters make?
def solve() -> int: ticket_price = 75 total_tickets = 1500 tickets_sold = 900 total_money_made = ticket_price * tickets_sold result = total_money_made return result
If a bag of candy includes 30 candy pieces and you want to divide them equally among 5 children, how many does each child get?
def solve() -> int: candy_pieces = 30 children = 5 candy_per_child = candy_pieces/children result = f'<<<{candy_per_child}>>>' result = candy_per_child return result
A musician can write 2 songs in 3 hours with a guitar. She can write 3 songs in 5 hours with a piano. How long will it take her to write 15 songs using both instruments?
def solve() -> int: songs_with_guitar_per_hour = 2/3 songs_with_piano_per_hour = 3/5 total_songs = 15 total_songs_per_hour = songs_with_guitar_per_hour + songs_with_piano_per_hour hours_needed = total_songs / total_songs_per_hour result = hours_needed return result
A student answers 80% of the quiz questions correctly. If there are 40 questions in the quiz, how many questions did the student answer correctly?
def solve() -> int: total_questions = 40 correct_percent = 80 correct_answers = total_questions*(correct_percent/100) result = correct_answers return result
Joanne bought some apples and oranges. She bought 4 times as many apples as oranges. In total, she bought 40 fruits. How many apples did Joanne buy?
def solve() -> int: apples = 0 oranges = 0 apples = (40 - 0)/4 result = 10 return result
Student: Maria needs to buy PVC pipe for a project. She needs 540 inches of pipe. The pipe is sold in units of 10 foot lengths. How many lengths of the pipe will she need to buy?
def solve() -> int: pipe_length_inches = 10 * 12 total_pipe_length_inches = 540 total_pipe_length_feet = total_pipe_length_inches / 12 total_pipe_length_units = total_pipe_length_feet / 10 result = int(total_pipe_length_units) + 1 if total_pipe_length_units % 1!= 0 else int(total_pipe_length_units) ...
A rectangular field measures 20 meters by 40 meters. If the perimeter is increased by 20 meters, what is the new area of the field?
def solve() -> int: length = 20 width = 40 old_perimeter = 2 * (length + width) new_perimeter = old_perimeter + 20 new_width = (new_perimeter - 2 * length) / 2 new_area = length * new_width result = new_area return result
Student: A carpenter needs to purchase some wood. If he needs 3/4 inch of wood for each shelf and has to make 5 such shelves, how many inches of wood would he need?
def solve() -> int: wood_per_shelf = 3/4 num_shelves = 5 total_wood = wood_per_shelf * num_shelves result = total_wood return result
Evan bought six times as many chocolates for his sister as he bought for himself and had 54 chocolates left. If Evan bought 3 chocolates for himself, how many chocolates did he buy before? Sarah walks to school and back home each day for 3 school days. Her school is 10 miles away. She also goes for a weekend walk of 30...
def solve() -> int: chocolates_for_self = 3 chocolates_for_sister = 6 * chocolates_for_self total_chocolates = chocolates_for_self + chocolates_for_sister left_chocolates = 54 bought_chocolates = total_chocolates + left_chocolates result = bought_chocolates school_distance = 10 week...
Maria is twice as old as her sister, who is five years younger than their brother. If their brother is 18, how old is Maria?
def solve() -> int: brother_age = 18 sister_age = brother_age - 5 maria_age = 2 * sister_age result = maria_age return result
A grocery store sold 50 pounds of apples for $75. If the store made a 30% profit on this sale, what was the cost per pound of the apples?
def solve() -> int: weight = 50 revenue = 75 profit_percentage = 0.3 cost_per_pound = revenue / weight / (1 + profit_percentage) result = cost_per_pound return result