question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A customer wants to buy a TV for $600 but the store is offering a 10% discount on all electronics. How much money will they save on the promotional purchase compared to the regular one?
def solve() -> int: price = 600 discount = 0.1 * price discounted_price = price - discount savings = price - discounted_price result = savings return result
A company produced 5000 units in 2020 and then increased its production by 50% in 2021. How many units did the company produce in total in 2021?
def solve() -> int: units_2020 = 5000 increase_percentage = 50 increase_factor = 1 + increase_percentage/100 units_2021 = units_2020 * increase_factor total_units_2021 = units_2020 + units_2021 result = total_units_2021 return result
Emily starts with 100 balloons. Every hour, she uses 6 balloons for a decoration and buys 20 balloons every 2 hours. How many balloons does she have left after 8 hours?
def solve() -> int: balloons = 100 for i in range(8): if i % 2 == 0 and i!= 0: balloons += 20 balloons -= 6 result = balloons return result
Mary had $49 and she spent $19. How much money does Mary have left?
def solve() -> int: Total_initial_money = 49 Money_spent = 19 Remaining_money = Total_initial_money - Money_spent result = Remaining_money return result
A water tank is 80% full. If the tank can hold 5000 litres of water, what is the current volume of water in the tank?
def solve() -> int: current_volume = 0.8*5000 result = current_volume return result
A courier service has 30 packages to deliver. Each delivery location is 8 miles apart and takes 40 minutes to travel between them. At each delivery location, the courier can drop off up to 5 packages. How many delivery locations will the courier need to visit to deliver all the packages?
def solve() -> int: num_packages = 30 distance_per_location = 8 time_per_location = 40 max_packages_per_location = 5 total_distance = num_packages // max_packages_per_location * distance_per_location total_time = num_packages // max_packages_per_location * time_per_location nu...
A car travels 156 miles in 3 hours. What is its average speed in miles per hour?
def solve() -> int: distance = 156 time = 3 result = distance/time return result
Lucy has a collection of coins. She has 15 pennies, 10 nickels, 5 dimes, and 2 quarters. How much money does she have in total?
def solve() -> int: pennies = 15 * 1 nickels = 10 * 5 dimes = 5 * 10 quarters = 2 * 25 total_cents = pennies + nickels + dimes + quarters total_dollars = total_cents / 100 result = total_dollars return result
Possible new questions and programs are: Anna and Ben are collecting stamps for a hobby. Anna has 5 more stamps than Ben. If together they have 73 stamps, how many stamps does Ben have?
def solve() -> int: from sympy import solve, Symbol x = Symbol('x') x = solve(x + x + 5 - 73) result = x[0] return result
Nathan wants to run a marathon. He needs 16 ounces of water for each mile. He has a 1-gallon water container. How many miles can he run without needing to refill his water bottle?
def solve() -> int: water_per_mile = 16 water_container = 1 gallon_to_ounce = 128 water_container_ounce = water_container * gallon_to_ounce miles_without_refill = water_container_ounce // water_per_mile result = miles_without_refill return result
A construction company needs 2000 bricks to build a small house. If each brick weighs 2 pounds, what is the total weight of all the bricks?
def solve() -> int: total_weight = 2000*2 result = total_weight return result
There are 32 cars in a parking lot. 10 more cars arrive and 5 cars leave. How many cars are there now?
def solve() -> int: cars_initial = 32 cars_added = 10 cars_removable = 5 result = cars_initial + cars_added - cars_removable return result
arah wants to go to the beach. It takes her 40 minutes to drive there at an average speed of 40 mph. How many miles is it from Sarah's home to the beach?
def solve() -> int: driving_time = 40 speed = 40 distance = driving_time * speed result = distance return result
A carpenter needs to cut boards that are 144 inches long into pieces that are 6 inches long. How many cuts does he need to make?
def solve() -> int: board_length = 144 piece_length = 6 cuts_needed = int(board_length / piece_length) result = cuts_needed return result
David wants to buy a new phone that costs $800. He plans to make monthly payments over 2 years at an interest rate of 3%. The monthly payments will be divided equally. How much will David pay each month?
def solve() -> int: total_cost = 800 interest_rate = 0.03 num_of_years = 2 num_of_months = num_of_years * 12 interest_per_month = total_cost * interest_rate / num_of_months total_cost_with_interest = total_cost + (total_cost * interest_rate) monthly_payment = total_cost_with_interest / num_o...
A daycare has a set number of children enrolled. Each child drinks 1 carton of milk during snack time and the daycare always keeps an extra 15 cartons of milk to make sure they don't run out. If the daycare goes through 115 cartons of milk every day, how many children are enrolled?
def solve() -> int: extra_cartons = 15 total_cartons = 115 children_cartons = total_cartons - extra_cartons enrolled_children = children_cartons / 1 result = enrolled_children return result
Kate went to see a movie with her friends. The tickets were priced at $8.50 for children and $11.50 for adults. There were 5 children and 4 adults in their group. How much did Kate spend in total for her and her friends?
def solve() -> int: child_ticket_price = 8.50 adult_ticket_price = 11.50 num_children = 5 num_adults = 4 subtotal = (child_ticket_price * num_children) + (adult_ticket_price * num_adults) result = subtotal return result
In a game, a player has 10 cards, and 4 of them are kings. What percentage of the cards is not a king?
def solve() -> int: total_cards = 10 kings = 4 non_kings = total_cards - kings percentage_non_kings = (non_kings / total_cards) * 100 result = percentage_non_kings return result
Maggie drives an electric car that can travel 400 miles on a single charge. She drives 90 miles round trip to visit her sister 4 times a week. Her car battery can hold 100 KWh. She begins the week with a fully charged battery and when she runs out of charge, she charges at the nearest charging station for $0.20 per KWh...
def solve() -> int: weekly_distance = 90 * 4 total_distance = weekly_distance * 3 num_charges = total_distance / 400 total_energy = num_charges * 100 charging_cost = total_energy * 0.20 result = charging_cost return result
John stores his pencils by colors. He has a total of 20 pencils. A third of his red pencils can be sold for $0.75 each and the rest for $0.50 each. If all his red pencils are sold, how much will he earn?
def solve() -> int: red_pencils_total = 20 / 2 red_pencils_sold_higher = red_pencils_total / 3 red_pencils_sold_lower = red_pencils_total - red_pencils_sold_higher earning_higher = red_pencils_sold_higher * 0.75 earning_lower = red_pencils_sold_lower * 0.50 result = earning_higher + earning_lowe...
Emma, Fred, Grace, and Henry were playing with Lego bricks. Emma had 32 red bricks, Fred had 24 blue bricks, Grace had 18 yellow bricks, and Henry had 26 green bricks. They wanted to build a tower with all their bricks, but they had to use the same number of bricks from each color. How many bricks did they use for the ...
def solve() -> int: min_bricks = min(32, 24, 18, 26) tower_bricks = min_bricks * 4 result = tower_bricks return result
A car travels 60 km/h. How far will it go in 4 hours?
def solve() -> int: distance_per_hour = 60 distance = distance_per_hour * 4 result = distance return result
David has a collection of 10 stamps. Each stamp is worth $5, except for one which is worth $10. He decided to sell his collection. To do it fast, he decided to sell each of them for $2 less than their value. How much will David earn if he sells all the stamps?
def solve() -> int: num_stamps = 10 stamp_value = 5 special_stamp_value = 10 total_value = num_stamps * stamp_value + special_stamp_value selling_price = stamp_value - 2 total_earnings = num_stamps * selling_price + special_stamp_value result = total_earnings ...
``` A TV costs $300, but it is on sale for 20% off. What is the sale price of the TV?
def solve() -> int: original_price = 300 discount_percent = 20 discount = original_price * discount_percent / 100 sale_price = original_price - discount result = sale_price return result
Cathy had 20 candies, then she ate 3 candies and shared 5 candies with her friends. Her mom gave her another 10 candies and her dad gave her 8 candies. She decided to eat 4 more candies and save the rest. How many candies does Cathy have left?
def solve() -> int: cathy = 20 eat = 3 share = 5 mom = 10 dad = 8 cathy = cathy - eat - share + mom + dad - 4 result = cathy return result
Steven needs to paint the outer walls of his house. He can paint 7 square meters in 5 minutes. If his house has a total wall area of 450 square meters, how long would it take him to paint the walls?
def solve() -> int: paint_speed = 7 / 5 wall_area = 450 time_taken = wall_area / paint_speed result = time_taken return result
Sarah has 50 pencils and wants to divide them evenly between her 5 friends. How many pencils will each friend get?
def solve() -> int: pencils = 50 friends = 5 pencils_per_friend = pencils // friends result = pencils_per_friend return result
Emma has a fabric that is 7 yards by 21 yards. If she wants to turn it into a square and use all the fabric, how long is each side of the square?
def solve() -> int: length = 7 width = 21 area = length * width side_length = area ** 0.5 result = side_length return result
A soda can has a radius of 3.5cm and a height of 10cm. If a pack of 12 sodas cost $10, how much does one soda cost (rounded to the nearest cent)?
def solve() -> int: radius = 3.5 height = 10 volume = 3.14 * radius**2 * height pack_price = 10 soda_price = pack_price/12 total_can = 1000/volume one_can_cost = soda_price/total_can result = round(one_can_cost, 2) return result
Student: Leslie needs to buy a chair for her bedroom and the chair costs $199. If she gives the seller a coupon that gives her 5% off, how much will the chair cost after the discount?
def solve() -> int: chair_price = 199 discount = 0.05 * chair_price final_price = chair_price - discount result = final_price return result
Max is making chili. For one serving of chili, the recipe calls for 1/2 cup of beans. In one can of beans, there are 15 ounces. How many cans of beans should Max buy to make 10 servings of chili?
def solve() -> int: servings = 10 beans_per_serving = 1/2 ounces_per_can = 15 total_beans_needed = servings * beans_per_serving cans_needed = total_beans_needed / ounces_per_can result = cans_needed return result
John and his friends had a pizza party and split the cost of the pizza equally. The total cost was $24. If there were 6 people at the party, how much did each person pay for a pizza slice?
def solve() -> int: total_cost = 24 num_people = 6 cost_slice = total_cost / num_people result = cost_slice return result
A library has 20,000 books. 5,000 are checked out and 500 are returned overdue. After that, 1/8 of the remaining books are reference books. How many reference books are in the library?
def solve() -> int: books_in_library = 20000 books_checked_out = 5000 books_returned_overdue = 500 books_remaining = books_in_library - books_checked_out + books_returned_overdue reference_books = books_remaining / 8 result = reference_books return result
During a sale, a shirt was discounted by 30%. If the original price of the shirt was $40, what was the sale price?
def solve() -> int: discount_percentage =... original_price =... sale_price =... result =... return result
Student: Miles bakes pies for a living. He needs to use 5 cups of flour for every 10 pies he makes. How many cups of flour will Miles need if he makes 65 pies?
def solve() -> int: flour_per_pie = 5 / 10 pies = 65 flour = flour_per_pie * pies result = flour return result
Daniel is throwing a dart at a target. The target has 4 zones. Zone 1 scores 10 points, zone 2 scores 20 points, zone 3 scores 30 points and zone 4 scores 40 points. He has 6 darts. He needs to score at least 100 points to win the prize. What is the minimum score he needs to get with each dart in order to have a chance...
def solve() -> int: total_darts = 6 total_points = 100 min_score_per_dart = (total_points + 10 * total_darts) // total_darts if (total_points + 10 * total_darts) % total_darts!= 0: min_score_per_dart += 1 result = min_score_per_dart return result
In a conference, 1000 attendees and 150 speakers were present. If each speaker gave a presentation twice, how many presentations were given in total? Carla has a monthly phone bill of $50. She works part-time and earns $12 per hour. If her monthly income is $260, how much is left after paying the phone bill?
def solve() -> int: attendees = 1000 speakers = 150 presentations_per_speaker = 2 total_presentations = speakers * presentations_per_speaker phone_bill = 50 monthly_income = 260 amount_left = monthly_income - phone_bill result = total_presentations, amo...
John wants to buy a barbell set. The barbell weighs 25 lbs, and he wants to purchase two pairs of weights - the first pair is 10 lbs, and the second pair is 15 lbs. How much total weight will he be purchasing?
def solve() -> int: x = (25 + 10 + 10 + 15 + 15) result = x return result
Sammy has two packs of candy. Each pack contains the same number of candies. She counted the candies and realized that if she had 4 more, she could divide them equally among her friends. If she has 14 candies in total, how many candies are in each pack?
def solve() -> int: total_candies = 14 candies_needed_for_equality = total_candies + 4 candies_in_each_pack = candies_needed_for_equality // 2 result = candies_in_each_pack return result
Lily and Mia are making bracelets. Lily has 18 beads and Mia has 6 more than Lily. They both use 4 beads for each bracelet. How many bracelets can they make in total?
def solve() -> int: lily = 18 mia = lily + 6 beads_per_bracelet = 4 lily_bracelets = lily // beads_per_bracelet mia_bracelets = mia // beads_per_bracelet total = lily_bracelets + mia_bracelets result = total return result
A chef needs 1 pound of hamburger meat to make 4 hamburgers. If he wants to make 20 hamburgers, how many pounds of hamburger meat does he need?
def solve() -> int: meat_per_hamburger = 1 / 4 total_hamburgers = 20 meat_needed = total_hamburgers * meat_per_hamburger result = meat_needed return result
Max, Jane, and Tom are sharing a pizza at a restaurant. They order a pizza that has 16 slices. Jane takes half of the pizza, Max takes a quarter of the pizza and Tom takes the remaining 1 slice. How many slices does Jane get?
def solve() -> int: num_slices = 16 slices_jane = num_slices / 2 slices_remaining = num_slices - (slices_jane * 2) slices_max = slices_remaining / 2 slices_tom = slices_remaining - slices_max result = slices_jane return result
Maria has 47 balls and she divided them into 5 containers. One container contains 9 balls, the other has 10 balls, the third has 13 balls, and the two other containers contain the same number of balls. How many balls are in each of the last two containers?
def solve() -> int: total_balls = 47 container_1 = 9 total_remaining_balls = total_balls - container_1 container_2 = 10 total_remaining_balls = total_remaining_balls - container_2 container_3 = 13 total_remaining_balls = total_remaining_balls - container_3 container_4_and_5 = total_rema...
A school has 2000 students. If 60% of them are boys, how many girls are there in the school?
def solve() -> int: total_students = 2000 boys_percentage = 0.6 boys_count = total_students * boys_percentage girls_count = total_students - boys_count result = girls_count return result
arah wants to buy a new laptop that costs $900. She has saved up $450 so far. If she saves $100 each month, how long will it take her to have enough money to buy the laptop?
def solve() -> int: saved_money = 450 cost_laptop = 900 monthly_savings = 100 months_needed = (cost_laptop - saved_money) / monthly_savings result = months_needed return result
There are a total of 9 10-cent coins and 13 5-cent coins. How much money do they have altogether?
def solve() -> int: total_amount = (9*10) + (13 * 5) result = total_amount / 100 return result
The Grade 6 students collected donations for a charity. The average donation from a girl was $15, while the average donation from a boy was $10. There were 16 girls and 14 boys in the class. The class also received a matching donation from the school of $100. What was the total amount of money raised for the charity?
def solve() -> int: donation_girls = 15 * 16 donation_boys = 10 * 14 donation_class = donation_girls + donation_boys total_money = donation_class + 100 result = total_money return result
In a garden, there are 6 rows of apple trees. In the first row, there are 7 trees, and in the second row, there are 10 trees. Each of the remaining rows has 3 more trees than the previous row. How many apple trees are there in total?
def solve() -> int: total = 0 for i in range(6): if i == 0: total += 7 elif i == 1: total += 10 else: total += (i + 6) result = total * 10 return result
A cube has a volume of 64 cm cubed. Calculate its surface area.
def solve() -> int: volume = 64 edge_length = volume**(1/3) surface_area = 6 * (edge_length**2) result = surface_area return result
The speed limit is 55 miles per hour. If a car is traveling at 75 miles per hour, how many miles over the speed limit is the car going?
def solve() -> int: speed_limit = 55 car_speed = 75 over_limit = car_speed - speed_limit result = over_limit return result
Sofia is baking a cake. She uses 2 cups of flour, 3 eggs, 1/2 cup of sugar, 1/4 cup of butter, and three times as much cocoa powder as sugar. What percentage of the cake batter is flour, rounded to the nearest integer?
def solve() -> int: flour = 2 eggs = 3 sugar = 1/2 butter = 1/4 cocoa_powder = 3 * sugar total_ingredients = flour + eggs + sugar + butter + cocoa_powder percentage_flour = (flour / total_ingredients) * 100 rounded_percentage_flour = round(percentage_flour) result = rounded...
A train travels 800 miles at an average speed of 80 miles per hour. How long did the journey take, in hours?
def solve() -> int: distance = 800 speed = 80 time = distance / speed result = f'<<<{time}>>>' result = time return result
Mr. Smith wants to complete his 5th grade lesson in mathematics that covers 10 topics. If there are 30 minutes per topic, how long will it take for Mr. Smith to finish all 10 topics?
def solve() -> int: num_topics = 10 time_per_topic = 30 total_time = num_topics * time_per_topic result = total_time return result
Ella is buying a new laptop and has a budget of $900. She found a laptop for $750 but also needs to buy a case for $45 and a mouse for $20. Will she have enough money with her budget to buy everything she needs?
def solve() -> int: total_cost = 750 + 45 + 20 if total_cost <= 900: result = True else: result = False return result
Sam earns $18 per hour for working at a bookstore. He works 15 hours per week and saves 25% of his income. How much does he save in 6 weeks?
def solve() -> int: income = 18 * 15 savings = 0.25 * income total_savings = savings * 6 result = total_savings return result
Student: Jeff has a circular grass lawn with a radius of 200 meters. If Jeff plans to cover the lawn with artificial grass and each roll of artificial grass can cover 5 square meters, how many rolls of artificial grass will Jeff need to purchase?
def solve() -> int: radius = 200 area = 3.14 * radius ** 2 grass_per_roll = 5 rolls_needed = area / grass_per_roll result = int(rolls_needed) return result
Lisa has $350 in her savings account. She spends $40 on a new book, then transfers a fifth of her remaining funds to her checking account. She spends the rest on a new pair of headphones. How much money does she have left in her checking account?
def solve() -> int: savings = 350 book = 40 savings -= book checking = savings / 5 savings -= checking headphones = savings result = checking return result
am wants to buy a new video game that costs $60. He has a coupon that gives him a 20% discount on any purchase. He also has to pay a 10% sales tax on the final price. How much will he have to pay for the video game?
def solve() -> int: game_cost = 60 discount_rate = 0.2 tax_rate = 0.1 discounted_price = game_cost * (1 - discount_rate) final_price = discounted_price * (1 + tax_rate) final_price = round(final_price, 2) result = final_price return result
David went on a road trip for 12 hours and broke down twice. He spent 2 hours fixing each incident. How many hours of travel did he have to himself?
def solve() -> int: total_hours = 12 breakdowns = 2 fixing_time = 2 total_fixing_time = breakdowns * fixing_time travel_time = total_hours - total_fixing_time result = travel_time return result
Emma is building 2 5 ft long by 3 ft wide garden beds and 3 6ft long by 2 ft wide garden beds. What is the total sq ft of growing space that she will have?
def solve() -> int: area1 = 5 * 3 area2 = 6 * 2 total_sq_ft = area1 + (3 * area2) result = total_sq_ft return result
Leo is pouring concrete into a foundation at a rate of 5 cubic feet per minute. The foundation requires 200 cubic feet of concrete. How many more cubic feet does he need to pour if he has been filling the foundation for 30 minutes?
def solve() -> int: rate = 5 required_concrete = 200 time = 30 concrete_poured = rate * time remaining_concrete = required_concrete - concrete_poured result = remaining_concrete return result
Tom has a fish tank that can hold 10 gallons of water. He fills it with 8 gallons of water and adds 4 fish. Each fish needs 1 gallon of water to swim comfortably. How many gallons of water does Tom need to remove from the tank to make enough space for the fish?
def solve() -> int: water_in_tank = 8 water_needed_for_fish = 4 water_extra = water_in_tank - water_needed_for_fish water_to_remove = water_extra result = water_to_remove return result
A car travels at a rate of 60 miles per hour. How many hours would it take to travel 240 miles?
def solve() -> int: hours = 240 / 60 result = hours return result
The ratio of boys to girls in a class is 3:5. If there are 24 students in the class, how many are boys?
def solve() -> int: total_students = 24 boy_ratio = 3 / 8 boys = boy_ratio * total_students result = boys return result
If a tank can hold 50 liters of water, and it takes 2 minutes to fill it up, how many liters of water can it hold in one hour?
def solve() -> int: liters_per_minute = 50 / 2 liters_per_hour = liters_per_minute * 60 result = liters_per_hour return result
John has 20 pencils in his pencil case. He gives 4 pencils to his friend and loses 2 pencils. How many pencils are left in his pencil case?
def solve() -> int: pencils = 20 pencils = pencils - 4 pencils = pencils - 2 result = pencils return result
6. A farmer needs to build a fence for his cows. If each pole in the fence is 8 feet apart, and the farmer needs a fence of 72 feet long, how many poles will he need?
def solve() -> int: distance = 8 length = 72 result = length / distance return result
The company had 100 employees at the beginning of the year, and hired 25 more employees during the year. If 10% of the employees were laid off during the year, how many employees did the company have at the end of the year?
def solve() -> int: initial_employees = 100 hired_employees = 25 total_employees = initial_employees + hired_employees laid_off_employees = total_employees * 0.1 final_employees = total_employees - laid_off_employees result = final_employees return result
Possible new questions and programs: Alice bakes cookies for her friends. She needs 3 cups of flour for every 12 cookies. She also needs 2 eggs, 1 cup of sugar, and 1/4 cup of butter for each batch of cookies. She has 36 eggs, 15 cups of sugar, and 3 cups of butter in her kitchen. How many cookies can she bake with the...
def solve() -> int: batches_flour = 15 // 3 batches_eggs = 36 // 2 batches_sugar = 15 batches_butter = 12 batches = min(batches_flour, batches_eggs, batches_sugar, batches_butter) cookies = batches * 12 result = cookies return result
John has 120 marbles. He wants to split them evenly among his 6 friends. How many marbles will each person get?
def solve() -> int: num_marbles = 120 num_friends = 6 marbles_per_person = num_marbles/num_friends result = marbles_per_person return result
Lisa has two rabbits. Each rabbit needs 1/6 of a pound of rabbit food four times a day. If Lisa has 10 pounds of rabbit food, how many pounds of rabbit food are left after three days?
def solve() -> int: rabbit_count = 2 food_per_rabbit_per_day = 1/6 feedings_per_day = 4 total_feedings_per_day = rabbit_count * feedings_per_day total_food_per_day = total_feedings_per_day * food_per_rabbit_per_day total_food_per_three_days = total_food_per_day * 3 remaining_food = 10 - tota...
A recipe of brownies requires 2 cups of sugar and 1 cup of flour. If we want to make 10 times the recipe, how much sugar and flour do we need?
def solve() -> int: sugar_per_recipe = 2 flour_per_recipe = 1 multiplier = 10 total_sugar = sugar_per_recipe*multiplier total_flour = flour_per_recipe*multiplier result = (total_sugar, total_flour) return result
Emma can run 6 miles in 45 minutes and Peter can run 10 miles in 60 minutes. How many more miles can Peter run in 90 minutes than Emma?
def solve() -> int: peter_speed = 10 / 60 emma_distance = 6 * (90 / 45) peter_distance = peter_speed * 90 result = peter_distance - emma_distance return result
A pizza parlor has 5 different types of pizza. If a pizza costs $12, how much does it cost to buy one of each type?
def solve() -> int: num_pizzas = 5 cost_per_pizza = 12 result = num_pizzas * cost_per_pizza return result
Brandon decided to buy a microphone and a stand. The microphone is $150 and the stand is 11 times that price. He gets a deal for 10% off. How much does he pay for everything?
def solve() -> int: microphone_cost = 150 stand_cost = microphone_cost * 11 discount = 10 discount_amount = (microphone_cost + stand_cost) * (discount / 100) result = microphone_cost + stand_cost - discount_amount return result
Student: Carol was the first runner in a race that had 12 people. If the runners were separated in six pairs, and each pair had to start with an interval of 5 minutes between them, how many minutes did Carol wait before she started running?
def solve() -> int: num_runners = 12 interval = 5 num_pairs = num_runners // 2 total_interval = num_pairs * interval result = total_interval return result
Sarah is buying chocolate bars for her soccer team. There are 20 players on the team, and she wants to give a chocolate bar to 80% of them. The chocolate bars cost $2.50 each. If she has $50, what percentage of her money will she spend on chocolate bars?
def solve() -> int: num_players = 20 percent_to_receive_chocolate = 80 num_players_to_receive_chocolate = num_players * percent_to_receive_chocolate / 100 cost_per_chocolate_bar = 2.5 total_cost = num_players_to_receive_chocolate * cost_per_chocolate_bar percent_of_money_spent = total_cost / 50 ...
In a track race, Lily ran 1600 meters. Jasmine ran 400 meters less than Lily, and Hannah ran twice the distance of Lily and Jasmine combined. The rest of the distance was run by their teammates. If the whole team ran 8000 meters, how many meters did their teammates run?
def solve() -> int: distance_Lily = 1600 distance_Jasmine = distance_Lily - 400 distance_Hannah = 2*(distance_Lily + distance_Jasmine) distance_team = 8000 distance_rest = distance_team - (distance_Lily + distance_Jasmine + distance_Hannah) result = distance_rest return result
Possible questions and programs: Ben and Cindy bought 60 chocolates for their party. Ben ate 15 of them, and Cindy gave away 40% of the leftover chocolates to their friends. How many chocolates are left for the party?
def solve() -> int: leftover = 60 - 15 given_away = 0.4 * leftover party = leftover - given_away result = party return result
If John spends $20 a week on groceries, how much does he spend in a year?
def solve() -> int: weekly_expense = 20 yearly_expense = weekly_expense * 52 result = yearly_expense return result
Tom has a rectangular garden with a length of 8 meters and a width of 5 meters. He wants to build a fence around it to keep the rabbits out. If the fence costs $2 per meter, how much will it cost him to build the fence?
def solve() -> int: perimeter = 2 * (8 + 5) cost_per_meter = 2 total_cost = perimeter * cost_per_meter result = total_cost return result
Jack had 27 bags of popcorn. He ate 1/3 of them and gave 2/5 of the remaining to his friends. How many bags of popcorn did Jack have left?
def solve() -> int: popcorns = 27 popcorn_eaten = popcorns / 3 popcorn_remaining = popcorns - popcorn_eaten popcorn_given_friends = 2 * (popcorn_remaining/ 5) popcorn_left = popcorns - (popcorn_eaten + popcorn_given_friends) result = popcorn_left return result
A bookshelf contains different numbers of books on 5 shelves. The number of books on the shelves follows an arithmetic sequence and the total number of books is 65. If the shelf with the fewest books has 7 books, how many books are on the shelf with the most books on it?
def solve() -> int: common_difference = (65-7*5)/(5-1) most_books = 7+common_difference*4 result = most_books return result
There are 20 students in a class. The ratio of boys to girls is 3:2. How many boys are in the class?
def solve() -> int: total_students = 20 boy_to_girl_ratio = 3 / 2 num_boys = total_students * (boy_to_girl_ratio / (boy_to_girl_ratio + 1)) result = f'There are {num_boys} boys in the class.' result = num_boys return result
Student: A recipe calls for 3 cups of flour to make 12 cookies. If you only want to make 6 cookies, how many cups of flour are needed?
def solve() -> int: cookies = 6 cookies_needed = 12 cups_needed = 3 cups_needed_for_cookies = cups_needed * (cookies / cookies_needed) result = cups_needed_for_cookies return result
A water tank starts with 10,000 gallons of water. Every day, they use 2000 gallons of water and restock with 5000 gallons of water. How much water will be in the tank after 2 weeks?
def solve() -> int: water = 10000 for day in range(14): water = water - 2000 + 5000 result = water return result
Student: A store is having a sale for 30% off all items. You have a coupon for an additional 20% off the sale price. If you buy a shirt originally $25, what is the final price?
def solve() -> int: original_price = 25 discount_1 = 0.3 discount_2 = 0.2 price_after_discount_1 = original_price * (1 - discount_1) price_after_discount_2 = price_after_discount_1 * (1 - discount_2) result = price_after_discount_2 return result
If Tim takes 7 hours to read a 200-page book, how long would it take him to read a 300-page book assuming the books are of the same difficulty?
def solve() -> int: pages_book1 = 200 hours_book1 = 7 pages_book2 = 300 hours_book2 = (hours_book1 / pages_book1) * pages_book2 result = hours_book2 return result
Maria drives 9 miles to the supermarket. From there, she drives 18 miles to the airport. From there, she drives 3 miles straight back home. How many additional miles did Maria drive round trip to the supermarket stop, compared to a round trip without the supermarket stop?
def solve() -> int: miles_to_supermarket = 9 miles_to_airport = 18 miles_back_home = 3 round_trip_without_supermarket = 2 * (miles_to_airport + miles_back_home) round_trip_with_supermarket = 2 * (miles_to_supermarket + miles_to_airport + miles_back_home) additional_miles = round_t...
Student: A toy factory fills orders by shipping full cartons of toys to a distributor. Each carton contains 24 boxes of toys and each box contains 6 toys. If the factory gets an order for 8,000 toys, how many cartons are needed to fill the order?
def solve() -> int: toys_per_carton = 24 * 6 order_size = 8000 cartons_needed = order_size // toys_per_carton result = cartons_needed return result
If John has $5,000 saved and he invests it with an annual interest rate of 6%, how much will he have in 7 years?
def solve() -> int: principal = 5000 years = 7 monthly_rate = 0.06 / 12 compounding_periods = years * 12 future_value = principal * pow(1 + monthly_rate, compounding_periods) result = future_value return result
Max has a vegetable garden and wants to buy enough seeds for his plants. He has space for 25 plants, and each plant needs 20 seeds. The store sells seed packets with 500 seeds. If Max buys the least amount necessary, how many seeds are left over?
def solve() -> int: num_plants = 25 seeds_per_plant = 20 seeds_per_packet = 500 total_seeds_needed = num_plants * seeds_per_plant num_packets_needed = total_seeds_needed // seeds_per_packet seeds_leftover = total_seeds_needed % seeds_per_packet result = seeds_leftover retu...
A hiker wants to plan a long-distance hike. He knows that he needs to pack 0.8 pounds of supplies for every mile he walks. He wants to go for 2 weeks but can only pack enough for 1 week. He can get a resupply that will be 40% as large as his first pack. If he plans to walk for 8In a shopping mall, three stores sold ite...
def solve() -> int: store_d = 20 store_c = store_d / 2 store_b = store_c + 5 store_a = store_b * 2 total_items = store_a + store_b + store_c + store_d result = total_items return result
Mr. Lee has a quarter and a dime in his pocket. How much money does he have in his pocket?
def solve() -> int: quarter_value = 0.25 dime_value = 0.10 total_value = quarter_value + dime_value result = total_value return result
A pizza restaurant charges $15 for a large pizza, $10 for a medium pizza, and $7 for a small pizza. If they sell 50 large pizzas, 75 medium pizzas, and 100 small pizzas, how much money will they make?
def solve() -> int: large_price = 15 medium_price = 10 small_price = 7 num_large = 50 num_medium = 75 num_small = 100 total_sales = (large_price * num_large) + (medium_price * num_medium) + (small_price * num_small) result = total_sales return result
If a marathon is 26.2 miles, and a runner runs at a pace of 8 minutes per mile, how long will it take the runner to complete the marathon in hours and minutes?
def solve() -> int: distance_in_miles = 26.2 pace_in_minutes = 8 time_in_minutes = distance_in_miles * pace_in_minutes time_in_hours = time_in_minutes // 60 time_in_minutes_remaining = time_in_minutes % 60 result = str(time_in_hours) + " hours and " + str(time_in_minutes_remaining) + " minutes" ...
A bakery made 100 loaves of bread in the morning and sold 75 of them. How many loaves of bread are left in the bakery?
def solve() -> int: loaves_baked = 100 loaves_sold = 75 loaves_left = loaves_baked - loaves_sold result = loaves_left return result
A garden measures 7 feet by 9 feet. How much land does it cover in total?
def solve() -> int: garden_length = 7 garden_width = 9 total_land = garden_length * garden_width result = total_land return result
Adam found out that his car needs 8 liters of oil for an oil change. Each liter costs $3.70 and he also has to pay a service fee of $50. How much does Adam pay in total?
def solve() -> int: liters = 8 rate_per_liter = 3.7 cost = liters * rate_per_liter total_cost = cost + 50 result = total_cost return result
Every weekend, Lisa bakes 12 cupcakes, each containing 200 calories. How many calories will Lisa consume if she eats half of the cupcakes she bakes in four weeks?
def solve() -> int: cupcakes_per_weekend = 12 calories_per_cupcake = 200 weekends_per_month = 4 fraction_eaten = 0.5 total_cupcakes = cupcakes_per_weekend * weekends_per_month cupcakes_eaten = total_cupcakes * fraction_eaten total_calories = cupcakes_eaten * calories_per_cupca...