question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Question X: A student gets paid $20 for every tutoring session he does, and $5 for every hour he spends mowing the lawn. If he does 3 tutoring sessions and mows the lawn for 4 hours, how much money did he earn?
def solve() -> int: tutoring_sessions = 3 tutoring_money = 20 * tutoring_sessions lawn_mowing_hours = 4 lawn_mowing_money = 5 * lawn_mowing_hours total_earnings = tutoring_money + lawn_mowing_money result = total_earnings return result
A store is having a clearance sale. All items are marked down by 25%. If Marc wants to purchase a $40 item, how much will he pay after the discount?
def solve() -> int: item_cost = 40 discount_percent = 0.25 discount_amount = item_cost * discount_percent discounted_price = item_cost - discount_amount result = discounted_price return result
If there are 20 students in a class and the teacher wants to split them into groups of 4, how many groups are there?
def solve() -> int: num_students = 20 group_size = 4 num_groups = num_students//group_size result = num_groups return result
There are 28 students in Mrs. Smith's class, and each student needs 4 pencils. How many pencils does Mrs. Smith need to buy?
def solve() -> int: students = 28 pencils_per_student = 4 total_pencils = students * pencils_per_student result = total_pencils return result
A party has 20 guests. If each guest eats 2 slices of pizza and there are 8 slices in a pizza, how many pizzas are needed?
def solve() -> int: slices_per_person = 2 guests = 20 slices_per_pizza = 8 total_slices = slices_per_person * guests total_pizzas = total_slices / slices_per_pizza result = total_pizzas return result
Student: Brittany is five times as old as Tom and one fourth as old as Patrick. If Patrick is 86, what is their average age?
def solve() -> int: brittany_age = 0 tom_age = 0 patrick_age = 86 brittany_age = tom_age * 5 tom_age = patrick_age / 4 average_age = (brittany_age + tom_age + patrick_age) / 3 result = average_age return result
A rectangle swimming pool is 20 feet long and 15 feet wide. If the pool is filled with water to a depth of 12 feet, how many gallons of water will be needed to fill it?
def solve() -> int: length = 20 width = 15 depth = 12 volume = length*width*depth gallons = volume / 7.48 result = gallons return result
A company makes a 20% profit on the price of a product. If the cost price is $100, what is the selling price?
def solve() -> int: cost_price = 100 percentage_profit = 20 selling_price = cost_price * (1 + percentage_profit/100) result = selling_price return result
A company producing two types of computers, A and B. Each type of computer needs some amount of parts to be produced. A needs 1 motherboard, 2 RAMs, and 1 hard disk. On the other hand, B needs 2 motherboards, 1 RAM, and 2 hard disks. If the company wants to produce 100 computers of type A and 120 computers of type B, h...
def solve() -> int: A_motherboard = 1*100 A_RAM = 2*100 A_harddisk = 1*100 B_motherboard = 2*120 B_RAM = 1*120 B_harddisk = 2*120 total_motherboard = A_motherboard + B_motherboard total_RAM = A_RAM + B_RAM total_harddisk = A_harddisk + B_harddisk result = (total_mo...
Rachel's father is thrice her age and he is turning sixty next year. What is Rachel's age with respect to her father's upcoming birthday?
def solve() -> int: father_age = 60 - 1 rachel_age = father_age / 3 result = rachel_age return result
Student: A road trip takes 6 hours for a distance of 360 miles. If your average speed is 60 miles per hour, how long would it take for a distance of 540 miles?
def solve() -> int: distance = 540 speed = 60 time = distance / speed result = time return result
You have 24 fruits evenly split between apples, oranges and bananas. The price of three apples and 1 orange is equal to $5.00. How much does 1 banana cost?
def solve() -> int: num_fruits = 24 price_apple_orange = 5.00 cost_apple_orange = price_apple_orange / (3 + 1) cost_1_banana = cost_apple_orange * (num_fruits - (3 + 1)) / (num_fruits - (3 + 1)) result = cost_1_banana return result
In the summer, Beth and her friends went to the beach 28 times. Beth went 10 times, while her friends went the rest. How many times did her friends go?
def solve() -> int: totalVisit = 28 bethVisit = 10 friendsVisit = totalVisit - bethVisit result = friendsVisit return result
Mr. Rodriguez planted 400 sunflower seeds in his garden. He harvested 3/5 of them on Monday, half of the remaining on Tuesday and left the rest to grow. If he harvested 1/3 of the remaining flowers on Wednesday, how many sunflowers did he harvest in total?
def solve() -> int: seeds_planted = 400 harvested_monday = seeds_planted * 3/5 remaining_tuesday = seeds_planted - harvested_monday harvested_tuesday = remaining_tuesday * 1/2 remaining_wednesday = remaining_tuesday - harvested_tuesday harvested_wednesday = remaining_wednesday * 1/3 total_ha...
A car travels at a speed of 60 miles per hour. How far will the car travel in 3.5 hours?
def solve() -> int: distance = 60 * 3.5 result = distance return result
Possible questions and programs: A fruit shop charges by weight for the fruits it sells. A customer bought some apples, oranges, and bananas from the shop and paid $12.35. If the apples cost $1.50 per pound, the oranges cost $0.75 per pound, and the bananas cost $0.50 per pound, and the customer bought 5 pounds of appl...
def solve() -> int: apple_price = 1.50 orange_price = 0.75 banana_price = 0.50 apple_weight = 5 orange_weight = 4 banana_weight = 6 total_cost = apple_price * apple_weight + orange_price * orange_weight + banana_price * banana_weight change = 12.35 - total_cost result ...
In a classroom, there are 5 rows with 10 tables on each row. The first row is reserved for the teacher while the second and third rows are for the teacher's assistants and guest speakers. The last two rows are then reserved for the class officers and the rest of the rows are for the students. If only 2/3 of the tables ...
def solve() -> int: num_rows = 5 num_tables_per_row = 10 num_tables_reserved_for_teacher = 10 num_tables_reserved_for_assistants_and_speakers = 20 num_tables_reserved_for_class_officers = 10 num_tables_reserved_for_students = (num_rows * num_tables_per_row) - (num_tables_reserved_for_teacher + n...
A factory produces 540 units every 6 days. How many units can they produce in 25 days?
def solve() -> int: units_per_day = 540 / 6 total_days = 25 total_units = units_per_day * total_days result = total_units return result
A recipe calls for 3/4 cup of sugar for 2 dozen cookies. If you only want to make a half dozen cookies, how much sugar do you need?
def solve() -> int: num_cookies = 0.5 ratio = (3/4)/24 needed_sugar = num_cookies * ratio * 6 result = needed_sugar return result
Joe started jogging 3 miles each day on Monday. By Tuesday, he had run 4 miles and by Wednesday he had run 6 miles. How far did Joe jog on Thursday?
def solve() -> int: Mon = 3 Tue = 0 Wed = 0 Thurs = 0 Tue = Mon + 1 Wed = Tue + 2 Thurs = Wed + 3 result = Thurs return result
A parking garage charges $5 for the first hour, and $1 for each additional hour. Stuart parked his car at 7.30 am and left it at 6.45 pm. How much did he pay?
def solve() -> int: start = 7.5 end = 18.75 hours = end - start if hours > 1: cost = 5 + (hours-1)*1 else: cost = 5 result = f'<<<{cost}>>>' result = cost return result
Student: If Mr Lee has $200 to spend on a set of items, and the items cost $18 each, how many items can he buy?
def solve() -> int: budget = 200 cost = 18 items = budget // cost result = items return result
Student: Mr. Chen bought a new car for $25,000. After driving it for a few years, he wants to sell it. The car's value depreciates by 20% every year. How much would the car be worth after 3 years?
def solve() -> int: car_value = 25000 depreciation_rate = 0.2 car_value = car_value * (1 - depreciation_rate) car_value = car_value * (1 - depreciation_rate) car_value = car_value * (1 - depreciation_rate) result = car_value return result
In a week, Kaylee studies for half the amount of time her brother Sean studies. Their mom, Sarah studies for four times the combined total number of hours Kaylee and Sean study. If Sean studies for 14 hours in a week, how many hours does Sarah study?
def solve() -> int: sean_hours = 14 kaylee_hours = sean_hours / 2 total_hours = sean_hours + kaylee_hours sarah_hours = total_hours * 4 result = sarah_hours return result
Donald and Melania went for a walk. Together, they walked 10 miles. Melania walked half the distance that Donald did. How many miles did Donald walk?
def solve() -> int: donald_distance = 10 melania_distance = donald_distance / 2 result = donald_distance result return result
Mia is baking cookies for her friends. She has a recipe that makes 24 cookies and uses 2 cups of flour, 1 cup of sugar, and 0.5 cup of butter. She wants to make 72 cookies by multiplying the recipe by 3. However, she only has 4 cups of flour, 2.5 cups of sugar, and 1.25 cups of butter. How many cookies can she make wit...
def solve() -> int: cookies = 0 factor_flour = 4 // (2 * 3) factor_sugar = 2.5 // (1 * 3) factor_butter = 1.25 // (0.5 * 3) factor = min(factor_flour, factor_sugar, factor_butter) cookies = cookies + 24 * factor result = cookies return result
A recipe calls for 2 cups of sugar to make 24 cookies. How much sugar is needed to make 108 cookies?
def solve() -> int: cups_of_sugar_per_cookie = 2/24 total_cups_of_sugar = cups_of_sugar_per_cookie * 108 result = total_cups_of_sugar return result
Sarah has $500 in her bank account but she needs to buy groceries for $68.50, pay her phone bill for $75.99, and go out for dinner which will cost her $46.75. After she spends all this money, how much will she have left in her bank account?
def solve() -> int: money_in_bank = 500 groceries = 68.50 phone_bill = 75.99 dinner = 46.75 total_spent = groceries + phone_bill + dinner money_left = money_in_bank - total_spent result = money_left return result
Amy and her friend split the cost of a holiday package. The package costs $3000. How much does Amy need to pay? Julia trains for a marathon. She trains once a day for 5 hours for all but 3 days per week. How many hours does she train in two weeks?
def solve() -> int: package_cost = 3000 amy_share = package_cost / 2 result = amy_share days_per_week = 7 days_without_training = 3 training_days_per_week = days_per_week - days_without_training training_hours_per_day = 5 weeks = 2 total_training_hours = training_days_per_week *...
If 5 pens cost $8, what is the cost of 18 pens?
def solve() -> int: cost_of_5_pens = 8 num_of_pens = 18 cost_of_1_pen = cost_of_5_pens/5 total_cost = cost_of_1_pen * num_of_pens result = total_cost return result
Jake has $32 to spend at the book fair. He wants to buy 4 comic books and 2 novels. Each comic book costs $4 and each novel costs $7. Does Jake have enough money to buy all the books he wants? If not, how much more money does he need?
def solve() -> int: money = 32 comic_price = 4 novel_price = 7 comic_quantity = 4 novel_quantity = 2 total_cost = (comic_price * comic_quantity) + (novel_price * novel_quantity) if total_cost <= money: result = "Yes, Jake has enough money to buy all the books he wants"...
Mia is at the flower shop. She has a total of $50 to spend. She is going to buy a bouquet of roses that costs $15, a vase that costs $10, and a card that costs $5. She wants to buy carnations that are $1 each. With her remaining money, how many carnations can she buy?
def solve() -> int: total = 50 roses = 15 vase = 10 card = 5 carnation = 1 spent = roses + vase + card left = total - spent carnations = int(left / carnation) result = carnations return result
Peter wants to sell his guitar for $800. His friend offers to buy it from him, but only for half the price. If Peter agrees, how much will he get for the guitar?
def solve() -> int: price = 800 half_price = price / 2 result = half_price return result
A company has 5 machines, each producing 100 units per hour. If the machines operate for 8 hours each day, how many units are produced in a day?
def solve() -> int: num_machines = 5 units_per_hour = 100 num_hours = 8 total_units = num_machines * units_per_hour * num_hours result = total_units return result
A store has an item on sale for 30% off. The original price of the item was $80. If Sofie paid with a gift card worth $60 and paid the remaining with cash, how much cash did she have to pay?
def solve() -> int: original_price = 80 discount = 0.30 gift_card = 60 new_price = original_price - (original_price * discount) remaining_price = new_price - gift_card result = remaining_price return result
A landscaping company charges $25 per hour of work they do. They have a contract with a homeowner to maintain their yard for 10 hours every month. If they also do an additional 5 hours of work at the same property during the month, how much money will they make?
def solve() -> int: hourly_rate = 25 monthly_hours = 10 extra_hours = 5 total_hours = monthly_hours + extra_hours total_income = total_hours * hourly_rate result = total_income return result
Ben's starting weight was 50 pounds. He began training and was able to add 175 pounds to his lift. He then found a magical amulet that increased his strength by 600%. What can he lift now?
def solve() -> int: start_weight = 50 added_weight = 175 strength_increase = 600 total_weight = start_weight + added_weight final_weight = total_weight * (1 + strength_increase/100) result = final_weight return result
Bob is selling lemonade at a fair. He bought 20 lemons for $10 and 10 cups of sugar for $5. He can make 40 cups of lemonade with 10 lemons and 5 cups of sugar. He sells each cup of lemonade for $1. How much profit does Bob make after selling all his lemonade?
def solve() -> int: lemon_cost = 10 / 20 sugar_cost = 5 / 10 ingredient_cost = (lemon_cost * 10) + (sugar_cost * 5) revenue = 40 * 1 profit = revenue - ingredient_cost result = profit return result
A bag contains 5 red balls, 7 blue balls and 4 yellow balls. If one ball is chosen at random, what is the probability of selecting a blue ball?
def solve() -> int: total_balls = 5 + 7 + 4 blue_balls = 7 probability = blue_balls / total_balls result = probability return result
There are 365 days in a year. What portion of the year is 3 months equal to?
def solve() -> int: year = 365 months = 3 portion = months * (1/12) result = portion return result
A triangle has a base of 6cm and a height of 4cm. What is the area of the triangle?
def solve() -> int: base = 6 height = 4 area = 0.5 * base * height result = area return result
The length of a rectangle is twice the width. The area of the rectangle is 192sq units. What is the perimeter of the rectangle?
def solve() -> int: area_of_rectangle = 192 width = (area_of_rectangle/2) ** 0.5 length = 2 * width perimeter = 2 * (length + width) result = perimeter return result
A store sells 3 different kinds of apples. The price per pound for each type of apples is as follows: type A: $1.50, type B: $2, type C: $3. If 2 pounds of type A apples, 3 pounds of type B apples, and 1 pound of type C apples are purchased, what is the total cost?
def solve() -> int: cost_a = 1.5 * 2 cost_b = 2 * 3 cost_c = 3 * 1 total_cost = cost_a + cost_b + cost_c result = total_cost return result
A cylindrical tank has a radius of 5 meters and a height of 10 meters. What is the volume of the tank?
def solve() -> int: radius = 5 height = 10 pi = 3.14 volume = pi * radius**2 * height result = volume return result
Alex is sorting his stamp collection. 15% of his stamps are from the United States, 40% are from European countries, and 45% are from other countries. If Alex has 60 European stamps, how many other country stamps does he have?
def solve() -> int: european_stamps = 60 other_country_stamps = (european_stamps / 40) * 45 result = other_country_stamps return result
Minnie has a garden and plants 5 cucumber plants. This year, she has chosen to give away 5 more plants than cucumber plants. After that, she plants 4 zucchini plants. If she gives away twice the amount of plants as cucumber plants, how many plants did Minnie plant in total?
def solve() -> int: cucumber_plants = 5 give_away = 5 + cucumber_plants zucchini_plants = 4 give_away_part2 = cucumber_plants * 2 result = cucumber_plants + give_away + zucchini_plants + give_away_part2 return result
Student: A donut shop sells 1200 donuts a day for $1 each. If the shop is open 6 days a week, how much money does the shop make in a year?
def solve() -> int: donuts_per_day = 1200 price_per_donut = 1 days_open_per_week = 6 total_donuts_sold_per_year = donuts_per_day * days_open_per_week * 52 total_money_made_per_year = total_donuts_sold_per_year * price_per_donut result = total_money_made_per_year return result
A bookstore gives a 10% discount on all books. If a book costs $25, how much will be the discount?
def solve() -> int: book_price = 25 discount = book_price * 0.1 result = discount return result
A bicycle tire has a circumference of 66 inches, and a car tire has twice the circumference of the bicycle tire. What is the circumference of the car tire in feet? Sara has a rectangular garden that measures 20 meters by 30 meters. If 1 square meter can grow 3 kilograms of tomatoes, and 1 kilogram of tomatoes sells for...
def solve() -> int: bicycle_circumference = 66 car_circumference = bicycle_circumference * 2 car_circumference_in_feet = car_circumference / 12 garden_length = 20 garden_width = 30 garden_area = garden_length * garden_width tomatoes_weight = garden_area * 3 money_earned = ...
A truck driver was carrying 78 apples, he gave 30% of them away and then split the remaining apples equally among 9 people. How many apples did each person get?
def solve() -> int: num = 78 remaining = num * (3/10) result = (num - remaining) / 9 return result
Jeff bought 6 papers, 4 calculators and 2 boards for $360. The papers cost 1/2 price of one calculator, and the boards cost 1/6 price of one calculator. Find the total price of the papers.
def solve() -> int: price_calculator = 360 / (6 + 4 + 2) price_papers = price_calculator * 0.5 * 6 total_price = price_papers result = total_price return result
At a restaurant, there are 10 guests and every guest will eat 2 burgers and 3 chips. How many burgers and chips have to be ordered in total?
def solve() -> int: num_of_guests = 10 num_of_burgers_per_guest = 2 num_of_chips_per_guest = 3 total_burgers = num_of_guests * num_of_burgers_per_guest total_chips = num_of_guests * num_of_chips_per_guest result = (total_burgers, total_chips) return result
If 3 tops and 4 skirts cost $180, and 4 tops and 6 skirts cost $240, how much will 2 tops and 2 skirts cost?
def solve() -> int: x, y = 2, 2 eq1 = (3*x) + (4*y) - 180 eq2 = (4*x) + (6*y) - 240 req = 2*x + 2*y result = abs(req) return result
Student: Maria went shopping for clothes. She spent $150 on a dress and $80 on a blouse. If she used a coupon that gave her a 25% discount on the dress, how much did she spend in total?
def solve() -> int: dress = 150 blouse = 80 coupon = 0.25 discounted_dress = dress * (1 - coupon) total = discounted_dress + blouse result = total return result
Jack is a runner who wants to challenge himself physically. He tries to run at least 20 kilometers in one week. Every third week he runs four times that distance. If he meets his goal, how many kilometers will he run in one year?
def solve() -> int: weeks_in_year = 52 goal_distance = 20 extra_distance_multiplier = 4 total_distance = 0 for week in range(1, weeks_in_year + 1): if week % 3 == 0: total_distance += goal_distance * extra_distance_multiplier else: total_distance += ...
Student: Ali wants to buy two chocolate bars, a bag of chips, and a bag of cookies. Each chocolate bar costs 50 cents, each bag of chips costs 75 cents, and each bag of cookies costs 25 cents. How much will Ali have to pay in total?
def solve() -> int: chocolate_bar_price = 0.50 bag_of_chips_price = 0.75 bag_of_cookies_price = 0.25 total_price = (2 * chocolate_bar_price) + bag_of_chips_price + bag_of_cookies_price result = total_price return result
A town had 10,000 people in 2020. In 2021, the population increased by 15% and in 2022 it increased by an additional 10%. How many people live in that town in 2022?
def solve() -> int: population_2020 = 10000 population_2021 = population_2020 + (0.15 * population_2020) population_2022 = population_2021 + (0.10 * population_2021) result = population_2022 return result
If a recipe calls for 2 cups of flour, 1 cup of sugar, and 3 eggs, and each cup of flour costs $1.50, each cup of sugar costs $2, and each egg costs 20 cents, what is the total cost of these ingredients?
def solve() -> int: flour_cost = 2 * 1.50 sugar_cost = 1 * 2 egg_cost = 3 * 0.20 total_cost = flour_cost + sugar_cost + egg_cost result = total_cost return result
A car travels 180 miles in 3 hours. If it maintains the same speed, how long will it take to travel 270 miles?
def solve() -> int: distance = 270 speed = 180/3 time = distance / speed result = time return result
A toy was on sale for 20% off. Instead of buying the toy, Jack bought a similar toy at the original price of $24. How much more expensive was the second toy compared to the first?
def solve() -> int: original_price = 24 discount_rate = 0.2 discounted_price = original_price * (1 - discount_rate) price_difference = original_price - discounted_price result = price_difference return result
A number is increased by 40% and the result is decreased by 30%. If the final result is 84, what was the original number?
def solve() -> int: final_result = 84 result_after_increase = final_result / (1 - 0.3) original_number = result_after_increase / (1 + 0.4) result = original_number return result
A rectangular field is 50 meters long and 30 meters wide. What is the perimeter of the field?
def solve() -> int: length = 50 width = 30 perimeter = 2 * (length + width) result = perimeter return result
A map has a scale of 1 inch = 5 miles. If two cities are 3 1/2 inches apart on the map, how far are they from each other in real life (in miles)?
def solve() -> int: inch_distance = 3.5 miles_per_inch = 5 miles_distance = inch_distance * miles_per_inch result = miles_distance return result
If Karen bought 8 dresses, which is double the number of dresses that Amanda has, and Lily has 6 times the number of dresses that Amanda has, how many dresses does Lily have?
def solve() -> int: amanda_dresses = 8 / 2 karen_dresses = 8 lily_dresses = 6 * amanda_dresses result = lily_dresses return result
Student: Jane had $50 in her wallet. She spent 25% of it on dinner and then received an additional $20 from her friend. How much money does she have now?
def solve() -> int: wallet = 50 dinner = wallet * 0.25 friend = 20 result = wallet - dinner + friend return result
Student: Katie has 4 sets of markers. Each set contains 6 markers of different colors. She has lost 2 markers from each set but wants to keep the remaining markers. How many markers does Katie have now?
def solve() -> int: num_sets = 4 num_markers_per_set = 6 num_markers_lost_per_set = 2 num_markers_remaining = (num_sets * num_markers_per_set) - (num_sets * num_markers_lost_per_set) result = num_markers_remaining return result
A school has 360 students and 12 classrooms. Each classroom can fit 30 students. How many classrooms are full, and how many students are in the last classroom?
def solve() -> int: students = 360 classrooms = 12 capacity = 30 classrooms_full = int(students / capacity) students_last = students % capacity result = (classrooms_full, students_last) return result
John needs to make 16 sandwiches but he has 50 slices of bacon and 70 slices of cheese. How many of each ingredient does he need for each sandwich?
def solve() -> int: sandwiches = 16 bacon = 50 cheese = 70 bacon_per_sandwich = bacon/sandwiches cheese_per_sandwich = cheese/sandwiches result = bacon_per_sandwich + cheese_per_sandwich return result
If John has 4 rabbits, and he wants to feed them a combination of carrots, lettuce and cabbage in a 3 : 2 : 1 ratio, how many pounds of food will he need in total if he feeds each rabbit the same amount?
def solve() -> int: rabbits = 4 carrots_ratio = 3 lettuce_ratio = 2 cabbage_ratio = 1 total_ratio = carrots_ratio + lettuce_ratio + cabbage_ratio carrots_needed = (carrots_ratio / total_ratio) * rabbits lettuce_needed = (lettuce_ratio / total_ratio) * rabbits cabbage_needed = (...
A train travels at a constant speed of 90 km/h for 3 hours. It then stops for 15 minutes and resumes at a constant speed of 80 km/h for 2 hours. How far does the train travel in total?
def solve() -> int: distance_1 = 90 * 3 distance_2 = 80 * 2 total_distance = distance_1 + distance_2 result = total_distance return result
Max has a vegetable garden. He has 30 tomato plants and five times as many bean plants. A neighbor tells him they will buy all of his vegetables and pay $3 for each tomato and $0.50 for each bean. How much money would Max earn if he sells all of his vegetables?
def solve() -> int: tomato_plants = 30 bean_plants = 5 * tomato_plants tomato_price = 3 bean_price = 0.50 total_tomato_money = tomato_plants * tomato_price total_bean_money = bean_plants * bean_price total_money = total_tomato_money + total_bean_money result = total_m...
A music streaming service costs $9.99 per month. How much would it cost to subscribe for 2 years (24 months)?
def solve() -> int: monthly_cost = 9.99 months_in_2_years = 24 total_cost = monthly_cost * months_in_2_years result = total_cost return result
Tom buys 5 boxes of shoes. Each box contains 12 pairs of shoes. How many shoes does he buy?
def solve() -> int: total_shoes = 5 * 12 * 2 result = total_shoes return result
A zoo has 75 meerkats and 9 times as many raccoons. How many raccoons are there?
def solve() -> int: number_of_meerkats = 75 ratio = 9 number_of_racoons = number_of_meerkats * ratio result = number_of_racoons return result
A farmer has 50 cows. If she sells 8 cows and buys 15 more cows, how many cows will she have in total?
def solve() -> int: cows = 50 cows -= 8 cows += 15 result = cows return result
If a box has dimensions of 6 inches by 12 inches by 8 inches, what is the volume of the box in cubic inches?
def solve() -> int: box_length = 6 box_width = 12 box_height = 8 box_volume = box_length * box_width * box_height result = box_volume return result
Lisa needs to get dressed, then help her two cousins get ready for a family photo. If it takes Lisa 8 minutes to get dressed and two minutes longer to assist each cousin, how long does it take them to all get ready?
def solve() -> int: Lisa = 8 cousin_time = 2 total_time = Lisa + (2 * cousin_time) result = total_time return result
A grocery store has 500 items. 60% of them are fruits and vegetables and the rest are groceries. If the store adds 50 new items and 80% of them are groceries, what percentage of the items are groceries now?
def solve() -> int: total_items = 500 fruit_veg_items = total_items * 0.6 grocery_items = total_items - fruit_veg_items new_items = 50 new_grocery_items = new_items * 0.8 new_total_items = total_items + new_items new_grocery_percentage = (grocery_items + new_grocery_items) / new_to...
Honda and Woods split a sum of money in the ratio 1:8. If Honda got $200 (which is the smaller share), how much did they share?
def solve() -> int: ratio = 1/8 share = 200/1 * 8/1 result = share return result
Student: Liam is making sandwiches for a picnic. He wants 25% of the sandwiches to have cucumber, 1/4 to have tomatoes, and the rest to have both cucumber and tomatoes. If he uses 3 cucumber slices per sandwich with cucumber, and makes 32 sandwiches, how many cucumber slices does he need?
def solve() -> int: num_sandwiches = 32 cucumber_percentage = 0.25 tomato_percentage = 0.25 cucumber_slices_per_sandwich = 3 num_cucumber_sandwiches = num_sandwiches * cucumber_percentage num_tomato_sandwiches = num_sandwiches * tomato_percentage num_both_sandwiches = num_sandwiches - num_cu...
The perimeter of a square is 32 meters. What is the length of one side of the square?
def solve() -> int: perimeter = 32 side_length = perimeter / 4 result = side_length return result
Joe needs to save up $200 for a new phone. He has already saved up $50. If Joe saves $30 every week, how many weeks will it take him to save up the remaining $150?
def solve() -> int: initial_amount = 50 target_amount = 200 amount_left = target_amount - initial_amount saving_amount = 30 num_weeks = amount_left / saving_amount result = num_weeks return result
A bakery sold 60 croissants and chocolate croissants combined and 2/5 of them were chocolate croissants. How many chocolate croissants did they sell?
def solve() -> int: total_croissants = 60 num_of_chocolate_croissants = total_croissants * 2 / 5 result = num_of_chocolate_croissants return result
Emily needed to rent a bicycle for a month while visiting a new city. The bike was worth $500 and the rental fee was 5% of its value per week. Her sister agreed to pay 30% of the rental fee. How much did Emily pay?
def solve() -> int: bike_value = 500 rental_fee_per_week = bike_value * 0.05 rental_fee_per_month = rental_fee_per_week * 4 sister_contribution = rental_fee_per_month * 0.3 emily_payment = rental_fee_per_month - sister_contribution result = emily_payment return result
A company has 300 employees. If 40% are female, and 20% of the employees are managers, how many male managers are there in the company?
def solve() -> int: total_employees = 300 females = 0.4 * total_employees males = total_employees - females managers = 0.2 * total_employees male_managers = 0.8 * managers result = male_managers return result
Max and Lisa are sorting their books by genre. They have 36 books in total, and they want to divide them into 4 equal piles. However, they have different preferences for genres, and they want to keep the books they like the most. Max likes fantasy and science fiction books, and Lisa likes mystery and romance books. The...
def solve() -> int: fantasy = 12 science_fiction = 9 mystery = 9 romance = 6 max_fantasy = 0 max_science_fiction = 0 lisa_mystery = 0 lisa_romance = 0 for i in range(9): if fantasy > 0: max_fantasy += 1 fantasy -= 1 else: max_science_fiction += 1 ...
Student: A car can drive for 500 miles on 50 gallons of fuel. How many miles can it drive on 20 gallons of fuel?
def solve() -> int: miles_on_50_gallons = 500 gallons_used = 50 miles_per_gallon = miles_on_50_gallons / gallons_used gallons_used = 20 result = miles_per_gallon * gallons_used return result
-Some possible new questions and python programs are: Lara has 12 friends and a third are boys. Her friends who are girls like to play soccer with her. How many girls play soccer with her?
def solve() -> int: boys = 12 / 3 girls = 12 - boys soccer_girls = girls * 1 result = soccer_girls return result
If Cole had twice as many coins as Chase, and Chase had 12 coins, which of the boys have more coins?
def solve() -> int: Cole_coins = 0 Chase_coins = 12 Cole_coins = Chase_coins * 2 if (Cole_coins > Chase_coins): result = "Cole has more coins" else: result = "Chase has more coins" return result
Student: A company sells 1000 pens for $150. If they sell 2000 pens, how much revenue will they make?
def solve() -> int: num_pens = 2000 price_per_pen = 150 total_revenue = num_pens * price_per_pen result = total_revenue return result
Rachel has $500. She wants to buy a new camera and a set of lenses. The camera she chooses costs $350, while the lens costs $50 each. How many lenses can she buy if she wants to spend no more than $500?
def solve() -> int: camera_price = 350 lens_price = 50 total_amount = 500 remaining_amount = total_amount - camera_price num_of_lenses = remaining_amount // lens_price result = num_of_lenses return result
Mark has 5 pairs of pants, 3 shirts, and 7 ties. He wants to have eight times the number of individual items in his wardrobe. How many more items does Mark need to buy?
def solve() -> int: pants = 5 shirts = 3 ties = 7 total_items = (2 * pants) + shirts + ties items_needed = (8 * total_items) - ((2 * pants) + shirts + ties) result = items_needed return result
A recipe calls for 2 cups of sugar to make 12 servings of cake. How much sugar is needed to make 20 servings?
def solve() -> int: sugar_per_serving = 2/12 needed_servings = 20 total_sugar = sugar_per_serving * needed_servings result = total_sugar return result
Daniel uses 2 cups of flour per pizza to make his homemade pizza dough. He has a bag of flour that is 5 pounds and there are 20 servings of flour per pound. How many pizzas can Daniel make with one bag of flour?
def solve() -> int: flour_per_pizza = 2 bag_of_flour = 5 servings_per_pound = 20 total_servings = bag_of_flour * servings_per_pound total_pizzas = total_servings // flour_per_pizza result = total_pizzas return result
A bakery has 200 slices of bread, 500 chocolate chips, and 75 bagels available for their customers. If they want to divide them equally among 25 customers, how many of each item will each customer get?
def solve() -> int: bread_slices = 200 chocolate_chips = 500 bagels = 75 customers = 25 bread_per_customer = bread_slices // customers chocolate_chips_per_customer = chocolate_chips // customers bagels_per_customer = bagels // customers result = f'{bread_per_customer}, {chocola...
A train travels 500 miles in 5 hours. What is the average speed of the train in miles per hour?
def solve() -> int: distance = 500 time = 5 average_speed = distance / time result = average_speed return result
A rectangle has a length of 12 units and an area of 48 square units. What is the width of the rectangle?
def solve() -> int: length = 12 area = 48 width = area/length result = width return result
Rachel loves lilies and tulips. She planted 60 lily bulbs and 30 tulip bulbs in her garden. If 80% of the lily bulbs germinate, and 70% of the tulip bulbs germinate, and 75% of the resulting plants produce flowers, how many plants will she grow that produce flowers?
def solve() -> int: lily_bulbs = 60 tulip_bulbs = 30 lily_germination_rate = 0.8 tulip_germination_rate = 0.7 flower_production_rate = 0.75 lily_plants = lily_bulbs * lily_germination_rate tulip_plants = tulip_bulbs * tulip_germination_rate total_plants = lily_plants ...
A farmer has a rectangular plot of land with an area of 2400 sq. meters. If the length of the plot is 4 times the width, what are the dimensions of the plot?
def solve() -> int: area = 2400 width = 20 length = 4*width result = (length, width) return result
There are 15 tables in a restaurant and each table is set with 4 chairs. If the restaurant has a capacity of 70 people, what percentage of the tables is occupied when there are 50 people in the restaurant?
def solve() -> int: tables = 15 chairs_per_table = 4 capacity = 70 people = 50 total_chairs = tables * chairs_per_table occupied_chairs = people occupied_tables = occupied_chairs // chairs_per_table percentage_occupied_tables = (occupied_tables / tables) * 100 result =...