question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
If there are 40 students in a class and the ratio of girls to boys is 2:3, how many girls are there in the class?
def solve() -> int: total_students = 40 ratio_girls = 2 ratio_boys = 3 total_ratio = ratio_girls + ratio_boys girls = total_students * (ratio_girls/total_ratio) result = girls return result
Lily wants to paint her bedroom walls, which measure 12m x 10m. Each can of paint covers 7 m² and costs 50 dollars. How many cans of paint will she need to buy and how much will the paint cost in total?
def solve() -> int: length = 12 width = 10 area = width * length paint_area = 7 paint_cost = 50 total_paint = area / paint_area total_cost = total_paint * paint_cost result = (total_paint, total_cost) return result
A cake recipe calls for 2 eggs for every 3 cups of flour. If you have 6 eggs, how much flour do you need to make the cake?
def solve() -> int: eggs = 6 flour_ratio = 2/3 flour_needed = (eggs * flour_ratio) / 2 result = flour_needed return result
Mark spent $21.50 for 2 CDs and 3 books. If one CD cost $7.50 and each book cost the same price, what was the price per book?
def solve() -> int: total_price = 21.50 price_CD = 7.50 total_books = 3 price_all_books = total_price - price_CD price_one_book = price_all_books / total_books result = price_one_book return result
A train travels a distance of 500 km, and initially travels at a speed of 60 km/hr. After traveling 300 km, it increases its speed to 80 km/hr. What is the total time taken for the journey?
def solve() -> int: distance = 500 speed1 = 60 speed2 = 80 distance1 = 300 time1 = distance1 / speed1 time2 = (distance - distance1) / speed2 total_time = time1 + time2 result = total_time return result
William deposited $800 into his bank account each year for the last 4 years. How much is in his current bank account if he started with nothing in his bank account before the 4 years?
def solve() -> int: total = 0 for x in range(1, 5): total = total + 800 result = total return result
At the supermarket, a family wants to buy some apples. Each apple costs $0.85 and they buy 14 in total. It will cost them $11.90. How much will each apple end up costing them?
def solve() -> int: applecost = 0.85 applenum = 14 totalcost = 11.90 result = totalcost / applenum return result
John ran four less than twice as many miles as did Mary. If Mary ran three miles, how many miles did John run?
def solve() -> int: mary_miles = 3 john_miles = 2*mary_miles - 4 result = john_miles return result
Dina drinks 3 cups of water every morning, 2 cups of water every afternoon, and 1 cup of water every evening. How many cups of water does she drink in a week?
def solve() -> int: cups_per_day = 3 + 2 + 1 cups_per_week = cups_per_day * 7 result = cups_per_week return result
5/12 of the bags are red and 7/12 are green. 3/5 of the red bags have three marbles each, and 2/7 of the green bags do. The rest of the bags have two marbles each. If Jack chooses one bag at random, what is the percentage chance he'll get three marbles?
def solve() -> int: red_bags = 5/12 green_bags = 7/12 red_with_three = 3/5 green_with_three = 2/7 prob_three = red_bags * red_with_three + green_bags * green_with_three percent_three = round(prob_three * 100, 2) result = percent_three return result
A pizza has a diameter of 14 inches. What is the circumference of the pizza?
def solve() -> int: diameter = 14 radius = diameter / 2 circumference = 2 * 3.141592 * radius result = circumference return result
Ten students took a math test that had a total of 350 points. Five students score 240 points combined. Emma, Bailey, and Tessa equally scored the rest. How many points did Tessa score?
def solve() -> int: total_points = 350 combined_score = 240 remaining_students = 10 - 5 points_per_student = (total_points - combined_score) / remaining_students tessa_score = points_per_student result = tessa_score return result
Student: A pizza restaurant sells 8 slices of pizza per pizza. If the restaurant sold 24 pizzas, how many slices of pizza were sold in total?
def solve() -> int: pizzas = 24 slices_per_pizza = 8 total_slices = pizzas * slices_per_pizza result = total_slices return result
An office has a total of 180 employees. Of those employees, 40% are male. How many employees are male?
def solve() -> int: total_employees = 180 percent_male = 40 num_male_employees = (percent_male / 100) * total_employees result = num_male_employees return result
Jade has three kinds of polygons. The first one has 3 sides, the second has 6 sides and the third has 8 sides. Each side has a length of 6. What is the total area of the three polygons?
def solve() -> int: side_length = 6 area_triangle = (3**0.5 * side_length ** 2)/4 area_hexagon = 3 * (3**0.5 * (3 * side_length **2))/2 area_octagon = 2 * (1 + 2**0.5)*(side_length**2) total_area = area_triangle + area_hexagon + area_octagon result = total_area return result
Tim wants to buy a new skateboard which costs $120. His parents give him an allowance of $8 a week and he can either save it all up for the skateboard or spend it as he wishes. After 9 weeks, he has spent some of his money on toys and has $40 saved up. How many more weeks does he need to save for the skateboard if he s...
def solve() -> int: weeks_passed = 9 current_savings = 40 target_cost = 120 allowance_per_week = 8 remaining_cost = target_cost - current_savings more_weeks_needed = remaining_cost / allowance_per_week result = more_weeks_needed return result
A car travels at an average speed of 60 miles per hour for 3 hours. How far does it travel?
def solve() -> int: average_speed = 60 number_of_hours_traveled = 3 distance_traveled = average_speed * number_of_hours_traveled result = distance_traveled return result
Jason has 9 spiders and 6 ants. How many animal legs are there in all?
def solve() -> int: spiders = 9 ants = 6 spider_legs = spiders * 8 ant_legs = ants * 6 total_legs = spider_legs + ant_legs result = total_legs return result
A box contains 9 red balls and 11 green balls. If one ball is drawn at random from the box, what is the probability that it will be a red ball?
def solve() -> int: red_balls = 9 green_balls = 11 total_balls = red_balls + green_balls prob_red_ball = red_balls/total_balls result = prob_red_ball return result
Amy saved $35 each month for 7 months and she had to use the 3rd month saving to pay some bills. On the 8th month her uncle gave her some extra money for her to buy a new guitar. If the guitar cost $220, how much money did her uncle give her?
def solve() -> int: result = 0 cash_left = 220 for i in range(1, 8): if (i == 3): cash_left -= 35 else: cash_left += 35 result = cash_left return result
Haley needs to paint a room that is 12 feet tall, 10 feet wide, and 8 feet long. What is the total area she needs to paint?
def solve() -> int: length = 8 width = 10 height = 12 total_area = 2*length*height + 2*width*height + length*width result = total_area return result
A store sells 45 oranges for $18. If a customer buys 10 oranges, how much does it cost?
def solve() -> int: oranges = 45 price = 18 cost_per_orange = price / oranges cost = 10 * cost_per_orange result = cost return result
A rectangular swimming pool measures 20 meters long by 10 meters wide. If the pool has a uniform depth of 2 meters, what is the total volume of the pool in cubic meters?
def solve() -> int: length = 20 width = 10 depth = 2 pool_volume = length * width * depth result = f'<<<{pool_volume}>>>' result = pool_volume return result
On a sunny day, the temperature rises 3 degrees every half hour. If it was 60 degrees at noon, what is the temperature at 3 PM?
def solve() -> int: hours_elapsed = 6 temp_increase = 3 * hours_elapsed temp_at_3PM = 60 + temp_increase result = temp_at_3PM return result
An investment grows 10% every year, starting with an initial value of $5000. How much will it be worth in 5 years?
def solve() -> int: initial_value = 5000 annual_growth_rate = 0.1 num_years = 5 final_value = initial_value * ((1+annual_growth_rate)**num_years) result = final_value return result
Mark wants to buy a dozen roses for his girlfriend. If a dozen roses cost $36.00, what is the cost of each individual rose?
def solve() -> int: cost_of_dozen_roses = 36.00 roses_in_dozen = 12 cost_of_individual_rose = cost_of_dozen_roses / roses_in_dozen result = cost_of_individual_rose return result
A rectangular box is 10cm long, 8cm wide and 12cm high. If the width is multiplied by 2 and the height is multiplied by 3, what will be the new volume of the box?
def solve() -> int: length = 10 width = 8 height = 12 width_multiplier = 2 height_multiplier = 3 new_width = width * width_multiplier new_height = height * height_multiplier new_volume = length * new_width * new_height result = new_volume return result
Ethan is preparing for a science experiment and needs to buy supplies. Each experiment needs 3 beakers, 2 test tubes, and 1 box of litmus paper. If Ethan is planning to do 10 experiments, how many beakers, test tubes, and boxes of litmus paper will he need in total?
def solve() -> int: experiments = 10 beakers_per_experiment = 3 test_tubes_per_experiment = 2 litmus_paper_per_experiment = 1 total_beakers = experiments * beakers_per_experiment total_test_tubes = experiments * test_tubes_per_experiment total_litmus_paper = experiments * litmus_paper_p...
Lena is planning a trip to Paris and needs to exchange some US dollars to euros. The exchange rate is 0.84 euros per dollar and she also pays a 3% commission fee to the currency dealer. She wants to exchange $800. How many euros will she get?
def solve() -> int: dollars = 800 exchange_rate = 0.84 commission_rate = 0.03 euros_before_commission = dollars * exchange_rate commission_fee = euros_before_commission * commission_rate euros_after_commission = euros_before_commission - commission_fee result = euros_af...
Jack has 6 hamsters and 4 guinea pigs. Each hamster has 4 toes on each foot, and each guinea pig has 3 toes on each foot. How many nails does Jack need to cut?
def solve() -> int: num_hamsters = 6 num_guinea_pigs = 4 hamster_nails = 4 * 4 * num_hamsters guinea_pig_nails = 3 * 4 * num_guinea_pigs total_nails = hamster_nails + guinea_pig_nails result = total_nails return result
A car rental agency charges $40 for a day's rental and an additional $0.25 per mile driven. If Mary has a budget of $100 and she wants to rent the car for two days, what is the maximum number of miles she can afford to drive?
def solve() -> int: d = 2 budget = 100 rental_cost = 40 * d available_for_miles = budget - rental_cost max_miles = available_for_miles / 0.25 result = max_miles return result
A recipe calls for 3/4 cups of flour to make 12 muffins. How much flour is needed to make 48 muffins?
def solve() -> int: flour_per_muffin = 3/4 / 12 flour_needed = round(flour_per_muffin * 48, 2) result = flour_needed return result
- Bob buys a pizza and a soda. The pizza cost $12. The soda cost one third as much as the pizza. How much did he pay for everything?
def solve() -> int: soda_cost = 12 / 3 total_cost = 12 + soda_cost result = total_cost return result
A bicycle uses 1 liter of fuel to travel 25 kilometers. Ms. Jackson's bicycle has 0.5 liters in it. How many more liters of fuel does she need to travel 80 kilometers, back and forth?
def solve() -> int: liters_per_kilometer = 1/25 liters_in_bicycle = 0.5 distance = 80 liters_needed = (distance * liters_per_kilometer) - liters_in_bicycle result = liters_needed return result
Possible new questions and python programs are: Amir counted 7 birds sitting on a branch of a tree. He looked through his binoculars and saw 4 more birds flying towards the same tree. Then 3 birds flew away from the branch to join the flying ones. How many birds did Amir see in total?
def solve() -> int: birds_on_branch = 7 birds_flying = 4 birds_flying_away = 3 total_birds = birds_on_branch + birds_flying - birds_flying_away result = total_birds return result
Student: A train travels 60 miles in an hour. How long will it take to travel 180 miles and 300 miles?
def solve() -> int: speed = 60 distance1 = 180 distance2 = 300 time1 = distance1 / speed time2 = distance2 / speed result = None return result
A store is having a 15% off sale. If an item originally costs $80, what is the sale price?
def solve() -> int: discount = 0.15*80 sale_price = 80 - discount result = sale_price return result
Student: At the ice cream parlor, Gavin ordered 3 times more milkshakes than ice cream cones. If he ordered a total of 18 items, how many milkshakes did he order?
def solve() -> int: num_milkshakes = 0 num_ice_cream_cones = 0 total_items = 18 num_ice_cream_cones = total_items / 4 num_milkshakes = num_ice_cream_cones * 3 result = num_milkshakes return result
Alex has 40 nickels. He gives two dimes to his cousin. How many cents does he have left?
def solve() -> int: nickels = 40 dimes = 2 total_cents = nickels * 5 + dimes * 10 remaining_cents = total_cents - dimes * 10 result = remaining_cents return result
The ratio of cars in a parking lot with 4 doors to cars with 5 doors is 2:7. How many cars with 4 doors are in the parking lot if the total number of cars is 140?
def solve() -> int: four_door_number = 2 five_door_number = 7 total_number = 140 four_door_total_number = four_door_number* (total_number / (four_door_number + five_door_number)) result = four_door_total_number return result
A store needs 35 boxes of tissues to make a display, and they have 250 boxes of tissues. How many displays can they make?
def solve() -> int: total_boxes = 250 boxes_per_display = 35 num_displays = total_boxes // boxes_per_display result = num_displays return result
John and his wife go to the hardware store to buy 5kg of nails for a project. Their neighbor asks them to buy an additional 3kg. If they continue the project for two more weeks, how much nails should they buy altogether?
def solve() -> int: nails_needed = 5 additional_nails = 3 total_nails = nails_needed + additional_nails result = total_nails return result
Sarah has a collection of 50 DVDs and 30 VHS tapes. If she wants to pack them in boxes with 7 DVDs and 5 VHS tapes per box, how many boxes does she need?
def solve() -> int: num_DVD = 50 num_VHS = 30 DVD_per_box = 7 VHS_per_box = 5 total_prods_per_box = DVD_per_box + VHS_per_box total_prods = num_DVD + num_VHS total_boxes = total_prods // total_prods_per_box if total_prods % total_prods_per_box!= 0: total_boxes += 1 result = t...
Student: Linna and her family went out for dinner and the bill came out to be $76.00. The family wants to leave a 20% tip. How much should they leave for the tip?
def solve() -> int: bill = 76.00 tip_percentage = 0.2 tip = bill * tip_percentage total = bill + tip result = total - bill return result
A company has two types of employees. The first type earns a salary of $50,000 per year and the second type earns a salary of $80,000 per year. If there are 20 employees in total and the company spent $1,300,000 on salaries last year, how many employees are in the second category?
def solve() -> int: x = 20 y = 50000 z = 80000 total_salary = 1300000 y_total = x - y z_total = x - z z = (total_salary - y*y_total) / (z_total) result = z return result
Olivia walks 2 miles in 30 minutes. How long would it take her to walk 5 miles at the same speed?
def solve() -> int: x =... result =... return result
A teacher marks twice more papers than a student per hour. The teacher marks 48 papers in four hours. If the result of each paper is added to obtain the mark's total, and the student marks 3 papers less than the teacher per hour, calculate the total marks the student will have marked in eight hours.
def solve() -> int: teacher_marks_per_hour = 48 / 4 student_marks_per_hour = teacher_marks_per_hour / 2 - 3 student_marks_in_eight_hours = student_marks_per_hour * 8 result = student_marks_in_eight_hours return result
A university has 400 full-time faculty members. 65 percent of these faculty members are teaching undergraduates while 25 percent are teaching graduate students. How many faculty members are teaching both undergraduates and graduate students?
def solve() -> int: number_of_faculty_members = 400 number_of_ug_faculty = number_of_faculty_members*0.65 number_of_both_faculty = number_of_faculty_members*0.25 result = number_of_ug_faculty + number_of_both_faculty return result
Maria is trying to raise money for a summer trip by selling handmade bracelets. She has collected $100 by selling each bracelet for $5. For every bracelet she makes, she spends $2 on materials. How many bracelets has Maria made so far?
def solve() -> int: bracelet_price = 5 material_cost = 2 total_money = 100 profit_per_bracelet = bracelet_price - material_cost num_bracelets = total_money / profit_per_bracelet result = num_bracelets return result
A bottle of soda costs $2 normally, but is on sale for $1.50. If Emily bought 4 bottles at the sale price, how much did she save in total?
def solve() -> int: normal_price = 2 sale_price = 1.5 num_bottles = 4 saved_per_bottle = normal_price - sale_price total_savings = saved_per_bottle * num_bottles result = total_savings return result
Student: Paige needs 24 bottles of beer for a party. Each box contains 8 bottles. How many boxes does Paige need to buy?
def solve() -> int: bottles_needed = 24 bottles_per_box = 8 boxes_needed = bottles_needed // bottles_per_box result = boxes_needed return result
A car dealership earns a profit of 25% on each car they sell. If they sell a car for $20,000, how much profit do they make?
def solve() -> int: sale_price = 20000 profit_percentage = 0.25 profit = sale_price * profit_percentage result = profit return result
Jake and his friends went fishing at the lake. Jake caught four times as many fish as Sam did. Sam caught half of what Lily did. If Lily caught 24 fish, how many did Jake catch?
def solve() -> int: Lily = 24 Sam = Lily / 2 Jake = Sam * 4 result = Jake return result
Alex saved $10 on Monday. Each day after that, he saved $3 more than the previous day. How much did Alex save in a week?
def solve() -> int: savings = 10 for i in range(6): savings += 3*i result = savings*7 return result
John weighs 180 pounds (lb) and loses 0.5 lb per day. If he began losing weight on Monday, how much will he weigh on Friday?
def solve() -> int: starting_weight = 180 daily_loss = 0.5 days_passed = 4 final_weight = starting_weight - (daily_loss * days_passed) result = final_weight return result
Possible new questions and programs: Jonah bought a new bicycle that can travel 18 miles on a single charge of its battery. He used his bicycle to commute from his home to his school, which is 3 miles away. He also used his bicycle to run some errands after school, which added another 5 miles to his trip. How much batt...
def solve() -> int: total_distance = 3 + 3 + 5 max_distance = 18 battery_life = total_distance / max_distance battery_life_percentage = battery_life * 100 battery_life_percentage = round(battery_life_percentage) result = battery_life_percentage return result
onya needs to buy 100 envelopes for an art project. Each envelope costs $0.50. How much will she need to spend?
def solve() -> int: envelopes = 100 cost_per_envelope = 0.50 total_cost = envelopes * cost_per_envelope result = total_cost return result
A recipe calls for 1 and 1/2 cups of flour, 1/2 cup of sugar, and 1/4 teaspoon of salt. If you want to make a double batch of the recipe, how much of each ingredient do you need?
def solve() -> int: flour = 1.5 sugar = 0.5 salt = 0.25 multiplier = 2 flour_needed = flour * multiplier sugar_needed = sugar * multiplier salt_needed = salt * multiplier result = flour_needed, sugar_needed, salt_needed return result
Student: If a man needs to load 54 boxes of oranges into a truck, and each box weighs 18 kilograms, how many kilograms of oranges does he have to load in total?
def solve() -> int: box_weight = 18 num_boxes = 54 total_weight = box_weight * num_boxes result = total_weight return result
A fish tank initially had 40 liters of water. After 15 liters of water were poured in, the tank was half full. How many liters can it hold when full?
def solve() -> int: half_tank_water = 40 + 15 full_tank_water = 2 * half_tank_water result = full_tank_water return result
Mark ordered 25 game cards at the mall for $20 each. He also bought 5 pencils for $2 each. How much does Mark have to pay in total?
def solve() -> int: cards = 20 pencils = 2 total_cards = cards*25 total_pencils = pencils*5 total = total_cards + total_pencils result = total return result
``` A school has 450 students and 28 teachers. If each teacher has an average of 25 students and 10 classes in a week, how many students the school has in total over the course of a week?
def solve() -> int: num_students = 450 num_teachers = 28 avg_students_per_teacher = 25 num_classes_per_week = 10 total_students_per_week = num_teachers * avg_students_per_teacher * num_classes_per_week total_students_per_week += num_students result = total_students_per_week return res...
Student: A factory produces 6000 toys in a day, but 3/4 of them are defective. How many good toys are produced in a day?
def solve() -> int: total_toys = 6000 defective_toys = 3/4 * total_toys good_toys = total_toys - defective_toys result = good_toys return result
Karen had 18 fewer bags than Philip. If Philip had 64 bags, how many bags did Karen have?
def solve() -> int: num_philip = 64 num_karen = num_philip - 18 result = num_karen return result
Possible new questions: Leila makes candles and sells them at a market. She spends $120 on wax and wicks to make 80 candles. She sells each candle for $7.5 and pays a $10 fee to rent a stall at the market. How much profit does Leila make?
def solve() -> int: revenue = 80 * 7.5 cost = 120 + 10 profit = revenue - cost result = profit return result
Student: Liam needs to buy tiles to cover a rectangular floor that is 15 feet long and 12 feet wide. He finds some square tiles that are 18 inches by 18 inches and cost $4 each, and some rectangular tiles that are 24 inches by 12 inches and cost $3 each. How many more square tiles than rectangular tiles does he need to...
def solve() -> int: floor_length = 15 * 12 floor_width = 12 * 12 square_tile_side = 18 rectangular_tile_length = 24 rectangular_tile_width = 12 floor_area = floor_length * floor_width square_tile_area = square_tile_side ** 2 rectangular_tile_area = rectangular_tile_length * rectan...
If Kevin is walking at a pace of 4 km/hour and walks for 10 hours. How far would he have traveled in total?
def solve() -> int: speed = 4 time = 10 result = speed * time return result
Alex buys books for his friends. He gets a 20% discount on the original price of each book. He buys 5 books that cost $12, $15, $18, $21, and $24 before the discount. He pays a 10% sales tax on the total after the discount. How much does he pay?
def solve() -> int: books = [12, 15, 18, 21, 24] discount = 0.2 tax = 0.1 total_before_discount = sum(books) total_after_discount = total_before_discount * (1 - discount) total_with_tax = total_after_discount * (1 + tax) result = total_with_tax return result
Student: Samantha needs to mow a rectangular lawn that has a length of 20 feet and a width of 10 feet. If she can mow 6 square feet of lawn in 1 minute, how many minutes will it take her to mow the entire lawn?
def solve() -> int: length = 20 width = 10 area = length * width rate = 6 time = area / rate result = time return result
Sarah wants to increase her typing speed by 30 words per minute from her previous typing speed of 60 words a minute. How many words can she type in 15 minutes?
def solve() -> int: previous_typing_speed = 60 increase_speed = 30 time = 15 new_typing_speed = previous_typing_speed + increase_speed words_typed = new_typing_speed * time result = words_typed return result
At a car wash, it costs $5 for a basic wash and $2 for every tire shine. Mark gets a basic wash and 2 tire shines. If he also buys a $3 air freshener, how much does he spend altogether?
def solve() -> int: basic_wash_cost = 5 tire_shine_cost = 2 num_tire_shines = 2 air_freshener_cost = 3 total_cost = basic_wash_cost + (tire_shine_cost * num_tire_shines) + air_freshener_cost result = total_cost return result
A group of 4 friends went out to eat for lunch and got a bill for $90. If they split the bill evenly, how much will each person need to pay?
def solve() -> int: cost_per_person = 90/4 result = cost_per_person return result
Thomas can run 9 laps around the track in 20 minutes, but he didn't finish all of his laps. The next day, he finished the last 3 laps before heading home. How many laps did Thomas run in total?
def solve() -> int: laps_completed = 9 total_laps = laps_completed + 3 result = total_laps return result
The time taken for a person to travel from point A to point B is 2 hours at the speed of 80 km/hr and on the way back, 3 hours at the speed of 60 km/hr. What is the average speed of the person for the whole journey?
def solve() -> int: forward_time = 2 forward_speed = 80 backward_time = 3 backward_speed = 60 total_distance = forward_time*forward_speed + backward_time*backward_speed total_time = forward_time + backward_time avg_speed = total_distance/total_time result = avg_speed return result
Student: A store sells apples for $0.50 each and oranges for $0.75 each. If you buy 4 apples and 3 oranges, how much will you spend in total?
def solve() -> int: apple_price = 0.50 orange_price = 0.75 apple_quantity = 4 orange_quantity = 3 apple_cost = apple_price * apple_quantity orange_cost = orange_price * orange_quantity total_cost = apple_cost + orange_cost result = total_cost return result
Possible new questions and programs are: Marie is making cupcakes for her class party. She has 24 cups of flour, 15 cups of sugar, 12 cups of butter, and 18 eggs. Each batch of cupcakes requires 3 cups of flour, 2 cups of sugar, 1 cup of butter, and 3 eggs, and makes 12 cupcakes. How many more batches of cupcakes can s...
def solve() -> int: flour = 24 sugar = 15 butter = 12 eggs = 18 flour -= 3 * 3 sugar -= 3 * 2 butter -= 3 * 1 eggs -= 3 * 3 flour_batches = flour // 3 sugar_batches = sugar // 2 butter_batches = butter // 1 egg_batches = eggs // 3 min_batches = min(flour_batches, suga...
8. If the yield of a rice field is 24 sacks of rice at the start and increases by 5% after each harvest, what is the total number of sacks of rice after the fourth harvest?
def solve() -> int: total = 24 percentage_increase = 5/100 for i in range(4): total *= (1 + percentage_increase) result = 27.648000000000005 return result
Leah and her sister collected some marbles and put them in a jar. Leah collected 37 marbles and her sister collected 15 more than Leah. The jar had a capacity of 100 marbles and was already half full before they added their marbles. How many marbles, in total, were in the jar after they added their marbles?
def solve() -> int: leah_marbles = 37 sister_marbles = leah_marbles + 15 jar_capacity = 100 jar_initial = jar_capacity / 2 added_marbles = leah_marbles + sister_marbles jar_final = jar_initial + added_marbles result = jar_final return result
Leo is painting a fence that is 15 feet long and 6 feet high. He has a can of paint that can cover 120 square feet. How many cans of paint does he need to paint the fence?
def solve() -> int: fence_length = 15 fence_height = 6 paint_coverage = 120 fence_area = fence_length * fence_height from math import ceil cans_needed = ceil(fence_area / paint_coverage) result = cans_needed return result
A bakery sells 400 pastries a day. If the bakery is open 6 days a week, how many pastries are sold in a week?
def solve() -> int: pastries_in_week = 400 * 6 result = pastries_in_week return result
Noah is buying a new bike for his daily commute. He has to pay a 10% deposit and the remaining balance upon delivery. This year's bike is 40% more expensive than last year's, which cost $400. How much will he have to pay upon delivery, in dollars?
def solve() -> int: last_year_price = 400 this_year_price = last_year_price * 1.4 deposit = this_year_price * 0.1 remaining_balance = this_year_price - deposit result = remaining_balance return result
Lily wants to buy a necklace that costs $25. She has $12 in her piggy bank, and she can earn $2 for every hour of babysitting. How many hours does she need to babysit to buy the necklace?
def solve() -> int: difference = 25 - 12 hours = difference / 2 result = hours return result
Some possible new questions and programs are: Kelly is making fruit salad for a picnic. She has 8 apples, 12 bananas, and 20 oranges. She uses 3 apples, 4 bananas, and 5 oranges for each bowl of fruit salad. How many bowls of fruit salad can she make?
def solve() -> int: fruits_per_bowl = 3 + 4 + 5 total_fruits = 8 + 12 + 20 bowls = total_fruits // fruits_per_bowl result = bowls return result
Leah is painting her room. She needs to paint the four walls and the ceiling. Each wall is 10 feet long and 8 feet high. The ceiling is 10 feet by 10 feet. She can paint 50 square feet with one quart of paint. How many quarts of paint does she need to buy?
def solve() -> int: wall_area = 4 * 10 * 8 ceiling_area = 10 * 10 total_area = wall_area + ceiling_area quarts = total_area / 50 quarts = int(quarts) + 1 result = quarts return result
Student: In a class, 30% of the students got an A, 40% of the students got a B, and the rest got C or below. If there are 25 students in the class, how many got a C or below?
def solve() -> int: percent_A = 0.3 percent_B = 0.4 total_students = 25 num_A = total_students * percent_A num_B = total_students * percent_B num_C_or_below = total_students - num_A - num_B result = num_C_or_below return result
Q3: In a library there are 4 shelves and each shelf has 6 books, how many books are in the library in total?
def solve() -> int: shelves = 4 books_per_shelf = 6 total_books = shelves*books_per_shelf result = total_books return result
If it takes Mary 4 hours to paint a room and John twice as long, how many hours would it take John to paint the same room?
def solve() -> int: mary_time = 4 john_time = mary_time * 2 result = john_time return result
Amanda had 24 cookies. She gave 3/4 of them to her friends. How many cookies does she have left?
def solve() -> int: num_cookies = 24 num_given_away = num_cookies * 3/4 num_remaining_cookies = num_cookies - num_given_away result = num_remaining_cookies return result
Student: Emma baked 12 cakes in four hours. She baked 2 extra cakes in one hour. At what average rate was Emma baking?
def solve() -> int: num_cakes = 12 time_hours = 4 extra_cakes = 2 extra_time = 1 total_cakes = num_cakes + extra_cakes total_time = time_hours + extra_time rate = total_cakes / total_time result = rate return result
A travelling agency has a land tour package that costs $480 for 4 people. If the same package for 8 people has a 20% discount, what is the cost per person?
def solve() -> int: cost_per_person_4_people = 480/4 discount = 0.2 new_cost_8_people = 480*0.8 cost_per_person_8_people = new_cost_8_people/8 result = round(cost_per_person_8_people,2) return result
The price of a dress at H&M is $25, and the cost of a shirt is $15. If Marianne purchased three dresses and two shirts and paid using a $110 bill, calculate the change she received.
def solve() -> int: dress = 25 shirt = 15 dresses_bought = 3 shirts_bought = 2 money_given = 110 total_cost = (dress * dresses_bought) + (shirt * shirts_bought) change = money_given - total_cost result = change return result
A pack of 24 bottles of water costs $12. How much will 100 bottles cost?
def solve() -> int: num_bottles = 100 cost = 12 cost_of_hundred_bottles = num_bottles/24 * cost result = cost_of_hundred_bottles return result
Lucy has some cookies. Lily has 10 more cookies than Lucy. Ethan has 7 fewer cookies than Lily. If Ethan has 26 cookies, how many cookies does Lucy have?
def solve() -> int: lucy_cookies = (26 + 7 - 10) / 2 result = lucy_cookies return result
Blake has 250 books. He puts 50 books in 3 bags and 15 books in one box. How many books are left?
def solve() -> int: num_books = 250 books_bag = 50 books_box = 15 result = num_books - (books_bag * 3 + books_box) return result
A pizza shop sells 100 pizzas every day for $10 each. If they want to reduce their price by 20% and still make the same revenue, how many more pizzas should they sell every day?
def solve() -> int: current_price = 10 current_quantity = 100 percentage_decrease = 20 hundred = 100 new_price = current_price * (1 - percentage_decrease / hundred) revenue = current_price * current_quantity new_quantity = revenue / new_price additional_quantity =...
A jar has 10 red marbles and 15 blue marbles. If someone randomly picks one marble, what is the probability that it will be red?
def solve() -> int: red_marbles = 10 blue_marbles = 15 total_marbles = red_marbles + blue_marbles probability_of_red = red_marbles/total_marbles result = probability_of_red return result
A group of 6 people go to a restaurant and the total bill comes to $84.00. If they want to split the bill evenly, how much should each person pay?
def solve() -> int: num_people = 6 total_bill = 84 each_person_pays = total_bill / num_people result = each_person_pays return result
Leonardo has 5 times as many toy frogs as toy salamanders. If he has 45 toy salamanders, how many toy frogs does he have?
def solve() -> int: salamanders = 45 frogs = salamanders * 5 result = frogs return result
John has a bag of 17 chocolate bars. Each contains 10 pieces, how many pieces of chocolate does John have in total?
def solve() -> int: bars = 17 pieces_per_bar = 10 total_pieces = bars * pieces_per_bar result = total_pieces return result
Tina bought 5 apples for $0.45 each. How much did she pay in total?
def solve() -> int: number_of_apples = 5 cost_each_apple = 0.45 total_cost = number_of_apples * cost_each_apple result = total_cost return result