question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Student: John has 20 chickens and 25 cows. He sells the chickens for $2 a piece and the cows for $5 a piece. How much money does he earn if he sells all the chickens and cows?
def solve() -> int: chickens = 20 cows = 25 chicken_price = 2 cow_price = 5 total_money = chickens * chicken_price + cows * cow_price result = total_money return result
Jack wants to run more. He has a running app that can track up to 5 miles. That week Jack runs 2 miles a day except for one day when he only runs 1 mile. In 7 days, how many miles does Jack run?
def solve() -> int: miles_per_day = 2 one_day_less_miles = 1 days = 7 total_miles = (miles_per_day * (days - 1)) + one_day_less_miles result = total_miles return result
Student: There are 50 frogs in the pond, 60 percent of them are green ones. How many green frogs in the pond?
def solve() -> int: total_frogs = 50 percent_green = 0.6 green_frogs = total_frogs * percent_green result = green_frogs return result
Student: After noticing an increase in their monthly profits, Josie and William decide to increase the price of their product 25%. If their initial regular price was $54, what is their new regular price?
def solve() -> int: initial_price = 54 increase = 0.25 amount_increase = initial_price * increase new_price = initial_price + amount_increase result = new_price return result
Student: Mike has 8 red apples, 4 green apples, and 9 yellow apples. How many apples does Mike have in total?
def solve() -> int: red_apples = 8 green_apples = 4 yellow_apples = 9 total_apples = red_apples + green_apples + yellow_apples result = total_apples return result
1. At a farmer's market, Max bought 4 bags of wheat and 2 bags of oats, each of which costs $10. How much money did Max spend in total?
def solve() -> int: total_cost = 0 bag_cost = 10 num_wheat_bags = 4 num_oats_bags = 2 total_cost += num_wheat_bags * bag_cost total_cost += num_oats_bags * bag_cost result = total_cost return result
Student: Fred can mow the lawn in 60 minutes while Bill takes 90 minutes to do the same task. How much slower is Bill compared to Fred?
def solve() -> int: fred_time = 60 bill_time = 90 time_difference = bill_time - fred_time time_ratio = bill_time / fred_time percent_difference = (time_difference / fred_time) * 100 result = percent_difference return result
A gardener has a 50-foot by 20-foot rectangular garden. How much fencing is needed to enclose it?
def solve() -> int: length = 50 width = 20 perimeter = 2 * (length + width) result = perimeter return result
A store is having a 20% discount on all items. If the original price of a jacket was $50, what is its new price?
def solve() -> int: original_price = 50 discount = 0.2 new_price = original_price * (1 - discount) result = new_price return result
A car travels at 60 miles per hour, how many miles will it travel in 2.5 hours?
def solve() -> int: speed = 60 time = 2.5 distance = speed * time result = distance return result
A hotel manager gives a customer a discount of 15% on a room that costs $100. What is the final cost?
def solve() -> int: original_cost = 100 discounted_cost = original_cost * 0.15 final_cost = original_cost - discounted_cost result = final_cost return result
A box contains 50 toys. 20 of them are cars and the rest are trucks. What percentage of toys are trucks?
def solve() -> int: total_toys = 50 num_cars = 20 num_trucks = total_toys - num_cars percent_trucks = (num_trucks / total_toys) * 100 result = percent_trucks return result
Lisa and her friends went to a water park and spent $600 on tickets. They agree to split the cost based on the percentage of each person's height. Lisa is 5'5", while her friends are 6'0", 5'10", and 5'8". How much should Lisa pay?
def solve() -> int: total_height = 5.5 + 6 + 5.10 + 5.8 percent_lisa_height = 5.5 / total_height lisa_share = percent_lisa_height * 600 result = lisa_share return result
Pete had 8 markers and his brother gave him 10 more markers. How many markers does Pete have now?
def solve() -> int: markers = 8 markers = markers + 10 result = markers return result
An Olympic-sized swimming pool is 50 meters long, 25 meters wide, and 3 meters deep. How many liters of water are needed to fill the pool?
def solve() -> int: length = 50 width = 25 depth = 3 liters_per_cubic_meter = 1000 volume_in_cubic_meters = length * width * depth volume_in_liters = volume_in_cubic_meters * liters_per_cubic_meter result = volume_in_liters return result
John is three times as old as Michael who is 12. When John is 36, how old will Michael be?
def solve() -> int: michael = 12 john = michael*3 john_age_difference = 36-john michael_age_difference = john_age_difference result = michael + michael_age_difference return result
If Janette bought beef jerky for $2.50 per pack and spent $25 on 20 packs of beef jerky, how much money did she spend on every 3 pieces of jerky that she ate during her trip?
def solve() -> int: price_per_pack = 2.50 packs_of_jerky = 20 pieces_of_jerky = packs_of_jerky*10 total_spent = packs_of_jerky*price_per_pack price_per_jerky = total_spent/pieces_of_jerky price_per_three_jerky = price_per_jerky*3 result = price_per_three_jerky return result
Ethan and his friend Luke went to a coffee shop. Ethan bought three times as many cups of coffee as Luke, who spent $5 per cup and bought four of them. Ethan paid $20 per cup. How much did they spend in total?
def solve() -> int: luke_cups = 4 ethan_cups = 3 * luke_cups luke_cost_per_cup = 5 ethan_cost_per_cup = 20 luke_total_cost = luke_cups * luke_cost_per_cup ethan_total_cost = ethan_cups * ethan_cost_per_cup total_cost = luke_total_cost + ethan_total_cost result = total...
Student: Sara can run 5 miles in 45 minutes. Due to a leg injury, her running speed reduces by 1 mile per hour. How long will it take her to run 7 miles?
def solve() -> int: initial_speed = 5 reduced_speed = initial_speed - 1 distance = 7 time = distance / reduced_speed time_in_minutes = time * 60 result = time_in_minutes return result
Sarah sells handmade jewelry at a market and earns different amounts of money each day. On Monday, Tuesday, Wednesday, and Thursday she earned $50, $80, $35, and $70. How much should she make on Friday to reach an average of $60 in sales per day?
def solve() -> int: monday_earnings = 50 tuesday_earnings = 80 wednesday_earnings = 35 thursday_earnings = 70 total_earnings = monday_earnings + tuesday_earnings + wednesday_earnings + thursday_earnings average_earnings = total_earnings / 4 target_average = 60 friday_earnings =...
If a group of 6 friends equally shares 42 pieces of candy, how many pieces of candy does each friend get?
def solve() -> int: num_friends = 6 total_candy = 42 candy_per_friend = total_candy / num_friends result = candy_per_friend return result
It takes 360 beads to make a bracelet. If each bead costs 5 cents, and there is a 10% discount for buying 100 or more beads, how much will Amy have to pay to make 15 bracelets?
def solve() -> int: beads_needed = 15 * 360 regular_price = beads_needed * 0.05 discounted_price = regular_price * 0.9 result = discounted_price return result
2. Yuki is having a pizza party. He is ordering 10 pizzas. Each pizza requires 2 cups of tomato sauce. How much tomato sauce should he buy in total?
def solve() -> int: total_sauce = 0 num_pizza = 10 sauce_per_pizza = 2 for pizza in range(num_pizza): total_sauce += sauce_per_pizza result = total_sauce return result
Michael has 4 pet dogs. Each dog needs 2 cups of dog food per day. How many cups of dog food will Michael need for his dogs in a week?
def solve() -> int: dogs = 4 cups_per_day = 2 days_per_week = 7 cups_per_week = dogs * cups_per_day * days_per_week result = cups_per_week return result
To make a smoothie, you need 2 cups of strawberries for every 3 cups of milk used. If you have 10 cups of milk, how many cups of strawberries are needed for the smoothie?
def solve() -> int: milk = 10 strawberries = (2/3) * milk result = strawberries return result
Paula has earned 88%, 90%, and 85% on her first three history tests. If her goal for the semester is to achieve at least an 87% average, what score does she need to earn on her fourth and final test?
def solve() -> int: test1 = 88 test2 = 90 test3 = 85 goal_average = 87 total_average = (test1 + test2 + test3) / 3 required_score = goal_average * 4 - (test1 + test2 + test3) result = required_score return result
Student: A recipe calls for 2 cups of sugar for every 3 cups of flour. If you want to use 6 cups of flour, how much sugar do you need?
def solve() -> int: flour = 6 sugar_ratio = 2/3 sugar = flour * sugar_ratio result = sugar return result
A car travels at a speed of 60 miles per hour. It takes the car 2 hours and 30 minutes to reach its destination. How far did the car travel?
def solve() -> int: speed = 60 time = 2.5 distance = speed * time result = distance return result
Some possible questions are: Emma bought a book for $12 and a pen for $1.50. She also paid 10% sales tax on the total purchase. How much did she spend in total?
def solve() -> int: subtotal = 12 + 1.50 sales_tax = 0.1 * subtotal total = subtotal + sales_tax result = total return result
Student: Kyle has 70 cups in total. He gives away 25 cups to his friends. He also buys 10 cups. How many cups does Kyle have now?
def solve() -> int: total_cups = 70 given_away = 25 bought = 10 result = total_cups - given_away + bought return result
If a number is decreased by 20% and then increased by 25%, what is the overall percentage change in the number?
def solve() -> int: percentage_decrease = 20 percentage_increase = 25 overall_percentage_change = percentage_increase - percentage_decrease + ((percentage_decrease * percentage_increase) / 100) result = overall_percentage_change return result
In a pack of cards, the first card is a club and two-fifths of the remaining cards are also clubs. If there are 52 cards in the pack, how many cards are clubs?
def solve() -> int: total_cards = 52 first_card = 1 remaining_cards = total_cards - first_card club_cards = (2/5) * remaining_cards total_club_cards = first_card + club_cards result = total_club_cards return result
1. Richard had 36 cups of sugar. He used some of it to bake a cake and was left with 18 cups. Later, he used half of those remaining cups to make some cookies. How many cups of sugar does he have now?
def solve() -> int: cups_left = 18 cups_used = cups_left/2 result = cups_left - cups_used return result
Student: Jeff has a total of 185 yards of fabric. He needs to cut up the fabric into 3 equal pieces. How many yards of fabric should Jeff cut for each piece?
def solve() -> int: total_yards = 185 num_pieces = 3 yards_per_piece = total_yards / num_pieces result = yards_per_piece return result
Maria had $20 and her brother Max had half as much money as she did. On her birthday, their uncle gave each of them an equal amount of money so that they had a total of $70. How much did their uncle give each of them?
def solve() -> int: maria_money = 20 max_money = maria_money / 2 total_money = 70 uncle_money = (total_money - maria_money - max_money) / 2 result = uncle_money return result
Barbara has 1000 packets of raisins and 75 packets of nuts. Each nut packet contains 8 ounces of nuts, and each raisin packet contains 4 ounces. How many ounces of nuts and raisins does Barbara have in total?
def solve() -> int: weight_of_nuts = 75 * 8 weight_of_raisins = 1000 * 4 total_weight = weight_of_nuts + weight_of_raisins result = total_weight return result
If a person invests $1000 in a savings account that has a 2% annual interest rate, how much money will they have after 5 years?
def solve() -> int: principal = 1000 interest_rate = 0.02 num_years = 5 future_value = principal * (1 + interest_rate)**num_years result = future_value return result
Leo has 8 more pencils than Maya. Maya has 3 times as many pencils as Nina. If Nina has 2 pencils, how many pencils does Leo have?
def solve() -> int: nina = 2 maya = 3 * nina leo = maya + 8 result = leo return result
Mia is making a stir fry and needs 1/2 pound of tofu for one serving. In a block of tofu, there are 16 ounces of tofu. How many blocks of tofu should Mia buy if she plans to make 8 servings?
def solve() -> int: tofu_per_serving = 1/2 ounces_per_block = 16 servings = 8 total_tofu = tofu_per_serving * servings total_tofu_ounces = total_tofu * 16 blocks_of_tofu = total_tofu_ounces / ounces_per_block result = blocks_of_tofu return result
Possible math questions and programs: Mia buys candy bars for 75 cents each and sells them for $1.25 each. If she sold 40 candy bars and spent $15 on gas, how much profit did she make?
def solve() -> int: cost = 0.75 * 40 revenue = 1.25 * 40 profit = revenue - cost - 15 result = profit return result
A bakery sold a total of 65 cakes in 5 days. How many cakes did the bakery sell per day?
def solve() -> int: total_cakes = 65 days = 5 cakes_per_day = total_cakes / days result = cakes_per_day return result
The school cafeteria sells 2 types of sandwiches: turkey for $3 and ham for $2. If Sarah wants to buy 4 sandwiches and spend no more than $10, how many of each type should she buy?
def solve() -> int: turkey = 0 ham = 0 for i in range(5): for j in range(6): if (i*3 + j*2 == 10) and (i+j == 4): turkey = i ham = j result = (turkey,ham) return result
The pet store in the plaza sells dog toys and cat treats. The cost of five cat treats is equal to the cost of three dog toys. If one dog toy costs $6, how much does a dozen cat treats cost, in dollars?
def solve() -> int: dog_toy_cost = 6 cat_treats_cost = (3/5) * dog_toy_cost dozen_cat_treats_cost = 12 * cat_treats_cost result = dozen_cat_treats_cost return result
If three workers can complete a building project in 30 days, but one worker is not available, how long will it take six workers to complete the building project?
def solve() -> int: orig_num_workers = 3 orig_time = 30 num_workers_now = 6 new_time = orig_time * (orig_num_workers / num_workers_now) result = new_time return result
John, Lisa and their classmates work together on a school project. On Monday, they worked for 6 hours. John worked 1.5 times more than Lisa. On Tuesday, Lisa worked for 8 hours. How many hours did they work in total?
def solve() -> int: total_hours = 0 total_hours += 6 total_hours += 6 * 1.5 total_hours += 8 result = total_hours return result
If Juan walks 2 miles to school every day and burns 100 calories per mile, how many total calories does Juan burn in a week?
def solve() -> int: miles_per_day = 2 calories_per_mile = 100 days_per_week = 7 total_miles = miles_per_day * days_per_week total_calories = total_miles * calories_per_mile result = total_calories return result
At a party, there are 8 pizzas and 60 people attending. How much pizza does each person get if it is divided evenly?
def solve() -> int: pizzas = 8 people = 60 pizza_per_person = pizzas / people result = 0.13333333333333333 return result
A hotel room costs $150 per night, but if you stay more than 3 nights they give you a 10% discount. If John stays for 5 nights, how much will he spend?
def solve() -> int: nightly_rate = 150 discount_rate = 0.1 num_nights = 5 if num_nights <= 3: total_cost = nightly_rate * num_nights else: total_cost = (nightly_rate * num_nights) - (nightly_rate * num_nights * discount_rate) result = total_cost return result
A tank can hold 75 liters of water. If it is currently 40% full, how many liters of water are currently in the tank?
def solve() -> int: tank_capacity = 75 current_fill_percent = 40 current_fill_liters = tank_capacity * (current_fill_percent / 100) result = current_fill_liters return result
Nine years ago, Jacob was four times the age of his nephew. In 4 years, his nephew will be 14. How old is Jacob now?
def solve() -> int: nephew_age_4_years_later = 14 nephew_age_9_years_ago = nephew_age_4_years_later - 4 jacob_age_9_years_ago = 4 * nephew_age_9_years_ago jacob_age_now = jacob_age_9_years_ago + 9 result = jacob_age_now return result
Jack's internet bill is equal to his current age multiplied by six. If Jack doubles his age in four years, what will be his new internet bill?
def solve() -> int: age = 25 bill = age * 6 new_age = age + 4 new_bill = new_age * 6 result = new_bill return result
Kim and Lee made 72 bracelets and sold them at a fair. Kim sold twice as many bracelets as Lee, and each bracelet cost $5. If they split the profit equally, how much money did each of them earn?
def solve() -> int: bracelets_lee = 24 bracelets_kim = 2 * bracelets_lee revenue = 5 * (bracelets_lee + bracelets_kim) profit = revenue / 2 result = profit return result
Possible new questions: Max is planning to buy some books online. He has a coupon that gives him a 20% discount on any order above $50. He wants to buy 4 books that cost $15 each and 3 books that cost $10 each. How much will he pay after applying the coupon and adding a $5 shipping fee?
def solve() -> int: book1 = 15 book2 = 10 coupon = 0.2 shipping = 5 total_before = 4 * book1 + 3 * book2 if total_before > 50: total_after = total_before * (1 - coupon) else: total_after = total_before final_cost = total_after + shipping result = final_cost return...
Student: A bag contains 5 red marbles, 3 blue marbles, and 2 green marbles. If a marble is randomly selected from the bag, what is the probability that it is red?
def solve() -> int: red_marbles = 5 blue_marbles = 3 green_marbles = 2 total_marbles = red_marbles + blue_marbles + green_marbles probability_red = red_marbles / total_marbles result = probability_red return result
If 3 apples cost 9 dollars, how much would 6 apples cost?
def solve() -> int: apple_cost = 9 apple_number = 6 total_cost = apple_cost * apple_number result = total_cost return result
A recipe calls for 2 1/2 cups of sugar to make 24 muffins. How much sugar is needed to make 36 muffins?
def solve() -> int: muffins_needed = 36 sugar_per_muffin = 2.5 / 24 sugar_needed = muffins_needed * sugar_per_muffin result = sugar_needed return result
Mia and Jake collect stickers. Mia has 125 stickers and Jake has 75 stickers. They both buy a pack of 10 stickers for $1.50 each. Mia gives Jake 3 stickers and Jake gives Mia 2 stickers. How many stickers do they have altogether, in stickers?
def solve() -> int: mia_stickers = 125 jake_stickers = 75 bought_stickers = 10 pack_price = 1.5 mia_gives = 3 jake_gives = 2 mia_stickers = mia_stickers + bought_stickers - mia_gives + jake_gives jake_stickers = jake_stickers + bought_stickers - jake_gives + mia_gives total_stickers ...
Lily has a jar where she keeps savings for her vacation. She originally had $120, but withdrew $50. How much money is currently in the jar?
def solve() -> int: original_amount = 120 withdrawal_amount = 50 result = original_amount - withdrawal_amount return result
What is the average speed of the 3rd and 5th fastest rabbits if the 3rd fastest rabbit runs twice as fast as the 4th fastest rabbit, the 5th fastest rabbit runs 4 times as fast as the 4th fastest rabbit, the 6th fastest rabbit runs 3 times as fast as the 4th fastest rabbit, and the 4th fastest rabbit runs at 24 km/h?
def solve() -> int: speed = [] speed.append(24) speed.append(speed[-1] * 2) speed.append(speed[-1] * 4) speed.append(speed[-1] * 3) result = (speed[1] + speed[3]) / 2 return result
A factory produced a total of 15000 products. Of these products, 60% were sold and the remaining products were stored in the warehouse. After a month, 25% of the products stored in the warehouse were found to be damaged. How many undamaged products were in the warehouse?
def solve() -> int: total_products = 15000 sold_products = 0.60 * total_products remaining_products = total_products - sold_products undamaged_products = remaining_products - (remaining_products * 0.25) result = undamaged_products return result
-Q1 is provided as an example, DO NOT CHANGE Q1. Q1: A supermarket receives a delivery of 15 cases of tins of beans. Each case contains 24 tins. If 5% of the tins are damaged and thrown away, how many tins of beans are left?
def solve() -> int: total_tins = 15 * 24 damaged_tins = total_tins * 0.05 tins_left = total_tins - damaged_tins result = tins_left return result
A box contains 24 candies. If each candy costs $0.30, how much do you need to pay for the whole box?
def solve() -> int: candies = 24 cost_per_candy = 0.3 total_cost = candies * cost_per_candy result = total_cost return result
A rectangular prism has a width of 5 meters, a height of 8 meters, and a length of 12 meters. What is the surface area of the rectangular prism?
def solve() -> int: width = 5.0 height = 8.0 length = 12.0 surface_area = 2 * (length * width + length * height + width * height) result = surface_area return result
The distance between two cities is 500 km. A car travels at a speed of 80 km/h and a bus travels at a speed of 60 km/h. If they both start from the same point at the same time, after how many hours will they meet?
def solve() -> int: distance = 500 car_speed = 80 bus_speed = 60 relative_speed = car_speed + bus_speed time = distance / relative_speed result = time return result
Student: Edison has five times the number of coins as Edith. Edith has $3 fewer coins than Joseph. Joseph has twice as many coins than Barry. How many coins do they have together if Barry has 60 coins?
def solve() -> int: Barry_coins = 60 Joseph_coins = 2 * Barry_coins Edith_coins = Joseph_coins - 3 Edison_coins = 5 * Edith_coins total_coins = Barry_coins + Joseph_coins + Edith_coins + Edison_coins result = total_coins return result
John is twice the age of Peter. Sarah is 3 years older than Peter. If Peter is 12 years old, how old is Sarah?
def solve() -> int: john = 2 * 12 peter = 12 sarah = peter + 3 result = sarah return result
Kevin wants to save $5000 in two years. If he starts with $1500 and will save $200 per month, will he be able to reach his goal?
def solve() -> int: savings_goal = 5000 initial_savings = 1500 savings_per_month = 200 months_to_save = 24 total_savings = initial_savings + (savings_per_month * months_to_save) if total_savings >= savings_goal: can_reach_goal = True else: can_reach_goal = False result = ...
Jake has fallen behind on two of his rental car payments, but his rental car agency doesn't impose any additional fee for late payment. He intends to pay off both payments using 4/5 of his next month's salary after taxes. If he earns $4500 per month and pays 9% tax, what is his monthly rental car bill?
def solve() -> int: salary = 4500 tax_rate = 0.09 taxes = salary * tax_rate take_home_pay = salary - taxes late_payments = 2 payment_amount = take_home_pay * 4/5 total_payment = late_payments * payment_amount monthly_rental_car_bill = total_payment / late_payments result = month...
A swimming pool has a length of 15 meters, a width of 8 meters, and a depth of 2 meters. How many cubic meters of water does the pool hold when it is full?
def solve() -> int: pool_length = 15 pool_width = 8 pool_depth = 2 pool_volume = pool_length * pool_width * pool_depth result = pool_volume return result
Lisa buys a bike for $300. She pays a 10% deposit and agrees to pay the rest in 12 equal monthly installments with 5% interest per year. How much is each installment?
def solve() -> int: P = 300 D = 0.1 r = 0.05 n = 12 B = P - P*D i = r/n M = B*i*(1 + i)**n/((1 + i)**n - 1) M = round(M, 2) result = M return result
Anthony wants to buy a yacht in 5 years. He saved $15,000 by April and plans to save $2,000 per month for the next 5 years. If his boss gifts him $25,000 today, how much money will he have in his savings by the time he buys the yacht?
def solve() -> int: current_savings = 15000 monthly_savings = 2000 total_months = 5 * 12 future_savings = monthly_savings * total_months boss_gift = 25000 total_savings = current_savings + future_savings + boss_gift result = total_savings return result
100 people were watching a play. 1/4 of the people left during the intermission. If 15 people left, how many more people stayed than left?
def solve() -> int: total_people = 100 people_left = 15 people_stayed = total_people - people_left result = people_stayed - people_left return result
Student: - Jake has 100 marbles in a jar. He takes out 20% of them and gives them to his sister. Then he takes out another 10% of the remaining marbles and puts them in his pocket. How many marbles does Jake have left in the jar?
def solve() -> int: marbles_in_jar = 100 marbles_taken_out = marbles_in_jar * 0.2 marbles_left_in_jar = marbles_in_jar - marbles_taken_out marbles_taken_for_pocket = marbles_left_in_jar * 0.1 marbles_left_in_jar = marbles_left_in_jar - marbles_taken_for_pocket result = marbles_left_in_jar r...
A pizza parlor has 20-inch diameter large pizzas. If a person can eat a maximum of 7 square inches of pizza in one sitting, how many people can share a large pizza?
def solve() -> int: diameter = 20 radius = diameter / 2 max_area = 7 pizza_area = (radius ** 2) * 3.14 people_can_share = round(pizza_area / max_area) result = people_can_share return result
Jasmine has 36 toys. She used 3/4 of them to make a playhouse. How many toys did Jasmine use to make the playhouse?
def solve() -> int: toys = 36 used = int((toys*(3/4))) result = used return result
Mark has 2 crates of books with a total of 18. If the first crate has 5 books, how many books are in the second crate?
def solve() -> int: total = 18 crate1 = 5 crate2 = total - crate1 result = crate2 return result
arah has 3 apples and buys 5 more. Then she eats 2 apples and gives 1 to her friend. How many apples does Sarah have now?
def solve() -> int: apples = 3 apples += 5 apples -= 2 apples -= 1 result = apples return result
A store sells t-shirts for $15 each. If a customer buys more than 10, they get a 20% discount on all t-shirts. If a customer buys less than 10, they do not receive the discount. If a customer buys 15 t-shirts, how much will they spend?
def solve() -> int: price_per_shirt = 15 num_shirts = 15 if num_shirts > 10: discounted_price = price_per_shirt * 0.8 total_cost = discounted_price * num_shirts else: total_cost = price_per_shirt * num_shirts result = total_cost return result
Michael needs to earn 200 dollars to buy a new phone. If he mows lawns for 25 dollars each, how many lawns does he need to mow to earn enough money?
def solve() -> int: lawns_needed = 200 / 25 result = lawns_needed return result
``` A car dealership has 100 cars for sale. Each car costs $20,000 and the dealership pays $10,000 for each car when buying them from a manufacturer. If each car requires $500 for maintenance, and the dealership wants to make $2,000 profit on each car, how much money will the dealership make by selling all 100 cars?
def solve() -> int: cost_per_car = 10_000 + 500 price_per_car = cost_per_car + 2_000 profit_per_car = price_per_car - cost_per_car total_profit = profit_per_car * 100 result = total_profit return result
Student: On Monday’s and Tuesday’s, Frank sells 5 small doughnuts on his shop for $2 and 8 big doughnuts for $3.50. On Thursday’s and Saturday’s, he sells 12 small doughnuts for $2 and 16 big doughnuts for $3.50. How much money did he make in those four days combined?
def solve() -> int: small_doughnuts_monday_tuesday = 5 big_doughnuts_monday_tuesday = 8 price_small_doughnuts_monday_tuesday = 2 price_big_doughnuts_monday_tuesday = 3.50 small_doughnuts_thursday_saturday = 12 big_doughnuts_thursday_saturday = 16 price_small_doughnuts_thursday_saturday = 2 ...
If the cost of 4 books is $72, what is the cost of 1 book?
def solve() -> int: price_of_one_book = 72/4 result = price_of_one_book return result
A piece of wire is bent into a square. If each side of the square is 2 inches long, what is the total length of the wire?
def solve() -> int: side_length = 2 total_length = 4*side_length result = total_length return result
Student: If a toy store had 25 cars, 18 trucks, and 21 trains, how many toys did they have in total?
def solve() -> int: cars = 25 trucks = 18 trains = 21 total_toys = cars + trucks + trains result = total_toys return result
Student: Kyle has a total of 240 cookies. He wants to divide the cookies equally among 12 people. How many cookies would each person get?
def solve() -> int: cookies = 240 people = 12 cookies_per_person = cookies / people result = cookies_per_person return result
A student received the following grades on four tests: 85%, 90%, 70%, and 95%. What was the average grade as a percentage?
def solve() -> int: test1 = 85 test2 = 90 test3 = 70 test4 = 95 total = test1 + test2 + test3 + test4 average = total / 4 result = average return result
Laura wants to bake a cake that requires 3 cups of flour, 2 cups of sugar, and 1 cup of milk. She only has 2 cups of flour, 1.5 cups of sugar, and 0.5 cups of milk. How many times should she multiply the recipe to use up all the ingredients she has?
def solve() -> int: flour_needed = 3 sugar_needed = 2 milk_needed = 1 flour_available = 2 sugar_available = 1.5 milk_available = 0.5 ratio = min(flour_available / flour_needed, sugar_available / sugar_needed, milk_available / milk_needed) flour_final = ratio * flour_needed sugar_fina...
A bookstore is having a sale where everything is 25% off. If a book originally costs $20, what is the sale price after the discount?
def solve() -> int: original_price = 20 discount_percent = 0.25 discount_amount = original_price * discount_percent sale_price = original_price - discount_amount result = sale_price return result
Leo is a music composer who uses both piano and violin in his scores. He writes fifteen pieces with piano and a fifth of that number with violin. If he writes fifty pieces in total, how many pieces have a combination of piano and violin?
def solve() -> int: piano_pieces = 15 violin_pieces = piano_pieces / 5 total_pieces = 50 combined_pieces = piano_pieces + violin_pieces result = combined_pieces return result
Student: If a box of cereal costs $2.50 and there are 6 boxes in a pack, how much would it cost to buy 36 boxes?
def solve() -> int: cost_per_box = 2.50 boxes_per_pack = 6 cost_per_pack = cost_per_box * boxes_per_pack packs_needed = 36 // boxes_per_pack total_cost = cost_per_pack * packs_needed result = total_cost return result
A train is traveling at 60 miles per hour. If it travels for 3.5 hours, how far does it travel?
def solve() -> int: speed = 60 time = 3.5 distance = speed*time result = distance return result
A jar contains 36 marbles, 12 of which are blue and the rest are red. What percentage of marbles are red?
def solve() -> int: total_marbles = 36 red_marbles = total_marbles - 12 percentage_red = (red_marbles/total_marbles)*100 result = percentage_red return result
Student: A recipe for pancakes requires 2 cups of flour, 1 egg, and 1/2 cup of milk. If you want to make 12 pancakes, how many cups of flour, eggs, and cups of milk are needed?
def solve() -> int: flour = 2 egg = 1 milk = 0.5 flour_needed = flour * 12 egg_needed = egg * 12 milk_needed = milk * 12 result = flour_needed, egg_needed, milk_needed return result
Student: Bob goes shopping every week. He spends $60 every week on food, and saves the rest. If he saved $1080 after 8 weeks of shopping, how much did Bob spend in total in those 8 weeks?
def solve() -> int: food = 60 saved = 1080 weeks = 8 income = saved + food * weeks spent = income - saved result = spent return result
A store has a 30% off sale on all items. If a shirt costs $25, how much will it cost during the sale?
def solve() -> int: original_price = 25 discount = 0.3 sale_price = original_price - (original_price * discount) result = f'<<<${sale_price}>>>' result = sale_price return result
A science exhibition is held for three days. On the first day, 120 people visit the exhibition, while on the second day, 60 more people visit than on the first day. On the last day, the number of visitors is twice the number of people who visited on the second day. If 840 people visited the exhibition, how many people ...
def solve() -> int: first_day = 120 second_day = first_day + 60 third_day = 2 * second_day total_attendance = 840 result = third_day result return result
A store had 300 shirts. They sold 2/5 of the shirts and then ordered 1/4 more. How many shirts does the store have now?
def solve() -> int: shirts = 300 sold_shirts = shirts * 2/5 remaining_shirts = shirts - sold_shirts ordered_shirts = remaining_shirts * 1/4 total_shirts = remaining_shirts + ordered_shirts result = total_shirts return result
Student: Kevin is planning a road trip with his family. He estimates that his car consumes 1 gallon of gas for every 25 miles driven. He also expects to pay an average of $2.80 per gallon of gas. The total distance of his trip is 450 miles. How much will he spend on gas for the trip?
def solve() -> int: distance = 450 miles_per_gallon = 25 price_per_gallon = 2.80 gallons_needed = distance / miles_per_gallon total_cost = gallons_needed * price_per_gallon result = total_cost return result
Jerry climbed up the rope ladder that was hanging from the tree to the treehouse. The ladder was 45 feet long. How many feet did Jerry climb up?
def solve() -> int: length = 45 feetClimbed = length result = feetClimbed return result
Student: A train travels 120 miles per hour for 6 hours and 90 miles per hour for 4 hours. How many miles does the train travel in one day?
def solve() -> int: speed1 = 120 time1 = 6 speed2 = 90 time2 = 4 distance1 = speed1 * time1 distance2 = speed2 * time2 total_distance = distance1 + distance2 result = total_distance return result