question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
There are 100 students in a school. If the ratio of boys to girls is 3:4, how many girls are there in the school?
def solve() -> int: total_ratio = 3+4 girls_ratio = 4/total_ratio girls = girls_ratio * 100 result = girls return result
Olivia bakes 24 cupcakes. She puts frosting on every other cupcake. How many cupcakes have frosting on them?
def solve() -> int: total_cupcakes = 24 frosted_cupcakes = total_cupcakes // 2 result = frosted_cupcakes return result
In a mathematics exam, Jack scored 20 more points than Olivia. If Jack scored 90 points in total, how many points did Olivia score?
def solve() -> int: Olivia_points = 90 - 20 result = Olivia_points return result
Tony is a coffee lover and buys a bag of coffee beans for $15.50. The bag holds 24 ounces of coffee beans. If he uses two tablespoons of coffee beans per cup of coffee, how many cups of coffee can he make with the bag, and what is the cost per cup of coffee?
def solve() -> int: bag_price = 15.50 bag_weight = 24 coffee_per_cup = 2 cups_per_ounce = 1/8 bag_weight_cups = bag_weight * cups_per_ounce cups_of_coffee = bag_weight_cups / coffee_per_cup cost_per_cup = bag_price / cups_of_coffee result = cost_per_cup ret...
James invests $25,000 for 4 years at 10% p.a., compounded annually. What is the amount that he got at the end of 4 years?
def solve() -> int: R = 10 n = 1 t = 4 A = 25000 * ((1 + (R/100)/n)**(n*t)) result = A return result
A container holds 45 gallons of water. If the container is 4/9 full, how much water is in the container?
def solve() -> int: container_volume = 45 fill_level = 4/9 water_volume = container_volume * fill_level result = water_volume return result
A rectangle has a length of 8 cm and a width of 5 cm. What is the area of the rectangle?
def solve() -> int: length = 8 width = 5 area = length * width result = area return result
Mr. Brown bought 10 erasers and gave 3 erasers to his students. How many erasers does he have left?
def solve() -> int: erasers_bought = 10 erasers_given = 3 eraser_left = erasers_bought - erasers_given result = eraser_left return result
Bill, Joe and Sam each invested $1000 in a business. They landed a contract and were able to double their money. Bill decided to take his investment out, but Joe and Sam kept their money in the business and reinvested it all at 5% annual interest rate compounded quarterly. If Joe and Sam kept their money in the busines...
def solve() -> int: interestPerQuarter = 0.05/4 totalInterestJoe = 2000 * (1 + interestPerQuarter)**8 - 2000 totalInterestSam = 2000 * (1 + interestPerQuarter)**8 - 2000 totalJoe = 2000 + totalInterestJoe totalSam = 2000 + totalInterestSam result = totalJoe - totalSam ...
A company produces a total of 5000 products per week. If each worker produces 50 products per hour, how many workers does the company need to hire to produce the products?
def solve() -> int: total_products = 5000 products_per_worker_per_hour = 50 workers_needed = total_products / (products_per_worker_per_hour * 40) result = f'The company needs to hire {int(workers_needed)} workers to produce the products.' result = int(workers_needed) return result
John needs to score at least 90 points or more for passing a driving test. He has scored 70 points already after completing the first part of the test. Assuming he scores four times the amount of points as in the first part each in the remaining parts, how many points will he score by the end of the test? John is paid ...
def solve() -> int: first_part_score = 70 multiplier = 4 required_score = 90 remaining_score = required_score - first_part_score remaining_parts_score = remaining_score * multiplier total_score = first_part_score + remaining_parts_score result = total_score earni...
A rectangular sheet of paper has a length of 15 cm and a width of 8 cm. If a circular portion of radius 4 cm is cut off from each corner, what is the area of the remaining paper?
def solve() -> int: radius = 4 length = 15 - 2 * radius width = 8 - 2 * radius area_remaining = length * width result = area_remaining return result
A video game costs $60. If a store offers a discount of 20%, how much money will you save?
def solve() -> int: game_price = 60 discount_percent = 20 discount = game_price * (discount_percent/100) result = discount return result
A fruit salad consists of 3 apples, 2 oranges, and 4 strawberries. If a serving consists of 1 apple, 1 orange, and 2 strawberries, how many servings can be made from the fruit salad?
def solve() -> int: apples = 3 oranges = 2 strawberries = 4 apples_per_serving = 1 oranges_per_serving = 1 strawberries_per_serving = 2 limiting_factor = min(apples/apples_per_serving, oranges/oranges_per_serving, strawberries/strawberries_per_serving) servings = limiting_factor resu...
Bob is collecting stickers. He has a total of 320 stickers, and 40% of them are animal stickers. He wants to trade some of his animal stickers with his friends for sports stickers. If he trades 25% of his animal stickers, how many sports stickers will he get?
def solve() -> int: animal = 320 * 0.4 trade = animal * 0.25 sports = trade result = sports return result
Sarah had 12 pencils in her pencil case. She lent her friend 3 pencils. Then she lost 2 pencils. If her pencil case can hold up to 15 pencils, how many pencils does she need to buy to fill up her pencil case completely?
def solve() -> int: pencil_case_capacity = 15 initial_pencils = 12 pencils_lent = 3 pencils_lost = 2 remaining_pencils = initial_pencils - pencils_lent - pencils_lost pencils_needed = pencil_case_capacity - remaining_pencils result = pencils_needed return result
Student: David bought 20 apples and 7 bananas from the store. How many fruits did he buy altogether?
def solve() -> int: apples = 20 bananas = 7 total_fruits = apples + bananas result = total_fruits return result
Emma has 24 toys, and Sarah has 3 times as many toys as Emma. After 2 months, Emma doubles her toys, and Sarah donates half of her toys to Emma. How many toys does Emma have now?
def solve() -> int: emma_toys = 24 sarah_toys = 3 * emma_toys emma_toys *= 2 sarah_toys /= 2 emma_toys += sarah_toys result = emma_toys return result
Ben is saving up for a new bike that costs $250. He earns $12 per hour by mowing lawns and babysitting. He spends $5 per week on snacks and movies. How many hours does he need to work to buy the bike, assuming he saves all his earnings except for the weekly expenses?
def solve() -> int: bike_cost = 250 hourly_wage = 12 weekly_expenses = 5 money_to_save = bike_cost - weekly_expenses hours_needed = money_to_save / hourly_wage result = f'Ben needs to work {hours_needed} hours to buy the bike.' result = hours_needed return result
Jackie is training for a race and runs a total of nine miles every day. She starts at a slow pace of 4 mph for three miles. After that, Jackie accelerates and runs at 6 mph for the next four miles. Finishing off her training, she runs the last two miles at 8 mph. How many total hours did Jackie spend running?
def solve() -> int: mph1 = 4 mph2 = 6 mph3 = 8 distance1 = 3 distance2 = 4 distance3 = 2 time1 = distance1 / mph1 time2 = distance2 / mph2 time3 = distance3 / mph3 result = time1 + time2 + time3 return result
A tutor gets 20% of the hourly rate for every student that he tutors and 10% of the hourly rate for every student he refers. If he tutors 5 students at $30 an hour and refers 2 students at $25 an hour, how much does the tutor earn?
def solve() -> int: hourly_rate = 30 num_tutor_students = 5 num_refer_students = 2 refer_hourly_rate = 25 tutor_earnings = hourly_rate * num_tutor_students * 0.2 refer_earnings = refer_hourly_rate * num_refer_students * 0.1 total_earnings = tutor_earnings + refer_earnings ...
David is preparing science experiments for his 10 classmates, who all love learning. Each experiment consists of materials, instructions, and observation sheets. He can gather materials in 25 minutes. It takes him 15 minutes to write instructions. Each observation sheet takes him 5 minutes to prepare. How long will it ...
def solve() -> int: materials_time = 25 instructions_time = 15 observation_time = 5 num_classmates = 10 total_materials_time = materials_time * num_classmates total_instructions_time = instructions_time * num_classmates total_observation_time = observation_time * num_classmates ...
Anastasia is playing football and has run 91 meters. She has run around the pitch 7 times. How many more meters does she have to run to finish the 8th lap around the pitch?
def solve() -> int: meters_ran = 91 laps_ran = 7 pitch_length = 91 remaining_meters = pitch_length * (laps_ran + 1) - meters_ran result = remaining_meters return result
Sophie drove for 50 kilometers and then cycled an additional 5 kilometers to reach the park. She then drove all the way back home. How many kilometers has Sophie driven in total? At a dog park, Sarah brings 3 frisbees and there are 15 dogs playing. If each dog gets to play with a frisbee once, how many times does Sarah...
def solve() -> int: kilometers_driven = 50 additional_kilometers_cycled = 5 total_kilometers_driven = kilometers_driven + additional_kilometers_cycled kilometers_per_day = total_kilometers_driven * 2 days_per_week = 7 weeks_per_month = 4 total_kilometers_per_month = kilometers_per_day *...
Student: Emma has a box of card decks, one-fourth are blue, one-fifth are green, one-fourth are pink, and the rest are yellow. She had 20 blue decks, 12 green decks, and 15 pink decks. How many yellow decks are in the box?
def solve() -> int: blue_decks = 20 green_decks = 12 pink_decks = 15 total_decks = blue_decks + green_decks + pink_decks yellow_decks = total_decks - (blue_decks + green_decks + pink_decks) result = yellow_decks return result
Kevin is 6 feet, 5 inches tall. He is wearing a hat that adds 4 inches to his height. How tall is Kevin with the hat on, in feet and inches?
def solve() -> int: kevin_height = 6 * 12 + 5 total_height = kevin_height + 4 feet = total_height // 12 inches = total_height % 12 result = f"{feet} feet, {inches} inches" return result
Liam has 25 dollars and wants to buy cupcakes and candies. Each cupcake costs $3 and each candy costs $0.10. How many candies can he buy with his 25 dollars if he wants 6 cupcakes?
def solve() -> int: cupcake_cost = 6 * 3 remaining_money = 25 - cupcake_cost candy_count = remaining_money // 0.10 result = candy_count return result
A new car cost $22,000. If the car loses 12% of the value each year, what will the value of the car be after 5 years of owning it?
def solve() -> int: initial_price = 22000 rate = 0.12 year = 5 value = initial_price * (1 - rate) ** year result = value return result
Kevin decided to invest some money in a mutual fund. He invested $12,000 and earned 8% simple interest annually. How much would Kevin have earned in 10 years?
def solve() -> int: p = 12000 r = 0.08 t = 10 interest = p * r * t result = p + interest return result
Sophia reads 50 pages per day. If she reads one-third of the pages that her sister reads in a week, how many pages will her sister have read after 4 weeks?
def solve() -> int: sophia_pages_per_day = 50 sister_pages_per_week = (sophia_pages_per_day * 7) / 3 sister_pages_after_4_weeks = sister_pages_per_week * 4 result = sister_pages_after_4_weeks return result
A car dealer offers a discount that's a function of the original price of a car. The discount is given by the formula D = 0.02P^2 - 0.4P + 100, where P is the original price in thousands of dollars and D is the discount in dollars. For example, if the original price is $15,000, the discount is $0.02*15^2 - 0.4*15 + 100...
def solve() -> int: original_price = 25000 discount = None original_price_thousands = original_price / 1000 discount = 0.02 * original_price_thousands**2 - 0.4 * original_price_thousands + 100 result = discount return result
Student: Suzie collects 24 seashells on Monday, Wednesday, and Friday. How many seashells did she collect in total?
def solve() -> int: num_shells = 24 num_days = 3 total_shells = num_shells * num_days result = total_shells return result
A company has revenues of $20,000 and expenses of $15,000. What is the company's profit margin as a percentage?
def solve() -> int: revenues = 20000 expenses = 15000 profit = revenues - expenses profit_margin_percentage = (profit / revenues) * 100 result = profit_margin_percentage return result
Alex discovers his bike tire is flat with 24 nails stuck in it. If Alex can remove 10 nails per minute and his friend can remove 3 nails per minute, how long will it take them to fix the tire?
def solve() -> int: nails_in_tire = 24 alex_rate = 10 friend_rate = 3 total_rate = alex_rate + friend_rate time_taken = nails_in_tire / total_rate result = time_taken return result
A school has 600 students. If 35% of them are boys, how many girls are in the school?
def solve() -> int: total_students = 600 boys_percent = 35 girls_percent = 100 - boys_percent girls = (girls_percent/100) * total_students result = girls return result
A bakery has a sale where all pastries are 30% off the regular price. A croissant normally costs $2.50. How much does it cost during the sale?
def solve() -> int: regular_price = 2.50 percent_off = 30 discount = regular_price * (percent_off / 100) sale_price = regular_price - discount result = sale_price return result
Each customer needs 3 minutes to shop. Each cashier can handle 10 customers per hour. Each store has 5 cashiers. How many customers can each store serve in a day if there are 3 stores?
def solve() -> int: minutes_per_customer = 3 customers_per_hour_per_cashier = 10 number_of_cashiers_per_store = 5 number_of_stores = 3 minutes_per_hour = 60 hours_per_day = 24 customers_per_hour_per_store = customers_per_hour_per_cashier * number_of_cashiers_per_store customers...
In a classroom, there are 30 students and each student has 6 pencils. If 40% of the pencils are broken, how many pencils are still usable?
def solve() -> int: pencils = 30 * 6 broken_pencils = pencils * 0.4 usable_pencils = pencils - broken_pencils result = usable_pencils return result
A jar contains 8 marbles, 4 blue marbles and 4 red marbles. What is the probability of randomly selecting a red marble?
def solve() -> int: total_marbles = 8 red_marbles = 4 result = red_marbles/total_marbles return result
There are 23 students in a class, and they each have to pay $4.50 for a school trip. How much money will the class raise in total?
def solve() -> int: number_of_students = 23 cost_per_student = 4.50 total_cost = number_of_students * cost_per_student result = total_cost return result
Amanda has a basket containing 12 eggs. If she has 4 baskets, each containing 12 eggs, how many eggs does she have in total?
def solve() -> int: eggs_in_one_basket = 12 total_baskets = 5 total_eggs = eggs_in_one_basket * total_baskets result = total_eggs return result
Student: John drives at an average speed of 60 miles per hour. How long will it take him to travel 450 miles?
def solve() -> int: speed = 60 distance = 450 time = distance / speed result = time return result
A car travels 300 miles on 10 gallons of gasoline. How many miles per gallon does the car get?
def solve() -> int: distance = 300 gas = 10 miles_per_gallon = distance / gas result = miles_per_gallon return result
Jackie has a garden with a certain number of flowers. One day, she decided to pick 4 flowers for her friend, and 3 flowers for her sister. The next day, she picked 5 flowers for herself. If, after all the flower-picking, she still has 9 flowers left in her garden, how many flowers were present in her garden initially?
def solve() -> int: initial_flowers = 4 + 3 next_day_flowers = 5 remaining_flowers = 9 total_flowers = initial_flowers + next_day_flowers + remaining_flowers result = total_flowers result return result
A garden bed is a rectangular patch of land 6 yards wide and 20 yards long. What is the length of the side of the square if we want to use the entire land?
def solve() -> int: width = 6 length = 20 area = width * length side_length = area ** 0.5 result = side_length return result
A car's value depreciates by 15% each year. If the car's original value is $25,000, what will be the value of the car after 4 years?
def solve() -> int: original_value = 25000 yearly_depreciation = 0.15 years_passed = 4 new_value = original_value*(1 - yearly_depreciation)**years_passed result = round(new_value) return result
Alex is a delivery driver who needs to deliver 150 packages to different locations. He can deliver one package in 90 seconds. If he has already spent 2 hours and 15 minutes delivering packages, how many minutes does he have left to finish all the deliveries?
def solve() -> int: packages_delivered = 150 time_per_package = 90 time_spent = 2 * 60 + 15 total_time_spent = packages_delivered * time_per_package time_left = total_time_spent - time_spent result = time_left return result
phon bought 6 shirts and 5 pairs of pants. Each shirt costs $19.99 and each pair of pants cost $29.99. How much did Stephon’s purchase cost in total?
def solve() -> int: total_cost = (6 * 19.99) + (5 * 29.99) result = total_cost return result
Jill went to the grocery store to buy some fruits. She bought 5 apples, 3 banana and 2 oranges. If each apple costs 20 cents, each banana costs 15 cents and each orange costs 30 cents, how much did Jill spend on fruits?
def solve() -> int: price_apple = 0.20 price_banana = 0.15 price_orange = 0.30 total_apples = 5 total_bananas = 3 total_oranges = 2 total_cost = (price_apple * total_apples) + (price_banana * total_bananas) + (price_orange * total_oranges) result = total_cost return result
Student: A store is offering a 20% discount on all items in the store. If a dress originally cost $100, what is the new price?
def solve() -> int: original_price = 100 discount = 0.2 discount_amount = original_price * discount new_price = original_price - discount_amount result = new_price return result
Max made 8 bowls of salad and a dozen croutons for his dinner. Each bowl of salad requires twice the amount of dressing as a dozen croutons. Max used 240 grams of dressing to make everything. How many grams of dressing are in one crouton?
def solve() -> int: bowl_of_salad = 8 croutons = 12 dressing_per_bowl = 2 * croutons total_dressing = 240 dressing_per_salad = dressing_per_bowl * bowl_of_salad dressing_per_crouton = dressing_per_salad / (croutons * bowl_of_salad) result = dressing_per_crouton return resu...
Lisa has $150 in her bank account and she wants to buy 2 pairs of shoes costing $35 each and she also wants to purchase a handbag costing $60. How much money will be left from Lisa after the purchase?
def solve() -> int: bank_balance = 150 shoes_cost = 35 shoes_needed = 2 handbag_cost = 60 total_cost = (shoes_cost * shoes_needed) + handbag_cost remaining_money = bank_balance - total_cost result = remaining_money return result
Chris is making a cake for a party, and has to buy 4 oz of flour for $2. How much will 32 oz of flour cost?
def solve() -> int: flour_per_oz = 2 / 4 cost = flour_per_oz * 32 result = cost return result
A recipe for a cake calls for 2 cups of flour, 1 cup of sugar, and 3 eggs. If you want to make half of the recipe, how much flour and sugar do you need?
def solve() -> int: flour_needed = 2 sugar_needed = 1 eggs_needed = 3 num_cakes = 0.5 flour_needed = flour_needed * num_cakes sugar_needed = sugar_needed * num_cakes result = (flour_needed, sugar_needed) return result
A painter needs to make a square canvas whose perimeter is twice as large as a rectangular canvas. If the rectangular canvas has a length of 18 inches and a width of 12 inches, what is the length of one side of the square canvas?
def solve() -> int: rectangular_length = 18 rectangular_width = 12 rectangular_perimeter = 2 * (rectangular_length + rectangular_width) square_perimeter = rectangular_perimeter * 2 square_side = square_perimeter / 4 result = square_side return result
A package contains 8 bottles of orange juice and 6 bottles of grape juice. If Paul wants to take 2 bottles of each type of juice to his picnic, how many bottles of juice can he take?
def solve() -> int: oranges = 8 grapes = 6 bottles_each = 2 total_bottles = (oranges + grapes) // 2 * bottles_each result = total_bottles return result
Linda has a flower garden with 120 roses. She picks 12 roses every day to make bouquets. However, she also plants 4 new roses every day. How many days will it take her to have no roses left in her garden?
def solve() -> int: roses = 120 picked = 12 planted = 4 day = 0 while roses > 0: roses -= picked roses += planted day += 1 result = day return result
Student: A factory produces 2000 items in a day. 40 percent of the items are defective and are discarded. The remaining items are packed in boxes, with 12 items per box. How many boxes are needed to pack the good items?
def solve() -> int: total_items = 2000 defective_rate = 0.4 items_per_box = 12 defective_items = total_items * defective_rate good_items = total_items - defective_items boxes = good_items / items_per_box boxes = round(boxes) result = boxes return result
Mark is a salesman and earns a 6% commission on all the products he sells. In a month, he sold $35,000 worth of products. If he spends 30% of his earnings on food, how much money will he save?
def solve() -> int: total_sales = 35000 commission = total_sales * 0.06 earnings = total_sales + commission food_expenses = earnings * 0.3 savings = earnings - food_expenses result = savings return result
Emily is walking to the grocery store, which is 8 miles away. On the first day, she walks 3 miles. The second day, she walks half as much as the first day, minus 1 mile. On the last day, she walks 4 miles. How many more miles does Emily have to walk to reach the grocery store?
def solve() -> int: distance_to_store = 8 day1_distance = 3 day2_distance = day1_distance / 2 - 1 day3_distance = 4 total_distance = day1_distance + day2_distance + day3_distance remaining_distance = distance_to_store - total_distance result = remaining_distance return res...
Liam made eight times as much money as Sam. Sam spent $11 less than Khan. Khan spent $89. How much money did Liam make?
def solve() -> int: Sam = 89 - 11 Liam = Sam * 8 result = Liam return result
Mark can swim 1/3 of a mile in a day. He wants to swim a total of 2 miles. How many days will it take him to swim 2 miles?
def solve() -> int: distance_per_day = 1/3 total_distance = 2 days = total_distance / distance_per_day result = days return result
ome possible questions and programs are: A piece of fabric was 3 meters long and 2 meters wide. It was cut into 12 equal squares. How much area of fabric was left after 8 squares were used for sewing?
def solve() -> int: original_area = 3 * 2 square_area = original_area / 12 area_used = square_area * 8 area_left = original_area - area_used result = area_left return result
A startup raised $50,000 through crowdfunding. 40% of this amount was invested by a venture capitalist, and the remaining funds were used by the founders to launch their product. If the founders themselves contributed $2,500, how much did the venture capitalist invest?
def solve() -> int: crowdfunding_amount = 50000 venture_capitalist_investment = crowdfunding_amount * 0.4 founders_contribution = 2500 venture_capitalist_investment = crowdfunding_amount * 0.4 remaining_funds = crowdfunding_amount - founders_contribution venture_capitalist_investment = remaining...
ophia has $20 less than six times as much money as Jayden has. If Jayden has $30, how much money does Sophia have?
def solve() -> int: jayden = 30 sophia = (jayden * 6) - 20 result = sophia return result
Student: Amy has 10 more books than James. She has three times as many magazines as books, and twice as many newspapers as magazines. If she has 30 magazines, how many newspapers does she have?
def solve() -> int: books = 0 magazines = 30 newspapers = 0 books = magazines // 3 newspapers = magazines * 2 result = newspapers return result
In a store, a box of chocolates costs $15. If John buys 4 boxes and pays $75, how much change will he receive?
def solve() -> int: box_cost = 15 boxes_bought = 4 total_cost = box_cost * boxes_bought change = 75 - total_cost result = change return result
A chef had 60 onions to prepare for 10 different dishes. If the chef cooked an even number of onions for each dish, how many onions were used for each dish?
def solve() -> int: total_onions = 60 total_dishes = 10 onions_per_dish = total_onions // total_dishes result = onions_per_dish return result
A car travels at a constant speed of 60 miles per hour. If the car drives for 2.5 hours, how far has it traveled?
def solve() -> int: speed = 60 time = 2.5 distance = speed * time result = distance return result
Student: A cake recipe calls for 2 cups of flour, 1 cup of sugar, 3 eggs, and 1/2 cup of butter. How many cakes can you make with 10 cups of flour, 6 cups of sugar, 18 eggs, and 3 cups of butter?
def solve() -> int: flour_per_cake = 2/1 sugar_per_cake = 1/1 eggs_per_cake = 3/1 butter_per_cake = 1/2 cakes_with_flour = 10/flour_per_cake cakes_with_sugar = 6/sugar_per_cake cakes_with_eggs = 18/eggs_per_cake cakes_with_butter = 3/butter_per_cake result = min(cakes_with_flour, cak...
Sarah can run 2 laps around the track in 1 minute. If she runs for 20 minutes, how many laps does she complete?
def solve() -> int: laps_per_minute = 2 total_minutes = 20 total_laps = laps_per_minute * total_minutes result = total_laps return result
Student: A box contained 7 apples. Someone ate 3 of them and put an extra 4 apples in the box. How many apples are currently in the box?
def solve() -> int: initial_apples = 7 apples_eaten = 3 apples_added = 4 result = initial_apples + apples_added - apples_eaten return result
Eric is a landscaper. He's supposed to mow a rectangular park that's 100 yards long and 75 yards wide. If he's supposed to do 6 laps around the park, but skips 1 lap to take a rest, how far does he mow in total?
def solve() -> int: length = 100 width = 75 laps = 6 skipped_laps = 1 lap_distance = 2 * length + 2 * width total_distance = (laps - skipped_laps) * lap_distance result = total_distance return result
Mary went to the bookstore to buy books. Novels cost $7, biographies cost $4, and magazines cost $2. For every 2 books that customers buy, the store offers a $2 discount. Mary buys 5 novels, 3 biographies, and 8 magazines. How much will she pay?
def solve() -> int: novel_price = 7 biography_price = 4 magazine_price = 2 novel_quantity = 5 biography_quantity = 3 magazine_quantity = 8 total_books = novel_quantity + biography_quantity + magazine_quantity discount = (total_books // 2) * 2 total_cost = (novel_q...
Student: A bag of candy weighs 3 pounds. If 5 pieces of candy weigh 1 ounce, how many pieces of candy are in the bag?
def solve() -> int: weight_of_bag = 3 weight_of_candy = 1/16 num_of_candy = weight_of_bag * 16 / weight_of_candy result = num_of_candy return result
If Mike has $500 and spends 60% of it, how much money does he have left?
def solve() -> int: amount_spent = 500 * 0.6 amount_left = 500 - amount_spent result = amount_left return result
Jerry has a total of 91 red balls. He wants to divide them into packs of 13 balls in each pack. How many packs of 13 red balls can Jerry make from these 91 balls?
def solve() -> int: total_num_red_balls = 91 num_of_balls_in_each_pack = 13 total_num_of_packs = total_num_red_balls // num_of_balls_in_each_pack remainder_num_red_balls = total_num_red_balls % num_of_balls_in_each_pack result = total_num_of_packs return result
-Each new question should be **slightly different** from the original given question. Some possible questions are: Lisa bought 80 cupcakes for a party, but 25 percent of them were smashed by accident. She decided to give half of the remaining cupcakes to her friends and keep the rest for herself. How many cupcakes did ...
def solve() -> int: total_cupcakes = 80 percentage_smashed = 25 number_smashed = total_cupcakes * percentage_smashed / 100 number_not_smashed = total_cupcakes - number_smashed percentage_given = 50 number_given = number_not_smashed * percentage_given / 100 number_kept = number_not_smashed - ...
Jenna needs to buy 12 kilograms of oranges for her family. If each orange weighs 0.25 kilograms, how many oranges does Jenna need to buy?
def solve() -> int: weight_needed = 12 weight_per_orange = 0.25 no_of_oranges = weight_needed / weight_per_orange result = no_of_oranges return result
Student: In order to win a science fair, Becca and Joe need to collect at least 600 votes. In Becca’s hometown, there are 45 people and in Joe’s hometown, there are 72 people. How many more votes need to be collected to win?
def solve() -> int: becca_votes = 45 joe_votes = 72 target_votes = 600 total_votes = becca_votes + joe_votes votes_needed = target_votes - total_votes result = votes_needed return result
Elena bought a bottle of shampoo. Each time she washes her hair she needs 1.2 ounces of shampoo. If the bottle contains 32 ounces and a liter is 10 ounces more than the bottle, how many times can Elena wash her hair?
def solve() -> int: bottle_size = 32 liter_size = bottle_size + 10 shampoo_needed = 1.2 total_shampoo_needed = liter_size * shampoo_needed times_wash_hair = bottle_size / total_shampoo_needed result = times_wash_hair return result
Kayla has $72 in 10 dollar bills. She gives away $20 and half as much money to Jennifer. How many more 10 dollar bills does Kayla have than Jennifer?
def solve() -> int: total_10dollar_kayla = 72 // 10 total_10dollar_givenaway = 20 // 10 total_10dollar_jennifer = total_10dollar_givenaway // 2 excess_10dollar_kayla = total_10dollar_kayla - total_10dollar_jennifer result = excess_10dollar_kayla return result
Student: Ha has four times as many apples as Suji. Suji has twice as many apples as Bo. If Bo has 50 apples, how many apples do Ha and Suji have together?
def solve() -> int: bo_apples = 50 suji_apples = bo_apples * 2 ha_apples = suji_apples * 4 total_apples = suji_apples + ha_apples result = total_apples return result
Jason can type 1000 words in 30 minutes and proofread 500 words in 15 minutes. How long will it take him to type 3000 words and proofread a 1000-word essay?
def solve() -> int: typing_speed = 1000 / 30 proofreading_speed = 500 / 15 typing_time = 3000 / typing_speed proofreading_time = 1000 / proofreading_speed total_time = typing_time + proofreading_time result = total_time return result
Cora has 229 cookies and she wants to divide them into 8 equal parts. How many cookies will be in each part?
def solve() -> int: num_of_cookies = 229 partitions = 8 num_each_part = num_of_cookies // partitions result = num_each_part return result
On a test, a student answered 85 questions out of 100 correctly. What percentage of the test did the student pass?
def solve() -> int: total_questions = 100 correctly_answered = 85 percentage = (correctly_answered / total_questions) * 100 result = percentage return result
Tyler bought four packs of gum for his siblings. Each pack has five sticks of gum and costs $1.25. He was charged $1.47 total for tax. How much did Tyler start with if he left with $1.03 in change?
def solve() -> int: packs_of_gum = 4 sticks_per_pack = 5 cost_per_pack = 1.25 total_cost = packs_of_gum * cost_per_pack tax = 1.47 change = 1.03 total_cost_with_tax = total_cost + tax starting_amount = total_cost_with_tax + change result = starting_amount return result
There are 5280 feet in a mile. If you run 5 miles, how many feet did you run?
def solve() -> int: feet_in_a_mile = 5280 miles = 5 feet = feet_in_a_mile * miles result = feet return result
Emily wants to earn some extra cash and her dad offers to pay her $8 per hour of house cleaning. Emily spends 2 hours washing dishes and 1.5 hours dusting the furniture. How much money has she earned?
def solve() -> int: hours_washing_dishes = 2 hours_dusting_furniture = 1.5 hourly_rate = 8 total_hours = hours_washing_dishes + hours_dusting_furniture total_earned = total_hours * hourly_rate result = total_earned return result
Tom has a rectangular garden that has an area of 500 square feet. If the width of the garden is 15 feet, what is the length of the garden?
def solve() -> int: width = 15 area = 500 length = area/width result = length return result
Emma had 15 rolls of wrapping paper and 3 rolls of ribbon for preparing gifts. How many rolls did she have in total?
def solve() -> int: total_rolls = 15 + 3 result = total_rolls return result
A field has an area of 250m squared. If the length is 20m, what is the width of the field?
def solve() -> int: area = 250 length = 20 width = area / length result = width return result
In a class of 50 students, 20 students take both math and science, and 10 students take only math. What percentage of students take science?
def solve() -> int: math_only = 10 math_and_science = 20 total_students = 50 science_only = total_students - (math_only + math_and_science) percentage_science = (science_only + math_and_science) / total_students * 100 result = percentage_science return result
Emma has twice as many cookies as Jamie has. If Jamie has five cookies and Emma has three cookies, how many cookies does Emma have?
def solve() -> int: jamie_cookies = 5 emma_cookies = 3 emma_cookies = jamie_cookies * 2 result = emma_cookies return result
John has 3 times as much money as Lisa. If John has $75, how much money does Lisa have?
def solve() -> int: john_money =... lisa_money =... result =... return result
Sophia went shopping and bought 14 pairs of socks. She had 4 coupons, each offering a discount of 30 cents on a pair of socks. She paid a total of $24. How many cents does a single pair of socks cost?
def solve() -> int: pairs_of_socks = 14 discount_per_coupon = 30 total_paid = 24 total_discount = discount_per_coupon * 4 total_cost = total_paid + total_discount cost_per_pair = total_cost / pairs_of_socks result = cost_per_pair return result
James has four times as many pencils as Olivia has. If Olivia has 6 pencils, how many pencils does James have?
def solve() -> int: olivia_pencils = 6 james_pencils = 4 * olivia_pencils result = james_pencils return result
An ATM machine charges $2 per transaction plus a 3% fee for withdrawals. If Julian withdrew $200, how much money did he get?
def solve() -> int: withdrawal_amount = 200 transaction_fee = 2 withdrawal_fee_percentage = 3 withdrawal_fee = (withdrawal_fee_percentage/100) * withdrawal_amount total_fee = withdrawal_fee + transaction_fee money_received = withdrawal_amount - total_fee result = money_received ...
Eric had ten marbles and he lost three of them. He found two more marbles on the playground. How many more marbles does Eric need to have fifteen marbles?
def solve() -> int: marbles_had = 10 marbles_lost = 3 marbles_found = 2 marbles_needed = 15 marbles_left = marbles_had - marbles_lost marbles_had = marbles_left + marbles_found marbles_needed = marbles_needed - marbles_had result = marbles_needed return result
William is four years older than Olivia. When Olivia turns 30 years old, how old will William be in years?
def solve() -> int: olivia_age = 30 william_age = olivia_age + 4 william_age_in_years = william_age - (olivia_age - 30) result = william_age_in_years return result