question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
John invests $5000 in a bank account that pays 5% annual interest. If he adds $1000 every year to the account, write a Python program to calculate how much he will have in 10 years.
def solve() -> int: initial_balance = 5000 annual_investment = 1000 interest_rate = 0.05 years = 10 final_balance = initial_balance * (1+interest_rate)**years for year in range(1,years+1): final_balance += annual_investment*(1+interest_rate)**year result = final_balanc...
Possible Devin owns a catering company that provides lunch for 15 offices every weekday. He charges $12 per person for a standard meal and $15 per person for a premium meal. He has 10 employees who help him prepare and deliver the food. Each employee earns $18/hour and works 6 hours a day. Devin also has to pay 8% sale...
def solve() -> int: standard_price = 12 premium_price = 15 employee_wage = 18 employee_hours = 6 sales_tax_rate = 0.08 payroll_tax_rate = 0.12 offices = 15 working_days = 20 standard_meals = (3 / 5) * offices * working_days premium_meals = (2 / 5) * offices * w...
Maria has 270 marbles and she gains 20% of others. After that, she loses 25% of the total she now has. How many marbles does she have left?
def solve() -> int: gained_marbles = 270 * 0.2 total_marbles = 270 + gained_marbles lost_marbles = total_marbles * 0.25 left_marbles = total_marbles - lost_marbles result = left_marbles return result
Student: A farmer has 96 chickens and 24 cows on his farm. He sells eggs and milk at the market. Each chicken lays 4 eggs a week, and each egg sells for 25 cents. Each cow produces 20 liters of milk a week, and each liter of milk sells for 1.5 dollars. How much money does the farmer make from selling eggs and milk in a...
def solve() -> int: chickens = 96 cows = 24 eggs_per_chicken = 4 egg_price = 0.25 milk_per_cow = 20 milk_price = 1.5 eggs = chickens * eggs_per_chicken milk = cows * milk_per_cow revenue_from_eggs = eggs * egg_price revenue_from_milk = milk * milk_price revenue = revenue_from...
The toy store had 300 stuffed animals in stock for Christmas. They sold 25 stuffed toys in January, 15 in February, and 35 in March. In April and May, they sold off all the remaining stuffed animals, each month selling half of what remained. What is the difference in the number of stuffed animals sold in March and Janu...
def solve() -> int: stock = 300 sold_january = 25 sold_february = 15 sold_march = 35 remaining_april = stock - sold_january - sold_february - sold_march sold_april = remaining_april / 2 remaining_may = remaining_april - sold_april sold_may = remaining_may / 2 differenc...
Lisa went to a jewelry store with $200 and bought 2 necklaces. Then her sister asked her to buy 5 more than double the number of necklaces she already bought. Each necklace costs $50. Finally, she also bought a pair of earrings and 1 pair of earrings costs $25. How much money does Lisa have remaining?
def solve() -> int: budget = 200 num_necklaces = 2 num_sister_necklaces = 5 + 2*num_necklaces necklace_cost = (num_necklaces + num_sister_necklaces) * 50 earring_cost = 25 total_cost = necklace_cost + earring_cost remaining_budget = budget - total_cost ...
At the Banana Leaf South Indian Cuisine, Lily bought one plate of masala dosa at $8 and four idlis, at $1.50 each, and a mango lassi, for $3. She left a 20% tip. How much did the meal cost Lily, with tax, in dollars? Sarah has 36 pens. A quarter of them are blue. Of those blue pens, half have black ink and the rest hav...
def solve() -> int: dosa_price = 8 idli_price = 1.5 idli_quantity = 4 lassi_price = 3 total_food_cost = dosa_price + (idli_price * idli_quantity) + lassi_price tip_percentage = 20 tip_amount = total_food_cost * (tip_percentage/100) total_cost = total_food_cost + tip_amount ...
Alice filled up her car with 12 gallons of gas for $36. If the gas station charges the same price per gallon, how much will it cost her to fill up her tank with 15 gallons of gas?
def solve() -> int: gallons_first_fill = 12 cost_first_fill = 36 price_per_gallon = cost_first_fill/gallons_first_fill gallons_second_fill = 15 cost_second_fill = price_per_gallon * gallons_second_fill result = cost_second_fill return result
ally collected 20 apples from the orchard, but ate 4 of them on the way back. How many apples are left?
def solve() -> int: total = 0 for i in range (20): total += 1 for i in range(4): total -= 1 result = total return result
Joe has 200 books in his library, whereas Jane has 50 books in hers. If Jane buys 5 books a month, how long until she has the same amount of books as Joe?
def solve() -> int: joe_books = 200 jane_books = 50 books_bought_per_month = 5 difference = joe_books - jane_books months_needed = difference / books_bought_per_month result = months_needed return result
Klaus tripled a number. He then added 4 to it. If the final result was 12, what was the original number?
def solve() -> int: final = 12 added = 4 original = (final - added) / 3 result = original return result
Leo reads 15 pages of a book every day, except on Wednesdays and Fridays, when he reads 20 pages. How many pages does he read in three weeks?
def solve() -> int: regular_pages = 15 special_pages = 20 regular_days = 5 special_days = 2 weeks = 3 total_pages = (regular_pages * regular_days + special_pages * special_days) * weeks result = total_pages return result
6. Heather can walk 8 km while Mary can walk 10 km in the same amount of time. If Heather walks for 1 hour, how long will it take for Mary to cover the same distance?
def solve() -> int: def MaryWalkTime(heatherWalkTime): maryWalkTime = heatherWalkTime * (10/8) return maryWalkTime heatherWalkTime = 1 maryWalkTime = MaryWalkTime(heatherWalkTime) result = maryWalkTime return result
Andrea has a collection of 100 seashells. If 3/5 of the seashells are from the Pacific Ocean and 1/4 of the Pacific Ocean seashells are from California, how many seashells does she have from California?
def solve() -> int: num_seashells = 100 pacific_seashells = num_seashells * 3 / 5 california_pacific_seashells = pacific_seashells * 1 / 4 result = california_pacific_seashells return result
Student: A rectangle has an area of 120 cm² and a length of 15 cm. What is the perimeter of the rectangle?
def solve() -> int: area = 120 length = 15 width = area / length perimeter = 2 * (length + width) result = perimeter return result
Nate works as a tour guide and gets paid $40 per hour. He also earns $10 for every person on the tour. Today, he gave two tours with seven people on each tour. Each tour lasted for two hours. He also spent $15 on a souvenir for a tourist. If he got a $20 bonus forAlexandra has a car that can travel a distance of 300 mi...
def solve() -> int: hourly_rate = 40 per_person_rate = 10 num_tours = 2 num_people = 7 tour_duration = 2 souvenir_cost = 15 bonus = 20 tour_earnings = num_tours * num_people * per_person_rate + num_tours * tour_duration * hourly_rate total_earnings = tour_earnings + bonus -...
There are 36 students in a classroom and their teacher asked them to group into 5 groups. How many students are in each group?
def solve() -> int: num_students = 36 num_groups = 5 students_per_group = num_students//num_groups result = students_per_group return result
A recipe calls for 3/4 cups of sugar for 2 cups of flour. If you have 10 cups of flour, how much sugar will you need?
def solve() -> int: flour = 10 sugar_per_flour = 3/4 sugar = (sugar_per_flour / 2) * flour result = sugar return result
Student: Ali rented some bikes for a day trip. He paid 15$ for each bike and rented 8 bikes. He charged each person 20$ to join the trip. How much did Ali profit if 7 people joined the trip?
def solve() -> int: bike_cost = 15 bike_number = 8 person_fee = 20 person_number = 7 total_cost = bike_cost * bike_number total_income = person_fee * person_number profit = total_income - total_cost result = profit return result
If the selling price of a product is $20 and its profit margin is 25%, what is the cost of the product?
def solve() -> int: selling_price = 20 profit_margin = 0.25 cost_price = selling_price / (1 + profit_margin) result = cost_price return result
In a box of pencils, there are 60 pencils consisting of red, blue, and green pencils. If there are 16 red pencils and an equal number of blue and green pencils, how many pencils are left in the box after Jack removes a number of pencils equal to the difference between the number of green pencils and blue pencils?
def solve() -> int: total_pencils = 60 red_pencils = 16 blue_pencils = green_pencils = (total_pencils - red_pencils) / 2 difference = green_pencils - blue_pencils remaining_pencils = total_pencils - difference result = remaining_pencils return result
Sarah went to the bakery with her cousin Michael and they bought some donuts. Michael bought 13 donuts and Sarah bought 8 donuts. Sarah's sister, who had more money, bought four times the amount of donuts they bought combined. If each donut costs $2 and they gave a $20 bill to the cashier, how much change will they get...
def solve() -> int: michael_donuts = 13 sarah_donuts = 8 total_donuts = michael_donuts + sarah_donuts sister_donuts = 4 * total_donuts donut_cost = 2 total_cost = total_donuts * donut_cost sister_cost = sister_donuts * donut_cost total_money = 20 change = total_money -...
Mark is buying toy cars for his younger brother. For every 5 cars he buys, he ends up keeping 1 for himself. If he wants to buy 30 cars, how many will he need to actually purchase?
def solve() -> int: cars_bought = 30 cars_kept = cars_bought // 5 cars_purchased = cars_bought + cars_kept result = cars_purchased return result
If there are 7 more cupcakes in the box than there are in the bag, and there are 3 cupcakes in the bag, how many cupcakes are in the box? Samantha wants to build a long necklace. She has a 12-inch chain, a 30-inch chain, two 5-inch chains, and a 9-inch chain. Each clasp she adds shortens the length by 0.8 inches. How l...
def solve() -> int: cupcakes_in_bag = 3 cupcakes_in_box = cupcakes_in_bag + 7 total_cupcakes = cupcakes_in_bag + cupcakes_in_box chain_lengths = [12, 30, 5, 5, 9] for clasp in range(5): total_length = sum(chain_lengths) - (0.8 * clasp) result = total_length return result
Lucy has 24 chocolates in her box. She eats 6 chocolates and gives 4 chocolates to her friend Eve. Then she wins 18 chocolates in a game and buys 12 more chocolates at the shop. How many chocolates does Lucy have in her box now?
def solve() -> int: chocolates = 24 chocolates = chocolates - 6 - 4 chocolates = chocolates + 18 + 12 result = chocolates return result
In a 600 meters race, Mark runs at a constant speed but moves 30% faster than his competitor. If his competitor finishes the race in 9 minutes, how long does it take Mark to complete the race?
def solve() -> int: total_time = 9 total_time /= 1.3 result = total_time return result
A restaurant prepares 90% of the food it offers in a day. If it prepared 135 meals, how many meals does the restaurant offer in a day?
def solve() -> int: preparation_ratio = 0.9 prepared_meals = 135 offered_meals = prepared_meals / preparation_ratio result = offered_meals return result
John and Lauren planted strawberries. In the morning, John planted 52 strawberry seeds while Lauren planted 7 times as many strawberry seeds as John. In the afternoon, John planted 40 strawberry seeds while Lauren planted 5 fewer strawberry seeds than John. How many strawberry seeds did they plant altogether?
def solve() -> int: j_morning = 52 l_morning = 7 * j_morning j_afternoon = 40 l_afternoon = j_afternoon - 5 total = j_morning + l_morning + j_afternoon + l_afternoon result = total return result
The difference between two numbers is 19. If the larger of the two numbers is 37, what is the smaller number?
def solve() -> int: larger_number = 37 difference = 19 smaller_number = larger_number - difference result = smaller_number return result
A car dealership sold 15 Sedans and 10 SUVs. They plan to increase their sales by 50%. How many Sedans and SUVs do they need to sell to attain their sales target?
def solve() -> int: s_sedans = 15 s_suvs = 10 target_sales = 1.5 * (s_sedans + s_suvs) vehicles_needed = target_sales - (s_sedans + s_suvs) result = vehicles_needed return result
If 7 workers can finish a project in 10 days, how many workers are needed to finish the same project in 5 days?
def solve() -> int: workers = 7 days = 10 project = 1 work_per_day = project / (workers * days) new_days = 5 new_project = work_per_day * (new_days * workers) new_workers = new_project / (work_per_day * new_days) result = new_workers return result
In a store, on Monday they had 20 packing boxes. On Tuesday, they sold 30% of the boxes they had on Monday. On Wednesday, the store added 5 packing boxes to what they had on Tuesday. On Thursday, they sold twice the amount of boxes from Wednesday. How many boxes did they have on Thursday?
def solve() -> int: boxes_monday = 20 boxes_tuesday = (1 - 0.3)*boxes_monday boxes_wednesday = boxes_tuesday + 5 boxes_thursday = (2)*boxes_wednesday result = boxes_thursday return result
ara had 16 apples and 24 oranges. She wanted to make fruit salad with an equal number of apples and oranges. She peeled and sliced each apple into eight pieces and each orange into six pieces. How many pieces of fruit did she use for the fruit salad?
def solve() -> int: apples = 16 oranges = 24 apple_pieces = 8 orange_pieces = 6 fruit_min = min(apples, oranges) fruit_pieces = fruit_min * (apple_pieces + orange_pieces) result = fruit_pieces return result
A store is having a sale where all items are 25% off. If a shirt originally costs $24.99, how much will it cost during the sale?
def solve() -> int: original_price = 24.99 sale_price = original_price * 0.75 result = sale_price return result
If Olivia has 12 more cupcakes than Ethan, and Ethan has three times as many cupcakes as Ava, how many more cupcakes does Olivia have than Ava if Ethan has 15 cupcakes?
def solve() -> int: ethan_cupcakes = 15 ava_cupcakes = ethan_cupcakes / 3 olivia_cupcakes = ethan_cupcakes + 12 difference = olivia_cupcakes - ava_cupcakes result = difference return result
Student: Ben has just collected 20 eggs from his backyard chickens. His sister has collected three times as many eggs as him, and his brother has collected a quarter of his sister's eggs. If they each give 2 eggs to their neighbor, how many eggs, in total, do they have left?
def solve() -> int: ben_eggs = 20 sister_eggs = 3 * ben_eggs brother_eggs = sister_eggs / 4 eggs_given = 2 total_eggs_left = ben_eggs + sister_eggs + brother_eggs - (3 * eggs_given) result = total_eggs_left return result
David receives $200 as salary every week from his job. If he works an additional 10 hours, he gets an extra $20/hour. How much will he earn if he works for 45 hours in a week, including the additional 10 hours?
def solve() -> int: base_salary = 200 hourly_rate = 20 reg_hours = 35 ot_hours = 10 reg_pay = base_salary ot_pay = hourly_rate * ot_hours total_pay = reg_pay + ot_pay result = total_pay return result
Rebecca went shopping at the grocery store and noticed that they had exactly 248 lemons. She put 12 lemons in each bag and only needed 55 bags. How many lemons were left over?
def solve() -> int: total_lemons = 248 num_bags = 55 per_bag = 12 total_used = num_bags * per_bag left_over = total_lemons - total_used result = left_over return result
There are 36 students in a classroom. The number of girls is 10 more than the number of boys. How many girls are in the classroom?
def solve() -> int: total_students = 36 boys = (total_students - 10) / 2 girls = total_students - boys result = girls return result
Jacob has 90 cents, Claire has two thirds of a dollar, Emma has a nickel and eight pennies, and Ryan has six quarters. How many cents do they have combined?
def solve() -> int: jacob_cents = 90 claire_cents = 2/3 * 100 emma_cents = 5 + 8 * 1 ryan_cents = 6 * 25 total_cents = jacob_cents + claire_cents + emma_cents + ryan_cents result = total_cents return result
A store sold 600 items in February. In March, they sold 1400 items. By what percent has the number of items sold increased?
def solve() -> int: percentage_increase = (1400 - 600) /600 result = percentage_increase * 100 return result
Student: The diameter of a circle is 12cm. What is the circumference of the circle?
def solve() -> int: diameter = 12 radius = diameter / 2 circumference = 2 * 3.14 * radius result = circumference return result
Exactly three-fourths of the members in a club are under the age of 40. If 20% of the members are over the age of 60, and there are 500 members in the club, how many members are between the ages of 40 and 60?
def solve() -> int: total_members = 500 under_40 = total_members * 3/4 over_60 = total_members * 0.2 between_40_60 = total_members - under_40 - over_60 result = between_40_60 return result
Possible questions and programs: Kelly collected 12 seashells in 15 minutes on the beach. How many seashells, in total, would she collect if she stayed on the beach for 2 hours and 45 minutes?
def solve() -> int: seashells = 12 minutes = 15 hours = 2 minutes2 = 45 rate = seashells / minutes total_minutes = hours * 60 + minutes2 total_seashells = rate * total_minutes result = total_seashells return result
John earns $30 per hour and works 8 hours a day for 5 days a week. How much does he earn in a week before taxes?
def solve() -> int: hourly_rate = 30 hours_per_day = 8 work_days = 5 weekly_earnings = hourly_rate * hours_per_day * work_days result = weekly_earnings return result
Student: Marie had 20 pencils and she wanted to give half of them away to her friend. How many pencils would be left with Marie?
def solve() -> int: pencils = 20 half_pencils = pencils / 2 result = pencils - half_pencils return result
During a summer sale, Jill buys 30 items and gets 30% off her total purchase. If the total purchase before discount is $850, how much has Jill saved?
def solve() -> int: total_price_before_discount = 850 discount = 0.3 total_saved = total_price_before_discount*discount result = total_saved return result
A library has 15 rows of books with 25 books on each row. If they add 300 new books, how many more rows of books can they create with 25 books on each row?
def solve() -> int: num_rows = 15 books_per_row = 25 total_books = num_rows * books_per_row new_books = 300 total_books += new_books new_rows = total_books // books_per_row - num_rows result = new_rows return result
A bag of marbles has 40 marbles in it, 10 of which are red. What percent of the bag is red marbles?
def solve() -> int: total_marbles = 40 num_red_marbles = 10 percent_red_marbles = (num_red_marbles / total_marbles) * 100 result = percent_red_marbles return result
Maria jogged for 15 minutes at a speed of 6 km/h, then she cycled for 30 minutes at a speed of 15 km/h, and then she walked for 20 minutes at a speed of 5 km/h. How far did Maria travel in total?
def solve() -> int: time_jogging = 15/60 speed_jogging = 6 time_cycling = 30/60 speed_cycling = 15 time_walking = 20/60 speed_walking = 5 distance_jogging = time_jogging * speed_jogging distance_cycling = time_cycling * speed_cycling distance_walking = time_walking * speed_walking ...
A car travelling at 60 km/h covers a distance of 360 km. How long (in hours) will it take for a car travelling at 80 km/h to cover the same distance?
def solve() -> int: time_at_60kph = 360/60 time_at_80kph = 360/80 time_difference = time_at_60kph - time_at_80kph result = time_difference return result
A store is selling a toy for $25, marked down from $30. What percentage discount is the store offering?
def solve() -> int: original_price = 30 new_price = 25 price_difference = original_price - new_price percent_discount = (price_difference / original_price) * 100 result = percent_discount return result
Student: At Meg & Cher's Grocery, a certain type of candy costs $1.75 per pound. If Rachel bought a 2 and 1/2 pounds of candy, how much money did she spend?
def solve() -> int: cost_per_pound = 1.75 weight = 2.5 total_cost = cost_per_pound * weight result = total_cost return result
Possible questions and programs: Maria wants to bike across the country. She plans to increase her distance by 5% each day until she reaches 100 miles. How many days will it take her to bike 100 miles if she starts with 10 miles on the first day?
def solve() -> int: distance = 10 days = 1 while distance < 100: distance = distance * 1.05 days = days + 1 result = days return result
A car travels 75 miles with 3.5 gallons of gas. How many gallons of gas will it need to travel 250 miles?
def solve() -> int: miles_per_gallon = 75 / 3.5 miles_to_travel = 250 gallons_required = miles_to_travel / miles_per_gallon result = gallons_required return result
A video store offers 3 types of memberships. The first membership costs $15 per month and includes 1 free rental per month. The second membership costs $25 per month and includes 2 free rentals per month. The third membership costs $40 per month and includes 5 free rentals per month. If a customer chooses the second me...
def solve() -> int: membership_cost = 25 free_rentals = 2 overdue_fines = 3 total_cost = membership_cost + overdue_fines*(7-free_rentals) result = total_cost return result
The sum of five consecutive even numbers is 240. Find the smallest even number.
def solve() -> int: sum_numbers = 240 middle_number = sum_numbers/5 smallest_number = middle_number - 4 result = smallest_number return result
There are 8 red balls and 4 green balls in Sarah's bag. What is the probability that she picks a red ball?
def solve() -> int: total_balls = 12 red_balls = 8 probability_red = red_balls / total_balls result = f'The probability of Sarah picking a red ball is {probability_red}.' result = probability_red return result
Rohan went to a gift shop and bought some items for his friends. He spent $60 in total and bought 10 items in total. If each item costs the same amount, how much did each item cost?
def solve() -> int: total_spent = 60 total_items = 10 cost_per_item = total_spent / total_items result = cost_per_item return result
Student: Noah has 100 Egyptian pounds and 20 Saudi riyals. If each pound is worth 0.064 US dollars and each riyal is worth 0.27 US dollars, how much money does he have total in US dollars?
def solve() -> int: egyptian_pounds = 100 saudi_riyals = 20 pound_to_usd = 0.064 riyal_to_usd = 0.27 total_usd = (egyptian_pounds * pound_to_usd) + (saudi_riyals * riyal_to_usd) result = total_usd return result
Jill has saved up $20. She wants to buy a fish tank for $25 but she has to pay an extra $5 extra in tax. How much money will Jill need in total to buy the fish tank?
def solve() -> int: saved_money = 20 price_tank = 25 tax = 5 total_money = saved_money + price_tank + tax result = total_money return result
A construction worker can lay 30 bricks in an hour. How many bricks can 5 workers lay in 4 hours?
def solve() -> int: bricks_per_hour = 30 workers = 5 hours = 4 bricks = bricks_per_hour * workers * hours result = bricks return result
A pizza restaurant has 30 tables. If each table seats 4 people, how many customers can the restaurant accommodate at once?
def solve() -> int: total_customers = 30 * 4 result = total_customers return result
Every year, Paul grows 800 carrots. 60 percent of the carrots are small and 1/5 of the remaining carrots are too green. How many carrots are too green?
def solve() -> int: number_small_carrots = 800 * 0.6 number_green_carrots = (number_small_carrots * 0.2) * (800/(800-number_small_carrots)) result = number_green_carrots return result
There are 25 cupcakes to be shared between 5 children. If each child receives the same number of cupcakes, how many cupcakes will each child get?
def solve() -> int: num_cupcakes = 25 num_children = 5 num_cupcakes_per_child = num_cupcakes // num_children result = num_cupcakes_per_child return result
Alex bought 12 boxes of markers, each box containing 24 markers. If 20 markers were lost, how many markers does he have left?
def solve() -> int: boxes = 12 markers_per_box = 24 markers_lost = 20 total_markers = boxes * markers_per_box remaining_markers = total_markers - markers_lost result = remaining_markers return result
A box contains 25 identical balls, each weighing 500 grams. If the weight of the box is 3 kilograms and 250 grams, what is the weight of the box alone?
def solve() -> int: ball_weight = 500 total_weight = 3250 box_weight = total_weight - (25 * ball_weight) result = box_weight return result
A book has 375 pages. If a reader reads 25 pages per hour, how many hours will it take to finish reading the book?
def solve() -> int: pages_in_book = 375 rate_reading = 25 hours_to_finish = pages_in_book / rate_reading result = hours_to_finish return result
Hannah used to squat 150 kg for 4 triples. She increased the weight by 10 kg and did 5 triples. What is the total amount of weight she has moved?
def solve() -> int: weight = 150 increasment = 10 triples = 4 new_triples = 5 total = (weight + increasment) * (triples + new_triples) result = total return result
Ethan can make 15 more jars of jam than Mia can. If Mia can make 20 jars of jam, and each jar costs $2, how much more will Ethan earn than Mia if he sells all his jars of jam at $5 a piece?
def solve() -> int: Mia_jars = 20 Ethan_jars = Mia_jars + 15 jar_cost = 2 selling_price = 5 Mia_cost = Mia_jars * jar_cost Ethan_revenue = Ethan_jars * selling_price Ethan_profit = Ethan_revenue - Mia_cost result = Ethan_profit return result
A store has a 20% discount on all items. If an item originally costs $80, how much does it cost after the discount?
def solve() -> int: original_price = 80 discounted_price = original_price - (0.2*original_price) result = f'The discounted price is ${discounted_price}.' result = discounted_price return result
Student: Aaron wants to buy a toaster that costs $20. He has $8. How much more money does he need?
def solve() -> int: toaster_cost = 20 available_money = 8 money_needed = toaster_cost - available_money result = money_needed return result
A store sells 200 items in a day. Of these, 70 items are books, 60 items are clothes, and 70 items are toys. What percentage of the items sold are clothes and toys?
def solve() -> int: total_items = 200 clothes_sold = 60 toys_sold = 70 clothes_and_toys_sold = clothes_sold + toys_sold percent_clothes_and_toys = (clothes_and_toys_sold/total_items)*100 result = percent_clothes_and_toys return result
A fruit stand sells 30 apples and 20 bananas. An apple costs 40 cents each and a banana costs 20% more. How much will the fruit stand earn if all apples and bananas are sold?
def solve() -> int: apples = 30 apple_price = 0.4 bananas = 20 banana_price = apple_price * 1.2 apple_earnings = apples * apple_price banana_earnings = bananas * banana_price total_earnings = apple_earnings + banana_earnings result = total_earnings return result
If a tank can hold 500 gallons of water and it is currently half full, how many gallons of water are currently in the tank?
def solve() -> int: capacity = 500 fraction_full = 0.5 current_volume = capacity * fraction_full result = current_volume return result
Layla has 100 stickers, and she wants to give away 80% of them to her friends. How many stickers will she have left after giving away 80%?
def solve() -> int: stickers = 100 percentage_given_away = 80 stickers_given_away = (percentage_given_away / 100) * stickers stickers_left = stickers - stickers_given_away result = stickers_left return result
A box contains 100 pens. If two-thirds of the box is filled with pens and one pen is made up of 4 parts, what is the total number of parts of ink cartridges in one-fifth of the pens?
def solve() -> int: total_pens = 100 filled_fraction = 2/3 filled_pens = total_pens * filled_fraction parts_per_pen = 4 total_parts = filled_pens * parts_per_pen one_fifth_pens = total_pens / 5 parts_in_one_fifth = one_fifth_pens * parts_per_pen result ...
Jeanine has a garden that is 15 feet wide and 30 feet long. How many square feet is her garden?
def solve() -> int: width = 15 length = 30 area = width * length result = area return result
A shop is selling pairs of mittens. It takes 9 scraps of material for each pair of mittens. If the shop ahs 900 scraps of material, how many pairs of mittens can the shop make?
def solve() -> int: def mitten_pairs(scraps_of_material, no_scraps_for_pair): return scraps_of_material // no_scraps_for_pair scraps_of_material = 900 no_scraps_for_pair = 9 result = mitten_pairs(scraps_of_material, no_scraps_for_pair) return result
Georgie had 30 stickers. He shared them equally between 8 friends. How many stickers did each friend get?
def solve() -> int: num_stickers = 30 num_friends = 8 stickers_for_each_friend = num_stickers / num_friends result = stickers_for_each_friend return result
Student: If a tank can hold 100 liters of water and there are currently 60 liters of water in it, what is the percentage of water in the tank?
def solve() -> int: tank_capacity = 100 water_volume = 60 water_percentage = (water_volume / tank_capacity) * 100 result = water_percentage return result
A recipe requires 3/4 cup of sugar. If you want to make half of the recipe, how much sugar do you need?
def solve() -> int: ingredient_amount = 3/4 full_recipe_yield = 1 partial_recipe_yield = 1/2 required_amount = (ingredient_amount / full_recipe_yield) * partial_recipe_yield result = required_amount return result
A store sells a sweater for $45, which is a 20% discount from its original price. What was the original price of the sweater?
def solve() -> int: discounted_price = 45 percent_discount = 20 original_price = discounted_price/(1 - percent_discount/100) result = original_price return result
Student: Jack makes $20 per hour at his job. He worked for 35 hours this week and received a bonus of $50. Calculate his total pay for the week.
def solve() -> int: hourly_wage = 20 hours_worked = 35 bonus = 50 total_pay = hourly_wage * hours_worked + bonus result = total_pay return result
Erica needs to take 1 prenatal vitamin per day, 2 folic acid pills per day, and three times as many vitamin C pills as folic acid pills each day. How many pills does Erica take in a week?
def solve() -> int: prenatal_vitamin = 1 folic_acid_pills = 2 vitamin_C_pills = folic_acid_pills * 3 daily_total = prenatal_vitamin + folic_acid_pills + vitamin_C_pills weekly_total = daily_total * 7 result = weekly_total return result
Jacob has a square sheet of paper with an area of 100cm2. What is the length of each side of the square?
def solve() -> int: area = 100 side_length = area ** 0.5 result = side_length return result
Tom is twice as old as Peter. If Peter is 5 years old, how old is Tom?
def solve() -> int: peter_age = 5 tom_age = peter_age * 2 result = tom_age return result
Hugo was collecting stickers for his album. He had 50 stickers to start with and he bought 3 packs of stickers, each containing 12 stickers, for $6. He also traded 10 of his stickers with his friend for 8 different stickers. He needs 100 stickers to fill his album. How much money does he need to spend to buy enough pac...
def solve() -> int: stickers_per_pack = 12 packs_bought = 3 stickers_bought = stickers_per_pack * packs_bought stickers_traded = -10 + 8 stickers_total = 50 + stickers_bought + stickers_traded stickers_needed = 100 - stickers_total packs_needed = (stickers_needed + stickers_per_pack - 1) //...
A teacher has graded 72 papers, 16 more than the number of students in her class. She gave a bonus point to 24 students, half as many as the number of students who scored above 80. What is the average score of the class?
def solve() -> int: papers = 72 bonus = 24 above_80 = 2 * bonus students = papers - 16 total_score = papers * 100 + bonus average_score = total_score / students result = average_score return result
A football team wins 60% of their games. If they played 20 games this season, how many games did they win?
def solve() -> int: total_games = 20 win_ratio = 0.6 win_games = total_games * win_ratio result = win_games return result
Jack wants to buy a car. He can either pay $2000 upfront and then $300/month or $500/month for the next 2 years. Which payment plan should he choose if he wants to save money?
def solve() -> int: car_plan1 = 2000 + (300*12*2) car_plan2 = 500*24 result = "Jack should choose Plan 2, because he will save $" + str(car_plan1 - car_plan2) + " in total." return result
Charlie and his friends have 66 balloons. When they each pick 2 balloons for themselves, how many balloons are left?
def solve() -> int: remaining_balloons = 66 - (2 * 6) result = remaining_balloons return result
The length of a rectangular field is 125 meters and the width is 80 meters. If the field is divided into smaller squares of 5 meters on each side, how many more squares can fit in the field?
def solve() -> int: field_length = 125 field_width = 80 square_side = 5 total_squares = (field_length // square_side) * (field_width // square_side) result = total_squares return result
Kelly and Ryan went to the movies and bought popcorn and candy. The popcorn cost $5 per bag and the candy cost $3 per box. Kelly bought 2 bags of popcorn and 1 box of candy, while Ryan bought 1 bag of popcorn and 2 boxes of candy. They also paid $12 each for their movie tickets. What was the combined total cost, in dol...
def solve() -> int: popcorn_cost = 5 candy_cost = 3 kelly_popcorn = 2 kelly_candy = 1 ryan_popcorn = 1 ryan_candy = 2 ticket_cost = 12 kelly_snacks = popcorn_cost * kelly_popcorn + candy_cost * kelly_candy ryan_snacks = popcorn_cost * ryan_popcorn + candy_cost * ryan_candy total_...
A recipe requires 2.5 cups of flour for every 1.5 cups of sugar. If we have 6 cups of flour, how much sugar do we need?
def solve() -> int: cups_of_flour = 6 flour_to_sugar_ratio = 2.5/1.5 cups_of_sugar = cups_of_flour / flour_to_sugar_ratio result = round(cups_of_sugar, 1) return result
Dylan spent 4 hours hiking in the mountains. He brought a water bottle that held 4 cups of water with him on the hike. He drank a full bottle every hour. How many cups of water did Dylan drink on his hike?
def solve() -> int: hours_hiking = 4 water_bottle_capacity = 4 water_drank_per_hour = water_bottle_capacity total_water_drank = hours_hiking * water_drank_per_hour result = total_water_drank return result
Sophia got tickets for Disneyland for her cousins and her. Tickets cost $110 per person. She paid $25 extra for the express pass. What is the total amount she paid for the tickets?
def solve() -> int: num_people = 4 ticket_cost = 110 express_pass_cost = 25 total_cost = num_people * ticket_cost + express_pass_cost result = total_cost return result
Emily spent $65 on a dress and paid with $20 and $5 bills. If she gave the cashier 3 more $5 bills than $20 bills, how many $20 bills did she give?
def solve() -> int: num_twenty_bills = 2 result = num_twenty_bills return result
Kevin is a contractor and paints houses. Each gallon of paint can cover 100 square feet of surface area. If a gallon of paint costs $25 and Kevin paints houses with an area of 2000 square feet, how much does Kevin spend on paint in a week?
def solve() -> int: coverage_per_gallon = 100 cost_per_gallon = 25 house_area = 2000 total_area = 0 for i in range(7): total_area += house_area total_gallons = total_area / coverage_per_gallon total_cost = total_gallons * cost_per_gallon result = total_cost ...
A farm has 190 chickens and ducks. The number of ducks is 15 more than thrice the number of chickens. If the total number of legs is 652, calculate the number of ducks on the farm.
def solve() -> int: num_chickens = 190 / 4 num_ducks = 3 * num_chickens + 15 total_legs = 2 * (num_chickens * 2 + num_ducks * 2) num_ducks_legs = total_legs - 190 * 2 num_ducks = num_ducks_legs / 2 result = num_ducks return result