question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Daniel has eleven turtles. Each turtle needs 1/2 cup of lettuce and 1/4 cup of turtle food pellets twice a day, and 1 small piece of tomato once a day. How much food does Daniel need to feed his turtles for 7 days?
def solve() -> int: turtles = 11 lettuce_per_turtle = 1/2 pellets_per_turtle = 1/4 tomato_per_turtle = 1 lettuce_needed = turtles * lettuce_per_turtle * 2 * 7 pellets_needed = turtles * pellets_per_turtle * 2 * 7 tomato_needed = turtles * tomato_per_turtle * 7 total_food_needed...
Coco went on a road trip and drove a total of 450 miles. He stopped for gas 3 times and each fill-up cost $45. Including the cost of gas, how much did Coco spend on his road trip?
def solve() -> int: num_fillups = 3 fillup_cost = 45 gas_price = 2.50 gas_used_per_mile = 0.03 miles_driven = 450 total_gas = miles_driven * gas_used_per_mile total_cost_of_gas = total_gas * gas_price total_cost_of_fillups = num_fillups * fillup_cost total_cost = total_cost_of_g...
A box of chocolates is on sale for $10. If the regular price is $12, what is the discount percentage?
def solve() -> int: original_price = 12 discounted_price = 10 percent_off = (original_price - discounted_price) / original_price * 100 result = percent_off return result
san has 10 apples and shares them equally between 5 people. Each person decides to chop their apples into 4 pieces. How many apple pieces are there in total?
def solve() -> int: apples = 10 people = 5 pieces_per_apple = 4 total_pieces = apples * pieces_per_apple * people result = total_pieces return result
A car rental agency offers two different rates per day: - $35 per day plus $0.20 per mile driven. - $60 per day with unlimited mileage. John drove 200 miles. Which rate is cheaper for him?
def solve() -> int: m = 200 rate1 = 35 + 0.2 * m rate2 = 60 if rate1 < rate2: result = rate1 else: result = rate2 return result
A recipe calls for 2/3 cup of flour to make 12 cookies. How many cups of flour are needed to make 48 cookies?
def solve() -> int: cookies_per_flour = 12 flour_required_for_cookies = 2/3 cookies_desired = 48 flour_required = (flour_required_for_cookies*cookies_desired) / cookies_per_flour result = flour_required return result
There are 91 children playing in the park. 28 are playing hide and seek, 29 are playing tag and the rest are playing soccer. How many children are playing soccer?
def solve() -> int: totalChildren = 91 playingHideAndSeek = 28 playingTag = 29 result = totalChildren - (playingHideAndSeek + playingTag) return result
Kevin buys 4 dozen donuts for $18, 2 gallons of orange juice for $6 each, and 3 boxes of coffee for $12 each. He hosts a breakfast meeting for 24 people and serves them equal amounts of donuts, juice, and coffee. How much does he spend per person, rounded to the nearest cent?
def solve() -> int: total_spending = 18 + (6 * 2) + (12 * 3) donuts_per_person = (4 * 12) / 24 juice_per_person = (2 * 128) / 24 coffee_per_person = (3 * 64) / 24 donuts_cost_per_person = 0.375 * donuts_per_person juice_cost_per_person = 0.046875 * juice_per_person coffee_cost_per_...
Lisa has $20. She spends 4 times as much as Ben, who spends $6. How much money does Lisa have left?
def solve() -> int: ben = 6 lisa = ben*4 lisa_left = lisa - ben result = lisa_left return result
Liam’s family wants to buy 6 different hats. Each hat costs $18 and Liam paid using a $200 bill. If the cashier gave Liam only $10 and $2 bills for his change, how many bills did Liam receive?
def solve() -> int: cash = 200 hats = 6 price = 18 total_cost = hats * price change = cash - total_cost tens = change // 10 twos = (change % 10) // 2 result = tens + twos return result
A smartphone battery has a number of charges that can last for 500 hours, but after four-fifths of the hours, the battery was only left with 100 hours. How long can the battery last daily?
def solve() -> int: total_hours = 500 remaining_hours = 100 used_hours = total_hours - remaining_hours fraction_used = used_hours / total_hours fraction_left = 1 - fraction_used daily_hours = fraction_left * total_hours / (total_hours * 4 / 5) result = daily_hours return result...
If a train travels 60 miles per hour, how many miles will it travel in 3 hours and 15 minutes?
def solve() -> int: time_in_hours = 3.25 speed_in_mph = 60 distance = speed_in_mph * time_in_hours result = distance return result
A football team played 16 games and won 10 of them. What percentage of games did they win? What percentage of games did they lose? What is the difference in percentage points between the percentage of games won and percentage of games lost?
def solve() -> int: total_games = 16 wins = 10 losses = total_games - wins win_percent = wins / total_games * 100 loss_percent = losses / total_games * 100 diff_percent = abs(win_percent - loss_percent) result = diff_percent return result
Ms. Taylor is interested in purchasing a new couch for $1,200 cash or $300 down payment and $60 a month for 24 months. How much can she save by paying cash?
def solve() -> int: price_cash = 1200 down_payment = 300 monthly_payment = 60 num_months = 24 total_price_installments = down_payment + (monthly_payment * num_months) total_savings = total_price_installments - price_cash result = total_savings return result
Melanie has a square shaped garden that is 10 feet per side. She adds a circular pond in the center that now has a diameter of 8 feet, then builds 2 more identical gardens. How much area does she have?
def solve() -> int: side_length = 10 diameter = 8 radius = diameter/2 square_area = side_length * side_length circle_area = 3.14 * radius * radius total_area = 3 * (square_area - circle_area) result = total_area return result
The perimeter of a rectangle is 42 cm and its width is 7 cm. What is the length of the rectangle?
def solve() -> int: length = (42-2*7)/2 result = length return result
If it takes 2/3 yard of fabric to make a dress, how many dresses can be made with 18 yards of fabric?
def solve() -> int: amount_of_fabric_per_dress = 2/3 total_amount_of_fabric = 18 num_of_dresses = total_amount_of_fabric / amount_of_fabric_per_dress result = num_of_dresses return result
A softball team has 11 players. There are twice as many outfielders as infielders. How many outfielders are on the team?
def solve() -> int: total_players = 11 infielders = total_players / 3 outfielders = infielders * 2 result = outfielders return result
Henry, William, and Benjamin are comparing their book collections. Henry has 50 books, which is 25% of William's book collection. Benjamin has twice as many books as William. How many books do all of the friends have?
def solve() -> int: williams_books = 50 / 0.25 benjamins_books = 2 * williams_books total_books = 50 + williams_books + benjamins_books result = total_books return result
Julia can drink 15 boxes of milk during weekdays, and 9 boxes of milk during Saturday, and 12 boxes of milk during Sunday. How much more does she drink per month on weekdays than the whole weekend?
def solve() -> int: total_milk_weekdays = 15 total_milk_saturday = 9 total_milk_sunday = 12 total_milk_per_week_weekdays = total_milk_weekdays * 4 total_milk_per_week_saturday_sunday = (total_milk_saturday + total_milk_sunday) * 8 number_more = total_milk_per_week_weekdays - total_mi...
Student: A recipe calls for 2/3 cups of milk. If you want to make twice the recipe, how many cups of milk will you need?
def solve() -> int: milk_one = 2/3 scale = 2 milk_two = milk_one * scale result = milk_two return result
Samantha agreed with her aunt that she would earn six cents for every bean she picked in their garden. There are eleven beans in the east row, fourteen in the center row, and twenty-two in the west row. Samantha picked all the beans in the east and center row, and half of the beans in the west row. She bought a soda fo...
def solve() -> int: east_row = 11 center_row = 14 west_row = 22 total_beans = east_row + center_row + west_row beans_picked = east_row + center_row + west_row/2 earnings = beans_picked * 6 soda_cost = 99 cents_left = earnings - soda_cost result = cents_left re...
At a zoo, there were eleven monkeys climbing on the tree. Seven more monkeys came and then four monkeys left. How many monkeys were left on the tree?
def solve() -> int: monkeys_on_tree = 11 monkeys_came = 7 monkeys_left = 4 total_monkeys = monkeys_on_tree + monkeys_came remaining_monkeys = total_monkeys - monkeys_left result = remaining_monkeys return result
A truck is travelling east at a speed of 50 miles per hour. A car is travelling north at a speed of 25 miles per hour, and it is 30 miles away from the truck at the start. How long, in hours, will it take for the car and truck to reach the same location?
def solve() -> int: truck_speed = 50 car_speed = 25 distance = 30 time_truck = distance / truck_speed time_car = distance / car_speed total_time = time_truck + time_car result = total_time return result
Greg has a monthly salary of $2,500. If he spends 45% of his salary on rent and utilities and saves 12% of his salary, how much money does he have left to spend for the month?
def solve() -> int: salary = 2500 rent_and_utilities_percent = 0.45 savings_percent = 0.12 rent_and_utilities_cost = salary*rent_and_utilities_percent savings_amount = salary*savings_percent money_left = salary - (rent_and_utilities_cost + savings_amount) result = money_left r...
Student: Anna bought seven t-shirts for $18 each and three pairs of jeans for $45 each. How much did she spend in total?
def solve() -> int: tshirt_price = 18 tshirt_quantity = 7 jeans_price = 45 jeans_quantity = 3 tshirt_cost = tshirt_price * tshirt_quantity jeans_cost = jeans_price * jeans_quantity total_cost = tshirt_cost + jeans_cost result = total_cost return result
A company produced 250 units of a product in a day. If each unit is sold for $3.50, what is the total revenue generated in a day?
def solve() -> int: units = 250 price = 3.50 revenue = units * price result = revenue return result
A tutoring center charges $30 per hour for tutoring. If a student spends an average of 14 hours per week, how much does the student need to pay per week for tutoring?
def solve() -> int: hourly_rate = 30 weekly_hours = 14 weekly_cost = hourly_rate * weekly_hours result = weekly_cost return result
Melody and Harmony practice piano for the same amount of time every day. Melody plays 32 songs in one hour, while Harmony plays 24 songs in one hour. How many songs do they play together in 15 minutes?
def solve() -> int: melody_rate = 32 / 60 harmony_rate = 24 / 60 time = 15 melody_songs = melody_rate * time harmony_songs = harmony_rate * time total_songs = melody_songs + harmony_songs result = total_songs return result
A box contains 150 candies. If Michael eats 10% of the candies. How many candies are left in the box?
def solve() -> int: total_candies = 150 eaten_candies = total_candies * 0.1 remaining_candies = total_candies - eaten_candies result = remaining_candies return result
Student: A car travels 300 km in 4 hours. What is the average speed of the car in km/hour?
def solve() -> int: distance = 300 time = 4 speed = distance / time result = speed return result
A store sells ice cream at $3 per scoop. How much will 8 scoops cost after a 7.5% tax is applied?
def solve() -> int: price_per_scoop = 3 scoops = 8 sub_total = price_per_scoop * scoops tax_rate = 0.075 total = sub_total * (1 + tax_rate) result = total return result
A monkey picks 30 bananas every day. If a banana weighs 150 grams, and you need to eat 2kg of bananas every day to survive, how many monkeys would it take to provide enough bananas for you?
def solve() -> int: num_bananas_needed = 2000 num_bananas_per_day = 30 single_banana_weight = 150 monkeys_needed = num_bananas_needed/(num_bananas_per_day*single_banana_weight) result = monkeys_needed return result
Andrew uses 5 nickels, 2 dimes, and 4 quarters to buy a video game that costs $5.45. How much change does he receive?
def solve() -> int: nickels = 5 dimes = 2 quarters = 4 total_value = (nickels * 0.05) + (dimes * 0.1) + (quarters * 0.25) cost = 5.45 change = total_value - cost result = round(change, 2) return result
**** How many 4-sided shapes can be formed using 5 lines?
def solve() -> int: number_of_shapes_with_4_sides = 0 for number_of_lines in range(6): combination_total = 1 for new_lines in range(number_of_lines): combination_total *= 4 - new_lines number_of_shapes_with_4_sides += combination_total result = number_of_shapes_with_4_si...
On Monday, John has 25 marbles. On Tuesday, he loses three-quarters of them. On Wednesday, he finds 18 new marbles. On Thursday, he buys one-third of what he lost on Tuesday. How many marbles does he have on Thursday?
def solve() -> int: marbles_on_monday = 25 marbles_on_tuesday = marbles_on_monday * (1 - 3/4) marbles_on_wednesday = marbles_on_tuesday + 18 marbles_bought_on_thursday = marbles_on_tuesday * (1/3) marbles_on_thursday = marbles_on_wednesday + marbles_bought_on_thursday result = marbles_on_th...
In order to reach his daily calorie-burn goal, David wants to burn a total of 900 calories in a week. On the first day, he burned 100 calories. On each subsequent day, he increased his calorie burn by 20 calories over the previous day. If he burns calories for 5 days a week, how many calories did he burn on the 5th day...
def solve() -> int: calories_burned_first_day = 100 calories_burned_per_day_increase = 20 days_per_week = 5 calories_burned_fifth_day = calories_burned_first_day + (days_per_week - 1) * calories_burned_per_day_increase result = calories_burned_fifth_day return result
In a town of 10,000 people, one-quarter of them are children. Of the children, one-third eat breakfast at the local diner. If there are 2250 adults in the town, how many children eat breakfast at the local diner? Rita has 15 books, 7 pencils, 3 notebooks, and 8 folders. If she wants to double the number of individual i...
def solve() -> int: total_people = 10000 children_ratio = 1/4 adults = 2250 children = total_people * children_ratio children_eating_breakfast = children * 1/3 result = children_eating_breakfast books = 15 pencils = 7 notebooks = 3 folders = 8 total_items ...
and Libby ate dinner together at their local diner. Sue had a three-course meal that cost $21. Libby had a two-course meal that cost $14. How much did each course of the meals cost if the total cost was shared equally between them?
def solve() -> int: amount_per_course = (21 + 14) / 5 result = amount_per_course return result
Lisa has a piece of ribbon that is 120 cm long. She wants to cut it into smaller pieces, each 15 cm long. How many pieces can she cut and how much ribbon will be left over?
def solve() -> int: pieces = 120 / 15 pieces = int(pieces) leftover = 120 - (pieces * 15) result = (pieces, leftover) return result
A pizza has 8 slices. James ate 3 slices and Jessica ate 2 slices. How many slices are left?
def solve() -> int: total_slices = 8 james_slices = 3 jessica_slices = 2 slices_left = total_slices - (james_slices + jessica_slices) result = slices_left return result
A cone has a diameter of 7m and a height of 4m. What is the volume of the cone?
def solve() -> int: diameter = 7 height = 4 pi = 3.14 volume = 1/3 * pi * diameter * diameter * height result = volume return result
Tyler can lift 200 pounds every hour while working out. After 5 hours, how many pounds has he lifted if he drops and loses 25 pounds?
def solve() -> int: lift_per_hour = 200 hours_worked = 5 weight_lost = 25 total_lifted = lift_per_hour * hours_worked - weight_lost result = total_lifted return result
Bella baked cupcakes for her classmates and put them in a big box. She made 120 cupcakes and divided them equally among 20 students. However, when she opened the box at school, she saw that there were only 112 cupcakes left. Bella thinks it was Charlie who sneaked into her kitchen and ate some cupcakes. If all the othe...
def solve() -> int: cupcakes_per_student = 120 // 20 cupcakes_missing = 120 - 112 charlie_cupcakes = cupcakes_missing - cupcakes_per_student result = charlie_cupcakes return result
Bryce is mixing a cocktail that's 40% vodka, 30% cranberry juice, and the rest orange juice. If he uses 12 ounces of cranberry juice, how much orange juice does he add?
def solve() -> int: cranberry_juice = 12 vodka = 0.4 * cranberry_juice orange_juice = 1 - 0.4 - 0.3 orange_juice *= cranberry_juice result = orange_juice return result
Sophia has 10 apples. Mia has 11 times as many apples as Sophia but 6 fewer apples than Edward. How many apples do they all have together?
def solve() -> int: sophia_apples = 10 mia_apples = 11 * sophia_apples edward_apples = mia_apples + 6 total_apples = sophia_apples + mia_apples + edward_apples result = total_apples return result
David is making a stew that requires 8 cups of chicken stock. He has a 1/4 measuring cup. If he has a 22 cup jug of chicken stock, how many scoops should he remove to get the exact amount he needs?
def solve() -> int: jug_stock = 22 required_stock = 8 measuring_cup = 1/4 total_scoops = jug_stock / measuring_cup scoops_to_remove = total_scoops - required_stock result = scoops_to_remove return result
A car rental service charges $30 per day for a compact car, and $50 per day for a luxury car. A couple plans to rent a car for a week. They have a budget of $300. What is the maximum number of days they can rent a luxury car?
def solve() -> int: compact_car_price = 30 luxury_car_price = 50 budget = 300 max_compact_days = budget // compact_car_price max_luxury_days = budget // luxury_car_price if max_luxury_days > max_compact_days: max_luxury_days = max_compact_days result = max_luxury_...
Jacob, Mia, and Olivia went fishing. Jacob caught 18 fish and Mia caught 10 less than Jacob. Olivia caught one-third of the total number of fish caught by Jacob and Mia. If they sold each fish for $6 and split the earnings equally, how much would each person make?
def solve() -> int: jacob_fish = 18 mia_fish = jacob_fish - 10 total_fish = jacob_fish + mia_fish olivia_fish = total_fish / 3 total_earnings = total_fish * 6 each_person_earnings = total_earnings / 3 result = each_person_earnings return result
Lily invested $10,000 in a stock that gained 7% over the year. If she sells the stock after 12 months, how much profit did she make?
def solve() -> int: investment = 10000 gain_percentage = 7 gain_amount = investment * (gain_percentage/100) selling_price = investment + gain_amount profit = selling_price - investment result = profit return result
Emma, Fiona and Sarah are cooking a cake. Emma has 4/5 the number of ingredients Fiona has, and Fiona has 5 times the number of ingredients Sarah has. If Sarah has 5 ingredients, how many ingredients do all of them have altogether?
def solve() -> int: emma = 0 fiona = 0 sarah = 5 fiona = sarah * 5 emma = fiona * 4 / 5 total = sarah + fiona + emma result = total return result
If Sarah needs 3 cups of chocolate chips and 2 cups of sugar to make a batch of cookies that makes 36 cookies, and she wants to make 72 cookies, and at the grocery store 3 cups of chocolate chips cost $4.50 and 2 cups of sugar cost $1.25, how much will it cost her to make 72 cookies?
def solve() -> int: chocolate_chips_per_batch = 3 sugar_per_batch = 2 cookies_per_batch = 36 desired_cookies = 72 chocolate_chips_cost = 4.50 / 3 sugar_cost = 1.25 / 2 total_chocolate_chips = (chocolate_chips_per_batch / cookies_per_batch) * desired_cookies total_sugar = (sugar_per_...
5. Mandy is on a trip with her friends. They travelled 88 miles on the first day, 77 miles on the second day and 101 miles on the third day. How many miles have they travelled in total?
def solve() -> int: total = 0 total = total + 88 total = total + 77 total = total + 101 result = 266 return result
A train travels at a speed of 60 miles per hour. How far can it travel in 3 hours?
def solve() -> int: speed = 60 time = 3 distance = speed*time result = distance return result
Student: A bookstore sells pencils for $0.50 each, markers for $1.50 each, and notebooks for $3 each. If Karen bought 3 pencils, 2 markers, and 1 notebook, what is the total amount she spent?
def solve() -> int: pencils = 3 markers = 2 notebooks = 1 total_amount = pencils * 0.50 + markers * 1.50 + notebooks * 3 result = total_amount return result
A teacher can grade 10 papers in an hour. From Monday to Friday, the teacher works for 7 hours each day, and on Sunday, she only works for 4 hours. How many papers can the teacher grade in a week?
def solve() -> int: papers_per_hour = 10 hours_per_weekday = 7 hours_on_sunday = 4 papers_per_weekday = papers_per_hour * hours_per_weekday papers_on_sunday = papers_per_hour * hours_on_sunday total_papers = papers_per_weekday * 5 + papers_on_sunday result = total_papers r...
Q2: Mary is baking a cake and needs to make a strawberry frosting. The frosting recipe calls for 1.7 cups of sugar for every 2 cups of strawberry puree. To make the frosting, she has 2 cups of puree. How many cups of sugar does she need for the frosting?
def solve() -> int: puree = 2 ratio = 1.7/2 sugar = puree * ratio result = sugar return result
Student: Two friends, Jane and Tom, decide to take a 50-kilometer bike ride. If Jane can bike at 15 km/hour and Tom can bike at 18 km/hour, how many kilometers ahead will Tom be when Jane reaches the finish line?
def solve() -> int: distance = 50 jane_time = distance / 15 tom_distance = jane_time * 18 ahead_distance = tom_distance - distance result = ahead_distance return result
A pizza restaurant is offering a special deal where customers can buy a pizza and get a second one for half off. If a pizza normally costs $10, what is the total cost if a customer buys 3 pizzas?
def solve() -> int: pizza_cost = 10 discount = 0.5 total_pizzas = 3 total_cost = (total_pizzas - total_pizzas // 2) * pizza_cost * (1 - discount) + (total_pizzas // 2) * pizza_cost result = total_cost return result
A company brings in $500,000 in revenue each year and has expenses of $350,000. If they increase their revenue by 10%, and their expenses by 8%, what will their new profit be?
def solve() -> int: revenue = 500000 expense = 350000 revenue_increase_percent = 0.1 expense_increase_percent = 0.08 new_revenue = revenue * (1 + revenue_increase_percent) new_expense = expense * (1 + expense_increase_percent) profit = new_revenue - new_expense result = profit retur...
Elena bought a shirt and a pair of jeans at a clothing store. The shirt was 25% off and the jeans were 40% off. The original prices of the shirt and the jeans were $20 and $30 respectively. How much did Elena save in total?
def solve() -> int: shirt_discount = 0.25 jeans_discount = 0.4 shirt_original = 20 jeans_original = 30 shirt_discounted = shirt_original * (1 - shirt_discount) jeans_discounted = jeans_original * (1 - jeans_discount) total_price = shirt_discounted + jeans_discounted total_saving = (shirt...
A rectangular box has a length of 8cm, a width of 10cm and height of 12cm. What is the total surface area of the box?
def solve() -> int: length = 8 width = 10 height = 12 total_surface_area = 2*(length*width) + 2*(width*height) + 2*(length*height) result = total_surface_area return result
Lisa is studying for a test that requires reading 500 pages. She can read 25 pages in 30 minutes. If she has already read 200 pages, how many more minutes will it take for her to finish the book?
def solve() -> int: total_pages = 500 - 200 pages_per_minute = 25 / 30 time_in_minutes = total_pages / pages_per_minute result = time_in_minutes return result
A group of twelve rabbits sat in a field. Half of the original group of rabbits joined a new group of rabbits in the field, creating a larger group. Suddenly, one-quarter of the larger group were scared away by a hawk. How many rabbits remained in the field?
def solve() -> int: original_group = 12 new_group = original_group / 2 larger_group = original_group + new_group scared_away = larger_group / 4 remaining_rabbits = larger_group - scared_away result = remaining_rabbits return result
Jacob is swimming in a rectangular pool. The pool is 28 meters long and 15 meters wide. How much space in total can Jacob swim if 1 cubic meter is equal to 1000 liters?
def solve() -> int: surface_area = 28 * 15 volume = surface_area * 1 liters = volume * 1000 result = liters return result
Student: A box contains 30 pencils. If Kimberly takes 4 pencils from the box, how many pencils are left in it?
def solve() -> int: pencils = 30 taken = 4 pencils = pencils - taken result = pencils return result
Possible math questions and Python programs: Kira decided to order some books online and found 8 different titles that she liked. She added 3 books to her cart and noticed that each book had a 20% discount. Then she added 2 more books that had a 30% discount each. She removed one book from her cart that had a 20% disco...
def solve() -> int: books_20 = 3 books_30 = 2 books_40 = 1 discount_20 = 0.2 discount_30 = 0.3 discount_40 = 0.4 price = 15 price_20 = books_20 * price * (1 - discount_20) price_30 = books_30 * price * (1 - discount_30) price_40 = books_40 * price * (1 ...
Jack has to catch a flight that leaves at 12:00 p.m. He always takes 1 hour to reach the airport from his home. One day he woke up late and left his home at 11:00 a.m. How much time did he miss the flight by when he reached the airport?
def solve() -> int: departure_time = 12 travel_time = 1 late_departure_time = 11 time_missed = departure_time - (late_departure_time + travel_time) result = time_missed return result
A train runs 360 km in 9 hours. If it had run at 40 km/h more than the actual speed, it would have taken 1 hour less. What is the actual speed of the train?
def solve() -> int: distance = 360 actual_speed = distance/9 faster_speed = actual_speed + 40/9 actual_time = distance/actual_speed faster_time = distance/faster_speed result = actual_speed return result
In a market, there is a basket containing 30 pieces of fruits. Out of these, 2/3 of the fruits are apples. How many apples are there in the basket?
def solve() -> int: total_fruits = 30 portion_of_apples = 2/3 apples = total_fruits * portion_of_apples result = int(apples) return result
Sophia has 9 pencils and 12 pens. She buys four times as many markers as the number of pencils she currently has, then loses one of the pens. How many writing utensils does she have left?
def solve() -> int: pencils = 9 pens = 12 markers = 4 * pencils pens -= 1 total = pencils + pens + markers result = total return result
Student: On Sunday, Sam and Alex go to the park. Sam drove 5 miles to the park and Alex drove 6 miles to the park. How many miles total did they drive?
def solve() -> int: sam_distance = 5 alex_distance = 6 total_distance = sam_distance + alex_distance result = total_distance return result
Student: Regan earns $20 for every 10 hours worked. How much will she earn if she works 25 hours?
def solve() -> int: hours_worked = 25 rate_per_10_hours = 20 total_amount_earned = (hours_worked // 10) * rate_per_10_hours remaining_hours = hours_worked % 10 amount_earned_for_remaining_hours = remaining_hours * (rate_per_10_hours / 10) result = total_amount_earned + amount_earned_for_remainin...
Student: A recipe calls for 3 cups of flour, but you only have a 1/4 measuring cup. How many 1/4 cups of flour will you need?
def solve() -> int: flour_needed = 3 measuring_cup = 1/4 measuring_cups_needed = flour_needed / measuring_cup result = measuring_cups_needed return result
Q7: Sam purchases a bicycle for $188.87 plus 7% sales tax. How much does Sam pay in total?
def solve() -> int: price_of_bike = 188.87 sales_tax_rate = 0.07 total_cost = price_of_bike * (1 + sales_tax_rate) result = total_cost return result
In a classroom, 90% of the 40 pens were used, 1/3rd of the 30 pencils were used, and half of the 20 erasers were used. How many stationery items are still available in the classroom?
def solve() -> int: pens = 40 pencils = 30 erasers = 20 used_pens = pens * 0.9 used_pencils = pencils * (1/3) used_erasers = erasers * 0.5 available_pens = pens - used_pens available_pencils = pencils - used_pencils available_erasers = erasers - used_erasers result...
Student: There are 96 pencils in a box. If 6 pencils are used, what percentage of pencils are left in the box?
def solve() -> int: total_pencils = 96 used_pencils = 6 left_pencils = total_pencils - used_pencils percentage = (left_pencils / total_pencils) * 100 result = percentage return result
Four roommates were comparing their ages based on their birth month. They found out that Rachel is 3 months younger than Emily while Emily is 9 months older than Alex. Then, John is 5 months older than Alex. How much younger in months is Rachel than John?
def solve() -> int: rachel_age_diff = -3 emily_age_diff = -rachel_age_diff alex_age_diff = -9 john_age_diff = alex_age_diff + 5 rachel_john_age_diff = rachel_age_diff - john_age_diff result = abs(rachel_john_age_diff) return result
A bakery ordered 200kg of flour, but only received 150kg. What percentage of the ordered flour did the bakery receive?
def solve() -> int: ordered = 200 received = 150 percent_received = received / ordered * 100 result = percent_received return result
When Emily signed up for a gym membership, she received a free fitness consultation. For every friend she refers, she will receive a 1-month membership extension and her friend will receive half off their first month. If Emily referred 10 friends, how many months of extension will she receive?
def solve() -> int: friends_referred = 10 extension_per_friend = 1 total_extension = friends_referred * extension_per_friend result = total_extension return result
A diner enters a restaurant and orders a meal and a drink. The meal costs x dollars, and the drink costs 5 dollars. The total cost of the order, including tax, is $18. If the tax rate is 8%, what is the value of x?
def solve() -> int: drinkPrice = 5 totalPrice = 18 taxPercent = 0.08 taxAmount = totalPrice* taxPercent mealPrice = (totalPrice - taxAmount - drinkPrice) result = mealPrice return result
Hanif buys 7 boxes of chocolates. Every box has 15 chocolates in it but when he opened one of the boxes, he found out that 3 extra chocolates were in it. How many chocolates did Hanif buy in total?
def solve() -> int: num_boxes = 7 chocolates_per_box = 15 extra_chocolates = 3 total_chocolates = num_boxes * chocolates_per_box + extra_chocolates result = total_chocolates return result
Student: Nancy orders $2500 worth of books from an online store. She gets a 10% discount for buying more than 20 books. She decides to return 3 books that cost $50 each and exchange 2 books that cost $80 each for 2 books that cost $100 each. She also sells one book that cost 15% less than the average cost of the books ...
def solve() -> int: total_cost = 2500 discount_rate = 0.1 num_books = total_cost / 50 return_cost = 50 exchange_cost = 80 new_cost = 100 sell_rate = 0.6 discount_factor = 0.85 total_cost = total_cost * (1 - discount_rate) total_cost = total_cost - return_cost * 3 tota...
idney and Clyde went to a grocery store and bought 15 items. Sidney paid $236 and Clyde paid $184. How much did they spend in total?
def solve() -> int: total = 0 total = total + 236 total = total + 184 result = total return result
Ms. Kim divided her class into groups of 4 for a project. She gave each group a pack of 24 stickers to decorate their posters. If each group used 18 stickers, and the number of stickers left over was equal to the number of groups, how many students were in her class?
def solve() -> int: x = 1 y = 6 * x y = 6 y == x False x = 2 y = 6 * x y = 12 y == x False x = 3 y = 6 * x y = 18 y == x False x = 4 y = 6 * x y = 24 y == x True groups = x leftover = y students = groups * ...
Student: A delivery truck can carry 20 boxes and each box contains 50 packets. If the truck is fully loaded, how many packets are being transported?
def solve() -> int: boxes = 20 packets_per_box = 50 packets = boxes * packets_per_box result = packets return result
Carla's three-headed dog has 2 times as many teeth as heads, and 6 times as many ears as teeth. How many more ears does the dog have than the combined number of teeth and heads?
def solve() -> int: heads = 3 teeth = heads * 2 ears = teeth * 6 difference = ears - (teeth + heads) result = difference return result
A swimming pool has a volume of 400 cubic meters. If the pool is in the shape of a rectangular prism with dimensions 8 meters by 10 meters by x meters, what is the value of x?
def solve() -> int: pool_volume = 400 length = 8 width = 10 height = pool_volume / (length * width) result = height return result
Student: -Below are 10 possible new questions and python programs to solve them.
def solve() -> int: num1 = 1 num2 = 2 num3 = 3 num4 = 4 num5 = 5 num6 = 6 num7 = 7 num8 = 8 num9 = 9 num10 = 10 result = num1 + num2 + num3 + num4 + num5 + num6 + num7 + num8 + num9 + num10 num1 = 1 num2 = 2 num3 = 3 num4 = 4 num5 = 5 result = num1 * n...
Student: Jane earns $14 per hour and works 35 hours a week. How much does she earn in one week?
def solve() -> int: hourly_rate = 14 weekly_hours = 35 weekly_earnings = hourly_rate * weekly_hours result = weekly_earnings return result
A 10kg watermelon costs $10. How much would a 15kg watermelon cost?
def solve() -> int: watermelon_weight = 10 watermelon_cost = 10 cost_per_kg = watermelon_cost/watermelon_weight new_weight = 15 new_cost = new_weight * cost_per_kg result = new_cost return result
There are 6 red dots and 4 blue dots. What is the ratio of blue dots to red dots?
def solve() -> int: r = 6 b = 4 ratio = b/r result = ratio return result
A company spends 15% of its budget on advertising, 30% on rent, and 25% on salaries. If their budget is $100,000, how much money is left after expenses?
def solve() -> int: total_budget = 100000 advertising_percentage = 0.15 rent_percentage = 0.30 salaries_percentage = 0.25 expenses = total_budget * (advertising_percentage + rent_percentage + salaries_percentage) remaining_budget = total_budget - expenses result = remaining_budget retur...
Ryan had a collection of 240 sports cards. He wanted to arrange them in a rectangular display case that had 8 rows. How many cards did he need to put in each row?
def solve() -> int: cards_per_row = 240 / 8 result = cards_per_row return result
The sum of two numbers is 18 and their difference is 4. What is the product of the two numbers?
def solve() -> int: sum_of_numbers = 18 diff_of_numbers = 4 num1 = (sum_of_numbers + diff_of_numbers)/2 num2 = (sum_of_numbers - diff_of_numbers)/2 product_of_numbers = num1*num2 result = product_of_numbers return result
A pool has a volume of 40,000 liters. It takes a pump 8 hours to empty the pool. How many liters of water can the pump drain in 1 minute?
def solve() -> int: pool_vol = 40000 pump_time = 8 pump_flow = pool_vol / pump_time flow_per_minute = pump_flow / 60 result = flow_per_minute return result
Julie has 126 marbles. If she divides them into groups of 3, how many groups will she have?
def solve() -> int: n_groups = 126 // 3 result = n_groups return result
Mary wants to buy 30 candy bars for a party with her friends. Each candy bar costs $0.75. How much money does Mary need to spend?
def solve() -> int: cost = 0.75 numberOfCandyBars = 30 sum = cost * numberOfCandyBars result = sum return result
Anna is making a banner for her friend's birthday. She wants to use a piece of fabric that is 12 feet long and 3 feet wide. She plans to cut out eight triangles from the fabric, each with a base of 9 inches and a height of 12 inches. She will use the remaining fabric to write the words "Happy Birthday". How many square...
def solve() -> int: fabric_length = 12 * 12 fabric_width = 3 * 12 fabric_area = fabric_length * fabric_width triangle_base = 9 triangle_height = 12 triangle_area = triangle_base * triangle_height / 2 total_triangle_area = triangle_area * 8 remaining_fabric_area = fabric_area - total_...
Student: A car travels 300 miles in 5 hours. If it maintains the same speed, how many miles can it travel in 8 hours?
def solve() -> int: distance_traveled = 300 time_traveled = 5 time_traveled_2 = 8 speed = distance_traveled / time_traveled distance_traveled_2 = speed * time_traveled_2 result = distance_traveled_2 return result