question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
The Good Burger restaurant has a total of 25 employees. If each employee earns $1000 per month, how much does the restaurant need to pay for the salary of all their employees in a year?
def solve() -> int: employee_count = 25 salary_per_month = 1000 months_per_year = 12 total_salary = employee_count * salary_per_month * months_per_year result = total_salary return result
John has $500 in his bank account. He spends 20% of his money on clothing, and half of what is left on food. Then he spends $80 on a gift for his friend. How much money does he have left?
def solve() -> int: money = 500 clothing = money * 0.2 left = money - clothing food = left / 2 gift = 80 left = left - food - gift result = left return result
A company wants to give each of its 40 employees a $50 bonus at the end of the year. If the company has to pay a 5% tax on the bonuses, what is the total cost of the bonuses for the company?
def solve() -> int: total_bonus_cost = 40 * 50 tax_amount = total_bonus_cost * 0.05 total_cost = total_bonus_cost + tax_amount result = total_cost return result
James drives for a ride-sharing company, making $8 per ride for the first 20 rides, and then making 10% more per ride for the remaining rides. If he drives for a total of 35 rides, how much money does he make?
def solve() -> int: total_rides = 35 first_rides = 20 remaining_rides = total_rides - first_rides first_amount = first_rides * 8 remaining_amount = remaining_rides * 8.8 total_amount = first_amount + remaining_amount result = total_amount return result
A person walks at a rate of 3 miles per hour. If they walk for 2.5 hours, how many miles would they have walked?
def solve() -> int: speed = 3 time = 2.5 distance_covered = speed * time result = distance_covered return result
Mike jogs 2 km every day except on Fridays when he jogs 1 km. He burns 80 calories per km. He eats 2500 calories per day except for Sundays when he eats 2800 calories. What is his weekly caloric deficit?
def solve() -> int: distance_mon_thu_sat = 2*4 distance_fri = 1 calories_burned_per_km = 80 calories_burned_mon_thu_sat = calories_burned_per_km * distance_mon_thu_sat calories_burned_fri = calories_burned_per_km * distance_fri calories_consumed_mon_thu_sat = 4 * 2500 calories_consumed_fri =...
Student: - Ben has 24 packs of gum in his backpack. Each pack has 8 pieces of gum, and Ben gives away 2 pieces of gum to each of his 6 friends. How many pieces of gum does Ben have left in his backpack?
def solve() -> int: packs = 24 pieces_per_pack = 8 friends = 6 pieces_given_away = 2 total_pieces = packs * pieces_per_pack pieces_left = total_pieces - (friends * pieces_given_away) result = pieces_left return result
A recipe for muffins calls for 1.5 cups of flour, 0.5 cups of sugar, and 1 egg for every 4 muffins. If Lisa wants to make 12 muffins, and she has 8 cups of flour, 3 cups of sugar, and 20 eggs, how much flour will she have left over?
def solve() -> int: muffins_needed = 12 flour_needed = 1.5 * (muffins_needed / 4) flour_leftover = 8 - flour_needed result = flour_leftover return result
A teacher has 18 pencils. She gave 9 to her students. She then received 6 more pencils from the school supply closet. How many pencils does she have now?
def solve() -> int: pencils_start = 18 pencils_given = 9 pencils_received = 6 pencils_now = pencils_start - pencils_given + pencils_received result = pencils_now return result
If one gardener can plant one hundred flowers per day, how many gardeners would it take to plant two thousand flowers in six days?
def solve() -> int: flowers_per_day = 100 total_flowers = 2000 days = 6 flowers_planted = flowers_per_day * days gardener_needed = total_flowers / flowers_planted result = gardener_needed return result
Jann has 3 quarters, 4 dimes, and 5 pennies. How much money does Jann have in total?
def solve() -> int: total = 0 total += 3 * 0.25 total += 4 * 0.1 total += 5 * 0.01 result = total return result
If a box can hold 2400 mL of liquid, how much water can fit in 8 boxes?
def solve() -> int: volume_box = 2400 num_boxes = 8 total_volume = num_boxes * volume_box result = total_volume return result
A pizza is cut into 8 slices. If 2 slices are taken by 3 different people, how many slices are remaining?
def solve() -> int: total_slices = 8 taken_slices = 2 * 3 remaining_slices = total_slices - taken_slices result = remaining_slices return result
A pizza has 8 slices and each slice has 200 calories. If Bob will eat 3 slices of pizza and drink a can of soda that has 140 calories, how many calories will he consume?
def solve() -> int: pizza = 200 soda = 140 total_pizza = pizza * 3 total_soda = soda * 1 total_calories = total_pizza + total_soda result = total_calories return result
A store can sell 150 shirts in a day. Another store can sell 200 shirts in a day. If they work together, how many shirts can they sell in a day?
def solve() -> int: store1_sales = 150 store2_sales = 200 total_sales = store1_sales + store2_sales result = total_sales return result
Alex can run a mile in 6 minutes. Max can do it in 5 minutes. Sarah and Lucy take 7 minutes each while Emily only needs 4 minutes. What is the average time it takes to run a mile?
def solve() -> int: alex_time = 6 max_time = 5 sarah_time = 7 lucy_time = 7 emily_time = 4 total_time = alex_time + max_time + sarah_time + lucy_time + emily_time average_time = total_time / 5 result = average_time return result
A bookstore is having a buy one get one half off sale. A book costs $20, how much will it cost for two books after the sale, not including sales tax?
def solve() -> int: price_per_book = 20 discount = price_per_book * 0.5 final_price = price_per_book + discount total_price = final_price * 2 result = total_price return result
Lisa has 8 kilograms of potatoes to sort. She can sort 2 kilograms a day. How many days will it take Lisa to sort all the potatoes in 8 weeks?
def solve() -> int: potatoes = 8 kg_per_day = 2 weeks = 8 result = potatoes / kg_per_day / weeks return result
Tom has $280, he spent 2/5 of the money on some sports equipment, then he spent 3/5 of the remaining money on a trip. If he has $80 left now, how much did Tom spend on the sports equipment?
def solve() -> int: money = 280 spent_sports_equipment = money * 2 / 5 money -= spent_sports_equipment money *= 3 / 5 money -= 80 result = spent_sports_equipment return result
Student: A cake shop has 30 cakes in the refrigerator. If 10 cakes have been sold, how many are left?
def solve() -> int: total_cakes = 30 sold_cakes = 10 remaining_cakes = total_cakes - sold_cakes result = remaining_cakes return result
A rectangular plot of land measures 16 meters by 21 meters. What is the area of this piece of land in square meters?
def solve() -> int: length = 16 width = 21 area = length * width result = area return result
On Monday, Mia has 35 candies. On Tuesday, she eats 40% of them. On Wednesday, she shares 15 candies with her friends. On Thursday, she buys 20% of what she had on Tuesday. How many candies does Mia have on Thursday?
def solve() -> int: monday_candies = 35 tuesday_candies = monday_candies * (1 - 0.4) wednesday_candies = tuesday_candies - 15 thursday_candies = tuesday_candies * 1.2 result = thursday_candies return result
A school has 500 students. 30% of them are in the chorus and the rest are not. How many students are not in the chorus?
def solve() -> int: total_students = 500 chorus_students = total_students * 0.3 non_chorus_students = total_students - chorus_students result = non_chorus_students return result
During last year, a salesperson was able to sell 5 computers per month. If each computer cost $1,100, what was their total earnings for the entire year?
def solve() -> int: Computers_per_month = 5 price_per_computer = 1100 result = Computers_per_month * price_per_computer * 12 return result
Louis has $300 and he bought a bicycle for $150. How much money does he have left?
def solve() -> int: initial_money = 300 bike_cost = 150 money_left = initial_money - bike_cost result = money_left return result
Jenny wants to make a swimming pool full of apple juice. For every 5 gallons of water, she needs 2 gallons of apple juice mix. The swimming pool can hold 200 cubic feet of water. Each cubic foot of water is 8.5 gallons. A gallon of apple juice mix costs $1.50. How much did she spend to fill the swimming pool?
def solve() -> int: water_per_cubic_foot = 8.5 water_in_pool = 200 * water_per_cubic_foot apple_juice_per_5_gallons = 2 water_per_5_gallons = 5 total_apple_juice = (water_in_pool / water_per_5_gallons) * apple_juice_per_5_gallons cost_per_gallon = 1.5 total_cost = total_apple_juice * cost_pe...
an has 6 apples and wants to divide them into 40 equal parts. How many parts will each apple be in?
def solve() -> int: num_apples = 6 total_parts = 40 parts_per_apple = total_parts / num_apples result = parts_per_apple return result
Amy goes to a bakery. She buys 6 muffins for $2 each and 4 donuts for $1.5 each. Amy gets a free donut for every 3 muffins she buys. How much money does she pay in total?
def solve() -> int: muffin_price = 6 * 2 free_donuts = 6 // 3 paid_donuts = 4 - free_donuts donut_price = paid_donuts * 1.5 total_price = muffin_price + donut_price result = total_price return result
Jenny has to run 8 laps around the track. So far, she ran 5 laps. If each lap is 400 meters, how many meters does she still need to run to complete the track?
def solve() -> int: total_laps = 8 completed_laps = 5 remaining_laps = total_laps - completed_laps distance_per_lap = 400 remaining_distance = remaining_laps * distance_per_lap result = remaining_distance return result
A company had 100 employees in 2020, and 120 in 2021. If the average salary of employees in 2020 was $60,000 and the average salary in 2021 was $70,000, what was the percentage increase in total salary expenses in 2021 compared to 2020?
def solve() -> int: employees_in_2020 = 100 average_salary_in_2020 = 60000 employees_in_2021 = 120 average_salary_in_2021 = 70000 total_salary_in_2020 = employees_in_2020 * average_salary_in_2020 total_salary_in_2021 = employees_in_2021 * average_salary_in_2021 percentage_increase = (total_s...
Some possible questions and programs are: Carlos has a rectangular sheet of paper that is 80 cm long and 50 cm wide. He wants to cut out a square with a side length of 20 cm from each corner and fold the remaining paper into a box. What is the volume of the box in cubic centimeters?
def solve() -> int: base_length = 80 - 2 * 20 base_width = 50 - 2 * 20 box_height = 20 box_volume = base_length * base_width * box_height result = box_volume return result
Sarah and Mary are selling lemonade at a stand. They charge $0.50 per cup and their expenses are $15 for the ingredients and $5 for the cups. They sell 120 cups in total. How much profit do they make?
def solve() -> int: revenue = 120 * 0.5 cost = 15 + 5 profit = revenue - cost result = profit return result
Karena weighs 135 pounds and can bench press twice her body weight. Bernard can bench press a tenth of the amount that Karena can. If Paul can only bench press 80 pounds less than Bernard, how much can Paul bench press?
def solve() -> int: sum_Karena = 135 * 2 sum_Bernard = sum_Karena // 10 result = sum_Bernard - 80 return result
Student: Mason has 48 cupcakes that he needs to divide among 6 children. How many cupcakes will each child get?
def solve() -> int: cupcakes = 48 children = 6 cupcakes_per_child = cupcakes / children result = cupcakes_per_child return result
Charlotte bought 120 lollipops for a school event. If she wants to give each of the 30 students an equal amount, how many lollipops does each student get?
def solve() -> int: lollipops = 120 students = 30 lollipops_per_student = lollipops / students result = lollipops_per_student return result
A store sells a product for $120. They offer a 15% discount for anyone who purchases more than 50 items. Find the total cost of purchasing 70 items.
def solve() -> int: item_price = 120 discount_percent = 0.15 items = 70 total_price_without_discount = item_price * items if items > 50: total_price_with_discount = (item_price * (1 - discount_percent)) * items else: total_price_with_discount = total_price_without_disco...
Maria is a seamstress who makes dresses for a fashion boutique. Each dress takes 3 hours to make, and it takes 20% longer than that to cut and prepare the fabric. If she makes 6 dresses per week, how many hours would it take for her to make 5 weeks worth of dresses?
def solve() -> int: dress_time = 3 prep_time = dress_time * 1.2 dresses_per_week = 6 weeks = 5 total_dresses = dresses_per_week * weeks total_time = (dress_time + prep_time) * total_dresses result = total_time return result
There are 40 students in a class. If 7 students are absent, how many students are present in the class?
def solve() -> int: students_present = 40 - 7 result = students_present return result
In a jewelry store, there are 12 display cases. Each case contains 24 necklaces and each necklace has 5 pearls. A customer removes 2 pearls from each necklace. How many pearls were removed in total?
def solve() -> int: display_cases = 12 necklaces_per_case = 24 pearls_per_necklace = 5 total_necklaces = display_cases * necklaces_per_case total_pearls = total_necklaces * pearls_per_necklace pearls_removed_per_necklace = 2 pearls_removed_total = total_necklaces * pearls_removed_p...
Student: A storage box with dimensions 5 ft by 3 ft by 4 ft is filled with cubes of side length 0.5 ft. How many cubes are in the box?
def solve() -> int: length = 5 width = 3 height = 4 volume = length * width * height cube_side_length = 0.5 cube_volume = cube_side_length ** 3 num_cubes = volume // cube_volume result = num_cubes return result
Q7: Amy's room is 10 feet by 8 feet. How many square feet is her room?
def solve() -> int: width = 10 length = 8 area = width * length result = area return result
A rectangle has a length of 15 cm and a width of 10 cm. A smaller rectangle is cut out from the corner of the larger rectangle. The smaller rectangle has a length of 4 cm and a width of 3 cm. What is the area of the remaining part of the larger rectangle?
def solve() -> int: area_large = 15 * 10 area_small = 4 * 3 area_remain = area_large - area_small result = area_remain return result
An employee worked for 7 hours and earned $10 per hour. If the tax rate on his salary is 15%, how much money will the employee get?
def solve() -> int: hours_worked = 7 hourly_rate = 10 gross_salary = hours_worked * hourly_rate tax_rate = 0.15 tax = gross_salary * tax_rate net_salary = gross_salary - tax result = net_salary return result
A rectangular swimming pool measures 20 feet by 30 feet and its depth varies from 3 feet at the shallow end to 10 feet at the deep end. What is the average depth of the pool?
def solve() -> int: sum_of_depths = (3 + 10) / 2 average_depth = sum_of_depths * ((20 * 30) / (20 + 30)) result = average_depth return result
A garden is in the shape of an isosceles triangle. One side is 25 meters long, and the other two sides are 30 meters long. What is the area of the garden?
def solve() -> int: side_a = 25 side_b = 30 side_c = 30 s = (side_a + side_b + side_c) / 2 area = (s * (s - side_a) * (s - side_b) * (s - side_c)) ** 0.5 result = area return result
Maddie spends 3 hours every day volunteering. If she has a total of 28 hours left for other activities in 5 days, how many hours in total does she have for all her activities?
def solve() -> int: volunteering_hours = 3 leisure_hours = 28 working_days = 5 total_hours = (volunteering_hours + leisure_hours) * working_days result = total_hours return result
A TV is on sale for $600 with a discount of 10%. What will be the discounted price of the TV?
def solve() -> int: original_price = 600 discount_percentage = 10 discount = (original_price * discount_percentage) / 100 new_price = original_price - discount result = new_price return result
Playhouse pays a $10 commission for every toy sold. In the first week, Mia sold 15 toys. Toy sales in the second week are twice the total sales in the first week, and the total sales for the third week is half the total sales in the first week. If Mia receives a salary of $800 for the 3 weeks and a bonus of $75, how mu...
def solve() -> int: toys_week1 = 15 toys_week2 = toys_week1 * 2 toys_week3 = toys_week1 // 2 total_toys = toys_week1 + toys_week2 + toys_week3 commission = total_toys * 10 total_salary = 800 + 75 + commission result = total_salary return result
Noah has 80 candy bars and 2 times as many lollipops. If he has a total of 240 candies, how many lollipops does he have?
def solve() -> int: candy_bars = 80 lollipops = 2 * candy_bars total_candies = candy_bars + lollipops lollipops = total_candies - candy_bars result = lollipops / 2 return result
Michael is participating in a fitness challenge that pays $100 for completing a 30-day program. For every additional person he convinces to join, he gets an additional $20. Michael convinces 8 friends to join the challenge, how much money did he make in total?
def solve() -> int: days = 30 base_pay = 100 friends = 8 additional_pay = 20 total_pay = base_pay + (friends * additional_pay) result = total_pay return result
The length of a rectangle is four times its width. The width of the rectangle is 5 units. If the perimeter of the rectangle is 36 units, what is the length of the rectangle?
def solve() -> int: width = 5 length = 4 * width perimeter = 2 * (length + width) perimeter = 36 length = (perimeter - 2 * width) / 2 result = length return result
If Max sold 3 times as many cupcakes as Alex who sold 5, and Lily sold half as many cupcakes as Max, how many cupcakes did Lily sell?
def solve() -> int: alex_cupcakes = 5 max_cupcakes = 3 * alex_cupcakes lily_cupcakes = max_cupcakes / 2 result = lily_cupcakes return result
A mother wants to divide 3 1/2 cups of juice equally between four kids. How many cups of juice should each kid get in ounces?
def solve() -> int: juice_cups = 3.5 num_kids = 4 juice_ounces = juice_cups*8 ounces_per_kid = juice_ounces/num_kids result = ounces_per_kid return result
If you have 500 mL of water and you use 100 mL every day for 5 days, how much water do you have left?
def solve() -> int: initial_water = 500 water_per_day = 100 total_water_used = water_per_day * 5 result = initial_water - total_water_used return result
A train moves at a speed of 60 miles per hour. How many miles will it travel after 4 hours?
def solve() -> int: speed = 60 time = 4 distance = speed * time result = distance return result
Alex started working out five years ago and has since gained 100 pounds. Today, his weight is four times that of what it was when he started. How much did he weigh when he began working out?
def solve() -> int: x = 25 result = x return result
At a store, one-third of all clothes are on sale. If there are 800 clothes in total and the number of dresses on sale is half the number of shirts on sale, how many dresses are on sale?
def solve() -> int: total_clothes = 800 shirts_on_sale = total_clothes / 3 dresses_on_sale = shirts_on_sale / 2 result = dresses_on_sale return result
John has 500 marbles, if he gave away 20% of his marbles to his friends and lost 10 marbles while playing, how many marbles does he have left?
def solve() -> int: marbles = 500 gave_away = 0.2 * marbles lost = 10 left = marbles - gave_away - lost result = left return result
A rectangle has a length of 10 inches and a width of 4 inches. What is the perimeter of the rectangle in inches?
def solve() -> int: length = 10 width = 4 perimeter = 2 * length + 2 * width result = perimeter return result
The total number of pencils in six boxes, with 50 pencils each, is the same as the length in meters of a rope. Calculate the total length of the rope if Sue pulls it to lift a weight and lowers it.
def solve() -> int: num_boxes = 6 pencils_per_box = 50 total_pencils = num_boxes * pencils_per_box pencil_length = 0.15 rope_length = total_pencils * pencil_length result = rope_length return result
Alex wants to put a new roof on his house. His house measures 50 feet by 30 feet. The roofing material he wants to use costs $3 per square foot. How much will he spend on the roofing material?
def solve() -> int: length = 50 width = 30 square_feet = length * width price = 3 total_cost = square_feet * price result = total_cost return result
A store has 240 items for sale. 30% of them are electronics. Of the rest, 40% are clothing. How many items are neither electronics nor clothing?
def solve() -> int: total_items = 240 electronics = total_items * 0.3 clothing = (total_items - electronics) * 0.4 neither = total_items - electronics - clothing result = neither return result
Lisa has a 24 pack of cupcakes. If she wants to distribute the cupcakes equally between her 2 children, how many cupcakes will each of them get?
def solve() -> int: cupcakes = 24 children = 2 cupcakes_per_child = cupcakes / children result = cupcakes_per_child return result
Isla has a coupon that gives her 10% off on any item at the bookstore. She buys a book that costs 15 dollars, and a notebook that costs 5 dollars. How much does she pay after using the coupon?
def solve() -> int: total_before_coupon = 15 + 5 cost_after_coupon = total_before_coupon * 0.9 result = cost_after_coupon return result
Student: Jenny and her friends went on a weekend trip. They split the cost of the hotel evenly but Jenny paid for gas and snacks. The hotel bill was $200 and Jenny spent $60 on gas and $40 on snacks. How much did Jenny spend in total?
def solve() -> int: hotel_bill = 200 gas_cost = 60 snacks_cost = 40 total_cost = hotel_bill + gas_cost + snacks_cost result = total_cost return result
Jenny biked 20 miles in 2 hours. She biked half the distance at 10 miles per hour and the second half at 15 miles per hour. How long did it take her for each half?
def solve() -> int: distance = 20 speed1 = 10 speed2 = 15 time1 = distance / 2 / speed1 time2 = distance / 2 / speed2 result = (time1, time2) return result
Leah is a baker who makes cupcakes and muffins. She uses 3 eggs for every 12 cupcakes and 2 eggs for every 8 muffins. She has 24 eggs in her fridge. How many cupcakes and muffins can she make in total?
def solve() -> int: eggs_per_cupcake = 3 / 12 eggs_per_muffin = 2 / 8 eggs_in_fridge = 24 cupcakes = eggs_in_fridge // eggs_per_cupcake muffins = eggs_in_fridge // eggs_per_muffin total = cupcakes + muffins result = f'Leah can make {cupcakes} cupcakes and {muffins} muffins in ...
Student: If there are 56 skittles in a bag, and 14 of them are blue skittles, how many skittles are NOT blue?
def solve() -> int: total_skittles = 56 blue_skittles = 14 not_blue_skittles = total_skittles - blue_skittles result = not_blue_skittles return result
In a zoo, there are 150 animals. One-tenth of them are lions, one-eighth are tigers, and the rest are bears. If 5 lions and 6 tigers are transferred to another zoo, how many fewer bears are there than lions and tigers together?
def solve() -> int: total = 150 lions = total / 10 tigers = total / 8 bears = total - lions - tigers lions_transferred = 5 tigers_transferred = 6 lions_left = lions - lions_transferred tigers_left = tigers - tigers_transferred bears_left = bears total_left = lions_left + tigers_l...
John bought 5 shirts for $50 each and 5 pairs of pants for $30 each. He paid with a $100 bill and received $15 back. How much did he spend?
def solve() -> int: price_tshirt = 50 * 5 price_pants = 30 * 5 result = price_tshirt + price_pants - 15 return result
A recipe calls for 1/2 cups of butter for 6 servings. How much butter would be needed for 15 servings?
def solve() -> int: butter_per_serving = 1/2 serving_quantity = 15 total_butter = butter_per_serving * serving_quantity result = total_butter return result
Student: If the perimeter of a square is 20 inches, what is the length of one side?
def solve() -> int: perimeter = 20 side_length = perimeter / 4 result = side_length return result
Student: An artist earns $12,000 every month from their shows plus half of that amount in merchandise sales. How much money do they earn in total every year?
def solve() -> int: monthly_show_income = 12000 merchandise_ratio = 0.5 months_in_a_year = 12 monthly_merchandise_income = monthly_show_income * merchandise_ratio total_monthly_income = monthly_show_income + monthly_merchandise_income total_yearly_income = total_monthly_income * months_in_a...
Mark gave his friends a pizza party and bought 8 large pizzas. 25% of the time, his friends did not eat a slice. How many slices were uneaten?
def solve() -> int: num_pizzas = 8 total_slices = num_pizzas * 8 uneaten_percent = 25 uneaten_slices = (uneaten_percent / 100) * total_slices result = uneaten_slices return result
James needs 25 more books to have twice as many books as Jane, and John has 4 times as many books as Jane. If John has 80 books, how many more books does John have than James?
def solve() -> int: jane_books = 80 / 4 james_books = jane_books * 2 - 25 john_books = 80 more_books = john_books - james_books result = more_books return result
Student: Anne has 35 candy bars in her basket. Each candy bar costs $1.25. How much will she pay altogether?
def solve() -> int: num_candy_bars = 35 cost_per_candy_bar = 1.25 total_cost = num_candy_bars * cost_per_candy_bar result = total_cost return result
Possible questions and programs: Mina is making a quilt with squares of different colors. She needs 25 blue squares, 16 red squares, 9 yellow squares, and 4 green squares. Each square is 20 cm by 20 cm. If blue fabric costs $12/m, red fabric costs $8/m, yellow fabric costs $10/m, and green fabric costs $14/m, how much ...
def solve() -> int: blue_squares = 25 red_squares = 16 yellow_squares = 9 green_squares = 4 square_size = 20 blue_area = blue_squares * square_size ** 2 / 10000 red_area = red_squares * square_size ** 2 / 10000 yellow_area = yellow_squares * square_size ** 2 / 10000 green_area...
A store has a sale for "buy $50 worth of items, get a $10 discount". If a customer buys $80 worth of items, how much do they have to pay after the discount?
def solve() -> int: total_price = 80 discount_amount = 10 price_after_discount = total_price - discount_amount result = price_after_discount return result
A student has to read a book with 300 pages in 10 days. If the student reads the same number of pages every day, how many pages does the student need to read each day?
def solve() -> int: total_pages = 300 total_days = 10 pages_per_day = total_pages / total_days result = pages_per_day return result
Harold has $30 left and he wants to save four times as much money as he can in the next 3 weeks. How much money will he have saved after the 3 weeks?
def solve() -> int: savings = 30 for i in range(3): savings += 4 * savings result = savings return result
John needs to go on a long drive that is 400 miles long. His car has a 20-gallon gas tank and gets 18 miles to the gallon. How many more miles can he drive after he reaches his destination without needing to refuel?
def solve() -> int: miles_to_drive = 400 gas_tank_capacity = 20 miles_per_gallon = 18 total_gas_needed = miles_to_drive / miles_per_gallon remaining_gas = gas_tank_capacity - total_gas_needed remaining_miles = remaining_gas * miles_per_gallon result = remaining_miles return res...
X = number of the question Here are some possible questions and programs: A toy store has a sale on Lego sets. One set costs $24.00 and has 500 pieces. Another set costs $36.00 and has 750 pieces. How much cheaper, per piece, in cents, is the first set than the second set?
def solve() -> int: cost_per_piece_1 = 24.00 / 500 cost_per_piece_2 = 36.00 / 750 difference = cost_per_piece_2 - cost_per_piece_1 difference_in_cents = difference * 100 result = difference_in_cents return result
A road is 4000 meters long. If a person walks at a speed of 100 meters per minute, how many minutes will it take them to walk the entire length of the road?
def solve() -> int: road_length = 4000 speed = 100 time_in_minutes = road_length / speed result = time_in_minutes return result
Throughout the summer, Sophie made $500 by working 12 hours as a cashier. However, in the winter, Sophie was only able to work for 2 hours. If Sophie wants to buy a new tablet that costs $300 and she has already spent $80 on lunch, how many more hours does she need to work before she can buy the tablet?
def solve() -> int: summer_hours = 12 summer_earnings = 500 hourly_rate = summer_earnings / summer_hours winter_hours = 2 winter_earnings = hourly_rate * winter_hours total_cost = 300 + 80 remaining_cost = total_cost - winter_earnings hours_needed = remaining_cost / hourly...
4. Rachel decided to count all the shirts her family owned. All of the adult shirts had 3 buttons while all the child shirts had 2 buttons. If Rachel counted 18 adult shirts and 14 child shirts, how many total buttons did she count?
def solve() -> int: from sympy import Symbol x = Symbol('x') result = 3*18+2*14 return result
Emma is making bracelets. She has 18 beads of each color: red, green, and blue. She uses 6 beads to make one bracelet and she wants to make as many bracelets as possible with different color combinations. She does not use the same color twice in one bracelet. How many bracelets can she make and how many beads does she ...
def solve() -> int: red = 18 green = 18 blue = 18 beads_per_bracelet = 6 combinations = 3 * 2 bracelets = min(red, green, blue) // 2 red_left = red - bracelets * 2 green_left = green - bracelets * 2 blue_left = blue - bracelets * 2 result = f'Emma can make {brace...
Sophia wants to start a retirement fund. She saved $100 in January, $150 in February, and $200 in March. If she continues to save in this pattern, how much will she have saved after 8 months?
def solve() -> int: january_savings = 100 february_savings = 150 march_savings = 200 total_savings = january_savings + february_savings + march_savings savings_per_month = total_savings / 3 months = 8 total_savings = savings_per_month * months result = total_savings ...
Lucy is currently 37 years old and her husband Mark is 52. Their daughter, Chloe, was born when Mark was 30. How old was Lucy when Chloe was born?
def solve() -> int: lucy_age = 37 mark_age = 52 mark_age_when_chloe_born = 30 chloe_age = mark_age - mark_age_when_chloe_born lucy_age_when_chloe_born = lucy_age - chloe_age result = lucy_age_when_chloe_born return result
A pizza restaurant needs 4/5 a cup of cheese to make one pizza. If they have 5 cups of cheese, how many pizzas can they make?
def solve() -> int: cheese_per_pizza = 4/5 total_cheese = 5 num_pizzas = total_cheese / cheese_per_pizza result = int(num_pizzas) return result
A store receives a shipment of 500 shirts. The shipment has a 10% defective rate. How many shirts in the shipment are defective?
def solve() -> int: num_shirts = 500 defective_rate = 0.1 num_defective_shirts = num_shirts * defective_rate result = f'There are {num_defective_shirts} defective shirts in the shipment' result = num_defective_shirts return result
Amir sold 40 cupcakes for $3 each, 25 cookies for $2 each and 15 brownies for $4 each. He spent $120 on the ingredients and $30 on the packaging. How much profit did he make?
def solve() -> int: cupcakes_revenue = 40 * 3 cookies_revenue = 25 * 2 brownies_revenue = 15 * 4 total_revenue = cupcakes_revenue + cookies_revenue + brownies_revenue total_cost = 120 + 30 profit = total_revenue - total_cost result = profit return result
A barista pours three cups of hot cocoa out of a pot that holds 4 and a half cups. How many cups of hot cocoa are left in the pot?
def solve() -> int: pot = 4.5 cups_poured = 3 left_in_pot = pot - cups_poured result = left_in_pot return result
Student: A farmer sells 10 kilograms of apples and 5 kilograms of oranges. How many kilograms of fruits did he sell in total?
def solve() -> int: apples = 10 oranges = 5 total_kg = apples + oranges result = total_kg return result
Possible questions and programs: Lena makes bracelets and necklaces with beads. She needs 20 beads for a bracelet and 40 beads for a necklace. She can sell a bracelet for $5 and a necklace for $8. She has 1000 beads in total. How much money can she make if she uses all her beads?
def solve() -> int: beads = 1000 beads_per_bracelet = 20 beads_per_necklace = 40 price_per_bracelet = 5 price_per_necklace = 8 bracelets = beads // beads_per_bracelet remaining_beads = beads % beads_per_bracelet necklaces = remaining_beads // beads_per_necklace mone...
A marathon is 42 kilometers long. A runner has run 18 kilometers. The remaining portion of the marathon is 2/3 the length of Paul's marathon. Paul's marathon is 63 kilometers long. How much shorter is the runner's marathon than Paul's marathon?
def solve() -> int: marathon_length = 42 runner_distance = 18 paul_marathon = 63 remaining_distance = (2/3) * paul_marathon runner_marathon = runner_distance + remaining_distance difference = paul_marathon - runner_marathon result = difference return result
If a store offers a 20% discount on a shirt that originally costs $35, what is the price with the discount?
def solve() -> int: discount = 0.20*35 price_with_discount = 35 - discount result = price_with_discount return result
A movie theater sells tickets for $8.50 for adults and $6 for children. On Tuesdays, there is a 20% discount on all tickets. Brian and his family of four went to see a movie on a Tuesday. Two of his family members are adults and two are children. How much did Brian pay for the tickets?
def solve() -> int: adult_ticket = 8.5 child_ticket = 6 discount = 0.2 adult_ticket_discounted = adult_ticket * (1 - discount) child_ticket_discounted = child_ticket * (1 - discount) adults = 2 children = 2 total_price = adults * adult_ticket_discounted + children * chil...
A printer consumes 0.01 ink cartridges to print 100 pages. If the printer prints 500 pages a day for 2 days, how many ink cartridges would it consume?
def solve() -> int: pages_per_day = 500 num_days = 2 ink_per_page = 0.01 total_pages = pages_per_day * num_days total_ink = total_pages * ink_per_page result = total_ink return result
A recipe calls for 2/3 cup of sugar to make 24 cookies. How much sugar is needed to make 36 cookies?
def solve() -> int: sugar_cup_per_cookie = 2/3 / 24 cookies_needed = 36 sugar_needed = sugar_cup_per_cookie * cookies_needed result = sugar_needed return result
A company had a revenue of $10000 and their expenses were $4000. What is the profit margin of the company as a percentage?
def solve() -> int: revenue = 10000 expenses = 4000 profit = revenue - expenses profit_margin = (profit / revenue) * 100 result = profit_margin return result