question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
He wants to plant some flowers on a rectangular patch that covers 20% of the lawn. The patch is 10 feet long. How wide is the patch?
def solve() -> int: patch_area = 0.2 * 200 patch_width = patch_area / 10 result = patch_width return result
Ben and Lisa are making sandwiches for their picnic. Ben bought 4 loaves of bread, each with 16 slices, and 2 jars of peanut butter, each with 24 servings. Lisa bought 3 packs of cheese, each with 12 slices, and 2 jars of jam, each with 18 servings. How many sandwiches can they make with what they have and how many ser...
def solve() -> int: bread_slices = 4 * 16 peanut_butter_servings = 2 * 24 cheese_slices = 3 * 12 jam_servings = 2 * 18 number_of_sandwiches = min(bread_slices // 2, peanut_butter_servings, cheese_slices, jam_servings) bread_used = number_of_sandwiches * 2 peanut_butter_used = number_of_...
The area of a square is 25 square meters. What is the perimeter of the square?
def solve() -> int: area = 25 side = area**0.5 perimeter = side*4 result = perimeter return result
Jamie has 9 identical pencils, and her friend Kelly has half as many. If their teacher Ms. Jones has two times the total number of pencils Jamie and Kelly have, what's 90% of Ms. Jones' pencils?
def solve() -> int: jamie_pencils = 9 kelly_pencils = jamie_pencils / 2 total_pencils = jamie_pencils + kelly_pencils ms_jones_pencils = 2 * total_pencils result = 0.9 * ms_jones_pencils return result
Oliver has 3 times as many marbles as Lucy does. If Lucy has 15 marbles, how many more marbles will Oliver have than Lucy if they each lose 5 marbles?
def solve() -> int: lucy_marbles = 15 oliver_marbles = 3 * lucy_marbles lucy_marbles -= 5 oliver_marbles -= 5 difference = oliver_marbles - lucy_marbles result = difference return result
There are 5 dozen pens in the cupboard. Half of them are red and the other half are blue. How many blue pens are there in the cupboard?
def solve() -> int: dozen_pens = 5 * 12 half_pens = dozen_pens * 1/2 result = half_pens return result
Tommy is baking a cake and needs to buy some ingredients from the grocery store. He buys 5 eggs for $2 each and 25 g of flour for $1. How much money did he spend in total?
def solve() -> int: price_egg = 2 price_flour = 1 quantity_egg = 5 quantity_flour = 25 total_price = (price_egg * quantity_egg) + (price_flour * quantity_flour) result = total_price return result
Ms. Nguyen has 50 color pencils. She wants to have a total of 100 color pencils. If each box has 15 color pencils, how many new boxes does she need to purchase?
def solve() -> int: total_pencils = 100 current_pencils = 50 pencils_needed = total_pencils - current_pencils pencils_per_box = 15 boxes_needed = pencils_needed // pencils_per_box + (pencils_needed % pencils_per_box > 0) result = boxes_needed return result
Susan deposits $5000 into a savings account with a 6% annual interest rate. How much money will she have in the account after 3 years?
def solve() -> int: initial_deposit = 5000 interest_rate = 6 / 100 number_of_years = 3 new_balance = initial_deposit * (1 + interest_rate) ** number_of_years result = new_balance return result
John and Mary are playing a guessing game. John guesses a number between 1 and 20 but doesn't tell Mary what it is. Mary guesses a different number. If John's number is 5 and Mary's number is 12, what is the difference between the numbers?
def solve() -> int: john_number = 5 mary_number = 12 difference = abs(john_number - mary_number) result = difference return result
Amanda is a freelance writer. She charges $100 for each article plus $0.05 per word. If she wrote one article with 500 words and another with 800 words, how much did she earn in total?
def solve() -> int: article_price = 100 word_price = 0.05 article1_words = 500 article2_words = 800 article1_earnings = article_price + (word_price * article1_words) article2_earnings = article_price + (word_price * article2_words) total_earnings = article1_earnings + article2...
A box contains 12 chocolates. If 4 chocolates are taken out of the box, what percentage of the chocolates are left in the box?
def solve() -> int: num_chocolates = 12 chocolates_taken = 4 chocolates_left = num_chocolates - chocolates_taken percentage_left = chocolates_left / num_chocolates * 100 result = percentage_left return result
Clyde is in charge of purchasing chlorine for his oval shaped pool, which is 30 feet in length and 15 feet in width. If one quart of chlorine is needed for every 100 cubic feet of water and chlorine costs $4.50 a quart, how much money should Clyde set aside for chlorine?
def solve() -> int: Length = 30 Width = 15 Volume = (3.14 * Length * Width**2) / 4 Total_quarts = Volume / 100 Cost = Total_quarts * 4.50 result = Cost return result
Mike and Jane are making sandwiches for a picnic. Mike has twice as many slices of bread as Jane does. The total weight of their bread slices is 3 pounds. If Mike has 24 slices of bread, how much do Jane's slices weigh in ounces?
def solve() -> int: bread_weight_pounds = 3 mike_slices = 24 jane_slices = mike_slices / 2 mike_weight_pounds = bread_weight_pounds / (mike_slices + jane_slices) * mike_slices jane_weight_pounds = bread_weight_pounds - mike_weight_pounds jane_weight_ounces = jane_weight_pounds * 16 ...
Mike is a runner and every time he runs 5 km, he sweats out 1 L of water. If he brings a 1 L bottle with him, how many times can he run 5 km before he runs out of water?
def solve() -> int: distance_per_run = 5 water_per_run = 1 bottle_capacity = 1 runs_possible = bottle_capacity // water_per_run result = runs_possible return result
There were 30 students in a math class. If 25% of them failed the test, how many students passed?
def solve() -> int: passing_students = 30 - (0.25*30) result = passing_students return result
Noah is trying to estimate the total distance of a hiking trail. He knows that the middle part of the trail is 5 miles long. The part of the trail on the left looks like it's 75% of the length of the middle part. The part of the trail on the right looks like it's 2 miles shorter than if the distances of the left and mi...
def solve() -> int: middle_part = 5 left_part = 0.75 * middle_part right_part = (left_part + middle_part) - 2 total_distance = left_part + middle_part + right_part result = total_distance return result
John made a box from a sheet of cardboard. He used 6 sides of the sheet, each side measures 10cm by 5cm. If there is 45 cm of paper left, how long is the longest side of the box?
def solve() -> int: length = None length_1 = 10 length_2 = 5 total_length = (length_1 + length_2) * 6 remaining_length = 45 length = remaining_length / 6 result = length return result
A hiker needs to walk 33 miles in total. On the first day, he walks 4 miles and on the second day 2 more than that. How many more miles does he need to walk to reach his goal?
def solve() -> int: total_miles = 33 day1 = 4 day2 = day1 + 2 remaining_miles = total_miles - day1 - day2 result = remaining_miles result return result
Cindy is painting a fence. The fence is 9 feet long and 6 feet high. She can paint 12 square feet in an hour. How long will it take her to paint the whole fence? Assume she paints both sides of the fence.
def solve() -> int: fence_length = 9 fence_height = 6 paint_rate = 12 sides = 2 fence_area = fence_length * fence_height * sides paint_time = fence_area / paint_rate result = paint_time return result
Student: Julie drives 40 miles every day for work. If she uses 1 gallon of gas for every 20 miles, how many gallons of gas will she need for 30 days of work? If a gallon of gas costs $3.50, how much will Julie spend on gas in total?
def solve() -> int: miles_per_day = 40 gallons_per_20_miles = 1 days_worked = 30 total_miles = miles_per_day * days_worked total_gallons = (total_miles / 20) * gallons_per_20_miles cost_per_gallon = 3.50 total_cost = total_gallons * cost_per_gallon result = total_cost return result
Student: A pizza shop made 16 pizzas. Each pizza is cut into 8 slices. How many slices were made in total?
def solve() -> int: pizzas = 16 slices_per_pizza = 8 total_slices = pizzas * slices_per_pizza result = total_slices return result
A school collected $504 from a bake sale. The school decided to donate 3/8 of the money to a charity and use the rest to buy new books for the library. How many dollars did the school spend on new books?
def solve() -> int: donation = 3/8 * 504 leftover = 504 - donation result = leftover return result
In a school, 60% of students play table tennis, 25% play badminton, and the remaining students play chess. If there are 200 students in the school, how many more students play table tennis than chess?
def solve() -> int: students=200 table_tennis=0.6*students badminton=0.25*students chess=students-table_tennis-badminton result=table_tennis-chess return result
Student: If a pizza was originally cut into 8 slices and 3 of them were eaten, what fraction of the pizza remains uneaten?
def solve() -> int: original_slices = 8 eaten_slices = 3 remaining_slices = original_slices - eaten_slices fraction_remaining = remaining_slices / original_slices result = fraction_remaining return result
If Lucy wants to provide each person with 1.5 pounds of potato chips instead of 1.2 pounds, how much will she have to pay?
def solve() -> int: pounds_per_person = 1.5 num_people = 10 total_pounds = pounds_per_person * num_people cost_per_pound = 0.25 total_cost = total_pounds * cost_per_pound result = total_cost return result
Emma bought 8 tickets to a theme park for $25 each. After visiting the park, she decided to sell some of the unused tickets. How many tickets does she need to sell to recoup her initial investment if the tickets decreased in value by 1/2?
def solve() -> int: tickets_bought = 8 ticket_price = 25 ticket_value_decrease = 1/2 total_cost = tickets_bought * ticket_price ticket_value_after_decrease = ticket_price * ticket_value_decrease tickets_needed_to_sell = total_cost / ticket_value_after_decrease result = tickets...
Every year, Mike gets a new car. He started doing this when he turned 21 years old, which was the year he got his second car. In eight years, Mike will have owned 10 cars. How old is Mike currently?
def solve() -> int: age_when_started = 21 years_passed = 8 cars_owned = 10 current_age = age_when_started + years_passed result = current_age return result
A school has 500 students, of which 60% are boys and 40% are girls. The school organizes a raffle, where each student can buy one ticket for $1. The prize is a $100 gift card. If 80% of the boys and 70% of the girls buy a ticket, what is the expected value of playing the raffle for a student who buys a ticket?
def solve() -> int: boys_buy = 0.8 * 0.6 * 500 girls_buy = 0.7 * 0.4 * 500 total_tickets = boys_buy + girls_buy prob_win = 1 / total_tickets exp_value = (prob_win * 100) - 1 result = exp_value return result
If a square has an area of 64 square inches, what is the length of each side?
def solve() -> int: area = 64 side_length = (area)**(1/2) result = side_length return result
A swimming pool that is 6 meters wide and 10 meters long needs to be painted. If a liter of paint can cover 8 square meters, how many liters of paint are needed?
def solve() -> int: width = 6 length = 10 area = width * length coverage_per_liter = 8 liters_of_paint_needed = area / coverage_per_liter result = liters_of_paint_needed return result
A rectangular prism has a volume of 72cm³. If the length is 3cm and the width is 4cm, what is the height?
def solve() -> int: length = 3 width = 4 volume = 72 height = volume/(length*width) result = height return result
In a country, 40% of the population speaks English, 75% of those who speak English also speak Spanish. If there are 10 million people in the country, how many speak both English and Spanish?
def solve() -> int: total_population = 10000000 english_speakers = total_population * 0.4 english_and_spanish_speakers = english_speakers * 0.75 result = english_and_spanish_speakers return result
Nathan puts 20% of his weekly paycheck of $1000 into savings. He wants to buy a $6000 watch and needs to save up a 30% down payment. How long will it take Nathan to save up for the down payment?
def solve() -> int: weekly_paycheck = 1000 savings_amount = 0.2 * weekly_paycheck down_payment = 0.3 * 6000 weeks_to_save = down_payment / savings_amount result = weeks_to_save return result
Diana can run 5 kilometers in 25 minutes on a treadmill. She wants to run a total of 15 kilometers today. How many minutes does she need to run on the treadmill if she already ran 6 kilometers outside?
def solve() -> int: speed = 5 / 25 total = 15 ran = 6 left = total - ran time = round(left / speed) result = time return result
A car travels 240 miles in 4 hours. What is its average speed in miles per hour?
def solve() -> int: distance = 240 time = 4 average_speed = distance / time result = average_speed return result
Adam is painting a wall that is 8 meters long and 3 meters high. The paint can is enough to paint 2 square meters. How many paint cans does Adam need?
def solve() -> int: wall_length = 8 wall_height = 3 wall_area = wall_length * wall_height paint_can_coverage = 2 num_cans = wall_area / paint_can_coverage result = int(num_cans) + 1 return result
yon has 486 books to distribute among 6 libraries. How many books will each library receive?
def solve() -> int: number_of_books = 486 number_of_libraries = 6 books_for_each_library = number_of_books / number_of_libraries result = books_for_each_library return result
- Here are some possible questions and programs: Anna wants to make some lemonade for her lemonade stand. She needs 6 lemons and 1 cup of sugar for every 2 quarts of lemonade. She can buy lemons for 50 cents each and a 4-pound bag of sugar for $2. How much does it cost her to make 8 quarts of lemonade?
def solve() -> int: lemons_needed = 6 * (8 / 2) sugar_needed = 1 * (8 / 2) lemon_cost = 0.5 * lemons_needed sugar_cost = 2 * (sugar_needed / 16) total_cost = lemon_cost + sugar_cost result = total_cost return result
Student: Henry has saved up $100. He wants to buy 3 items, each of which cost $35. How much money does he have left after making the purchase?
def solve() -> int: cost_per_item = 35 num_items = 3 total_cost = cost_per_item * num_items saved_money = 100 money_left = saved_money - total_cost result = money_left return result
Emma has to bake 60 cupcakes for a bake sale. After 15 minutes, she has baked 8. After another 15 minutes, she has baked 17. How many cupcakes does she need to bake to finish the 60 cupcakes for the bake sale?
def solve() -> int: minutes = 15 baked_cupcakes = 8 cupcakes_per_minute = baked_cupcakes / minutes remaining_time = (60 - baked_cupcakes) / cupcakes_per_minute remaining_cupcakes = 60 - baked_cupcakes total_cupcakes = remaining_cupcakes + baked_cupcakes result = tota...
If Mia saved $75 in the bank and Mark saved $20 less than double the amount saved by Mia, how much did Mark save? In the marketing department, 60% of the employees are women and there are 240 men. How many women are there?
def solve() -> int: mia_saved = 75 mark_saved = 0 men = 240 women = 0 mark_saved = 2 * mia_saved - 20 total_employees = men / (1 - 0.6) women = total_employees * 0.6 result = mark_saved return result
Student: John has twice as many toys as his brother and his brother has 12 toys. If John gives away 15 of his toys, how many toys does he have now?
def solve() -> int: toys_brother = 12 toys_john = toys_brother * 2 toys_john_after_giving_away = toys_john - 15 result = toys_john_after_giving_away return result
Marie wants to save $10,000 to go on a vacation. She starts with $6,000 and saved $300 every month. How many months will it take her to reach her goal?
def solve() -> int: goal_amount = 10000 starting_amount = 6000 monthly_savings = 300 months_needed = (goal_amount - starting_amount) / monthly_savings result = int(months_needed) return result
Sarah ran a lemonade stand and sold 5 times the amount of lemonade compared to her little brother’s. Their parents didn’t drink any lemonade. If her little brother made 6 pitchers each containing 12 cups of lemonade, how many cups would they each have if they divide the total number of cups equally amongst them?
def solve() -> int: brother_pitchers = 6 brother_cups_per_pitcher = 12 sarah_cups = brother_pitchers * brother_cups_per_pitcher * 5 total_cups = sarah_cups + brother_pitchers * brother_cups_per_pitcher cups_per_person = total_cups / 3 result = cups_per_person return result
A basketball team needs to purchase new uniforms for their players. If each uniform costs $25 and there are 15 players in the team, how much funds do they need in total to cover the cost of all the uniforms?
def solve() -> int: uniform_cost = 25 team_size = 15 total_cost = uniform_cost * team_size result = total_cost return result
A farmer has 100 chickens and ducks in a total of 36 cages. If each cage can hold 3 animals, how many chickens does the farmer have?
def solve() -> int: total_animals = 100 total_cages = 36 animals_per_cage = 3 total_chickens = (total_animals * 2 - (total_animals * 2 - total_cages * animals_per_cage)) / 2 result = total_chickens return result
Ben is saving money to buy a new video game. He earns $5 every week for doing chores and $10 every month for babysitting his cousin. The video game costs $60. How many weeks will it take for Ben to save enough money for the video game?
def solve() -> int: weekly_earnings = 5 monthly_earnings = 10 game_price = 60 monthly_total = weekly_earnings * 4 + monthly_earnings months = game_price // monthly_total remainder = game_price % monthly_total if remainder == 0: weeks = 0 else: weeks = remainder // week...
In a math classroom, there are 20 students. The ratio of girls to boys is 7:3. How many girls are there in the classroom?
def solve() -> int: total_students = 20 ratio_girls = 7/(7+3) girls_count = total_students * ratio_girls result = int(girls_count) return result
A bookstore orders 280 books from a publisher. The publisher gives a discount of 10% for orders over 200 books. How much did the bookstore have to pay for the order?
def solve() -> int: num_books_ordered = 280 book_price = 10 discount_threshold = 200 if num_books_ordered > discount_threshold: total_cost = (num_books_ordered * book_price) * 0.9 else: total_cost = num_books_ordered * book_price result = total_cost return result
A car dealership sold nine cars in one day for a total of $180,000. If each car is sold for the same price, what is the cost of one car?
def solve() -> int: num_cars = 9 total_money = 180000 cost_per_car = total_money / num_cars result = cost_per_car return result
Max, Rachel, Logan, and Ava bought 5 pizzas to share. Max ate 3/4 of a pizza, Rachel ate 1/6 of a pizza, Logan ate 2/3 of a pizza, and Ava ate 1/5 of a pizza. If there are 14 slices in each pizza how many slices were left over?
def solve() -> int: max_slices = (3/4) * 14 rachel_slices = (1/6) * 14 logan_slices = (2/3) * 14 ava_slices = (1/5) * 14 total_slices = max_slices + rachel_slices + logan_slices + ava_slices leftover_slices = (5 * 14) - total_slices result = leftover_slices return result
A driver travels 320 km in 4 hours. What is the average speed of the driver?
def solve() -> int: distance = 320 time = 4 average_speed = distance / time result = f'<<<{average_speed}>>>' result = average_speed return result
Student: Jake, Kelly and Liam bought some books from a bookstore. Jake bought 6 books and spent $48. Kelly bought 4 books and spent $36. Liam bought 5 books and spent $45. How much did each book cost?
def solve() -> int: jake_books = 6 jake_spent = 48 jake_book_cost = jake_spent / jake_books kelly_books = 4 kelly_spent = 36 kelly_book_cost = kelly_spent / kelly_books liam_books = 5 liam_spent = 45 liam_book_cost = liam_spent / liam_books book_cost = (jake_spent + kelly_spent +...
Lisa has a 2 liter jug of lemonade. The lemonade is 12% lemon juice. How many ml of lemon juice will she have once all the liquid has evaporated?
def solve() -> int: jug_size = 2000 lemonade_concentration = 0.12 lemon_juice = jug_size * lemonade_concentration result = lemon_juice return result
In a pet store, for every cat there are six birds, and for every bird there are four fish. If there are 96 fish, how many cats are there?
def solve() -> int: cats = 96 / (6 * 4) result = cats return result
On Monday, John worked 5 hours and Monique worked 10 hours. On Tuesday, John worked 3 hours and Monique worked 8 hours. What was the difference of the total working hours of both on Monday and Tuesday?
def solve() -> int: monday_john = 5 monday_monique = 10 tuesday_john = 3 tuesday_monique = 8 total_monday = monday_john + monday_monique total_tuesday = tuesday_john + tuesday_monique difference = total_monday - total_tuesday result = difference return result
John is hiking up a mountain that is gradually increasing in altitude. John needs to ascend 1000 meters to reach the peak. It takes 45 minutes for John to hike up the first half of the mountain. John then takes 2 minutes per 100 meters to hike up the next 5 segments of the mountain. Each of the last 5 segments of the m...
def solve() -> int: total_altitude = 1000 first_half_altitude = total_altitude / 2 next_five_segments_altitude = total_altitude - first_half_altitude next_five_segments_time = next_five_segments_altitude / 100 * 2 last_five_segments_altitude = next_five_segments_altitude - next_five_segments_time / ...
Ella read 45 pages of a book that has 180 pages in total. What percentage of the book did she read?
def solve() -> int: percentage = (45 / 180) * 100 result = percentage return result
An online store sells 300 products. 35 percent of the products are electronics, and 20 percent of the electronics are laptops. How many laptops does the online store sell?
def solve() -> int: total_products = 300 electronics_percentage = 0.35 laptops_percentage = 0.20 electronics = total_products * electronics_percentage laptops = electronics * laptops_percentage result = laptops return result
The length of a rectangular-shaped garden is twice its width and its perimeter is 60 m. Find the area of the garden.
def solve() -> int: perimeter = 60 width = perimeter/10 length = 2 * width area = length * width result = area return result
Taylor has $100 and wants to buy a pair of $60 shoes and a $20 shirt. How much money will he have left?
def solve() -> int: shoe_cost = 60 shirt_cost = 20 total_cost = shoe_cost + shirt_cost starting_money = 100 money_left = starting_money - total_cost result = money_left return result
Student: There were 192 roses in an event. They were divided into bouquets of 6 roses each. How many bouquets were made?
def solve() -> int: roses = 192 bouquet_size = 6 bouquets = roses // bouquet_size result = bouquets return result
Sarah purchases a new dress every month for $100 and her roommate pays 25% of the cost. How much does Sarah pay per month for her dresses?
def solve() -> int: cost_per_dress = 100 roommate_payment_percentage = 0.25 sarah_payment = cost_per_dress * (1 - roommate_payment_percentage) result = sarah_payment return result
Liam spent $32 on 4 t-shirts and 2 pairs of shorts. If each t-shirt costs the same as 2 pairs of shorts, how much does one t-shirt cost?
def solve() -> int: cost_of_shorts = 8 total_cost_of_shirts_and_shorts = 32 cost_of_tshirt = (total_cost_of_shirts_and_shorts - (2 * cost_of_shorts)) / 4 result = cost_of_tshirt return result
Emma and Mason are farmers who go to the market to buy fruits and vegetables. Emma buys 15 apples, and Mason buys half that amount. Mason buys 9 oranges and Emma buys some, too. If they check out together and end up buying 34 items, how many apples did Mason buy?
def solve() -> int: emma_apples = 15 mason_apples = emma_apples / 2 mason_oranges = 9 emma_oranges = 34 - mason_oranges - emma_apples total_apples = emma_apples + mason_apples total_items = emma_apples + mason_apples + emma_oranges + mason_oranges mason_apples_bought = total_a...
A rectangle has a length that is 4 times its width. If the perimeter of the rectangle is 80 cm, what is the area of the rectangle?
def solve() -> int: perimeter = 80 w = perimeter/10 l = 4*w area = l*w result = int(area) return result
imon has 13 kilograms of vegetables. Each vegetable weighs 100 grams. How many vegetables does Siomn have?
def solve() -> int: total_weight = 13 veg_weight = 0.1 veg_num = total_weight / veg_weight result = veg_num return result
If Mary bought 6 items and each item cost $5, how much money did Mary pay in total?
def solve() -> int: items = 6 price = 5 total = items * price result = total return result
A calculator and a sharpener cost $18 in total. If the calculator costs twice the sharpener, what is the cost of the calculator?
def solve() -> int: priceOfSharpener = 9 priceOfCalculator = 2 * priceOfSharpener result = priceOfCalculator return result
Noah is renting an apartment that costs $1,200 per month. He has a roommate who pays half of the rent. Noah also has an income of $3,000 per month, and he spends 25% of his income on other expenses. How much can Noah save each month?
def solve() -> int: rent = 1200 / 2 income = 3000 * 0.75 save = income - rent result = save return result
Student: 1. Diana was shopping for Christmas, and she spent $110 on presents. She also bought a cup of coffee for herself for $2.50. If she had $200 in her wallet before making any purchases, how much money will she have left after shopping?
def solve() -> int: spent_on_presents = 110 coffee_price = 2.50 initial_money = 200 total_spent = spent_on_presents + coffee_price money_left = initial_money - total_spent result = money_left return result
To celebrate her graduation, Ava decided to treat herself to dinner and drinks at a rooftop bar. She ordered a shrimp cocktail for $10, a sushi roll for $15, had a margarita for $12, and a slice of chocolate truffle cake for dessert for $9. She used a voucher for 15% off the total bill, but she wanted to leave a tip of...
def solve() -> int: shrimp_cocktail = 10 sushi_roll = 15 margarita = 12 chocolate_cake = 9 total_bill = shrimp_cocktail + sushi_roll + margarita + chocolate_cake discount = total_bill * 0.15 bill_after_discount = total_bill - discount tip = bill_after_discount * 0.18 final_bill ...
Student: Ben bought 6 burgers for $8 each and 4 fries for $4 each. He gave $70 to the cashier. So how much change did he take?
def solve() -> int: burgers = 6 burger_cost = 8 fries = 4 fries_cost = 4 total_burger_cost = burgers * burger_cost total_fries_cost = fries * fries_cost total_cost = total_burger_cost + total_fries_cost cash_given = 70 change = cash_given - total_cost result = change return ...
A family has 24 cups of flour, and a recipe requires 4 cups of flour. How many batches of the recipe can they make?
def solve() -> int: cups_of_flour = 24 cups_per_batch = 4 batches = cups_of_flour // cups_per_batch result = batches return result
A company must pay a yearly fee of $22,000 to be a regional partner. The fee is split into four quarterly payments, and the company must also pay a 6% sales tax on the entire bill. How much should the company expect to pay for each quarterly payment after factoring in the sales tax (to the nearest whole dollar)?
def solve() -> int: tax = 22000*6/100 final_cost = 22000 + tax quarterly_payment = final_cost / 4 result = round(quarterly_payment) return result
John filled a tub for his dog with water halfway. Then he emptied and filled the tub some more. If the tub's length is 4 feet, width is 3 feet and height is 2 feet, how many gallons of water does it take to fill it up completely?
def solve() -> int: length = 4 width = 3 height = 2 volume = length * width * height gallons = volume * 7.48 result = gallons return result
Anna can cut 26 pieces of fabric in 2 hours. Maria can cut the same 26 pieces of fabric in 90 minutes. How long would it take Anna and Maria to cut 50 pieces of fabric together?
def solve() -> int: anna_rate = 26/2 maria_rate = 26/(90/60) combined_rate = anna_rate + maria_rate time_to_cut_50 = 50/combined_rate result = time_to_cut_50 return result
At a birthday party, 10 guests pooled their money to buy a cake and decorations. The total cost was $80. If one guest paid for half of the bill and the other 9 guests split the rest equally, how much did each of the remaining guests pay?
def solve() -> int: total_cost = 80 half_bill = total_cost / 2 remaining_guests = 9 each_remaining_guest_pay = (total_cost - half_bill) / remaining_guests result = each_remaining_guest_pay return result
Pierre got 5 gift boxes and 4 bags of chocolates for his birthday. He gave 2 gift boxes and 3 bags of chocolates to his siblings. Then he bought 3 gift boxes and 2 bags of chocolates. How many gift boxes and bags of chocolates does Pierre have in total?
def solve() -> int: total = 0 gift_box = 5 gift_box = gift_box - 2 chocolate = 4 chocolate = chocolate - 3 gift_box = gift_box + 3 chocolate = chocolate + 2 total = gift_box + chocolate result = total return result
Hannah and her classmates want to organize a school trip. The total cost of the trip is $500 per person. Additionally, they need to rent a bus that costs $5000. If they have 30 students in the class and want to cover all expenses for the first year, how much money do they need to raise?
def solve() -> int: students = 30 cost_per_person = 500 bus_cost = 5000 total_cost = (students * cost_per_person) + bus_cost result = total_cost return result
-Separate each question by a blank line Some possible questions and programs are: Kim is making mini pizzas for a party. She has 5 kilograms of dough, which is enough to make 100 mini pizzas. Each mini pizza has 2 slices of cheese and 3 pepperoni toppings. Kim has 300 slices of cheese and 420 pepperoni toppings in tota...
def solve() -> int: dough = 5 pizzas = 100 cheese = 300 pepperoni = 420 cheese_per_pizza = 2 pepperoni_per_pizza = 3 pizzas_with_cheese = cheese // cheese_per_pizza pepperoni_needed = pizzas_with_cheese * pepperoni_per_pizza pepperoni_left = pepperoni - pepperoni...
Jessie collected three stones, four feathers and two shells during her beach day. How many items did Jessie collect in total?
def solve() -> int: total_items = 0 total_items += 3 total_items += 4 total_items += 2 result = total_items return result
Student: The area of a rectangle is 48 square centimeters. If the length is 8 centimeters, what is the width?
def solve() -> int: area = 48 length = 8 width = area / length result = width return result
Ira and Lana cut a cake in the ratio 7:9. If Ira eats 14 pieces, how many pieces are left in the cake?
def solve() -> int: unit = 14/7 pieces = unit * 16 left = pieces - 14 result = left return result
A rectangular patio has an area of 60 square feet. If the length of the patio is 15 feet, what is its width?
def solve() -> int: width = 60/15 result = width return result
A bakery sells 200 cupcakes every day. Each cupcake costs $1 to make. If the bakery sells each cupcake for $2, how much profit does the bakery make in a week?
def solve() -> int: cupcakes_per_day = 200 cost_per_cupcake = 1 revenue_per_cupcake = 2 profit_per_cupcake = revenue_per_cupcake - cost_per_cupcake profit_per_day = cupcakes_per_day * profit_per_cupcake profit_per_week = profit_per_day * 7 result = profit_per_week return result
Possible new questions and programs: Bob has 15 red marbles and 3 times as many blue marbles. He gives half of his red marbles and a quarter of his blue marbles to his friend. How many marbles does he have left?
def solve() -> int: blue_marbles = 15 * 3 red_given = 15 / 2 blue_given = blue_marbles / 4 result = 15 + blue_marbles - red_given - blue_given return result
A taxi driver charges $3 for the initial fare and $0.50 for each 1/4 mile traveled. He drives at a constant speed of 20 miles per hour. If he works for 8 hours and has no breaks, how much money does he make in a day?
def solve() -> int: initial_fare = 3 mileage_rate = 0.50 speed = 20 work_time = 8 distance = speed * work_time trips = distance / (1/4) income = initial_fare + mileage_rate * trips result = income return result
Lena the scientist is conducting an experiment with 20 test tubes. She adds 5 milliliters of liquid to each tube and places them in a rack. However, she accidentally knocks over the rack, and 3 of the test tubes spill. What is the total volume of the liquid that is left in the tubes?
def solve() -> int: num_tubes = 20 liquid_per_tube = 5 spilled_tubes = 3 total_liquid = num_tubes * liquid_per_tube remaining_liquid = total_liquid - (spilled_tubes * liquid_per_tube) result = remaining_liquid return result
Student: Emma has a box of 25 marbles and a bag of 10 stones. She adds 3 marbles and 5 stones. How many objects does Emma have now?
def solve() -> int: marbles = 25 stones = 10 added_marbles = 3 added_stones = 5 total_marbles = marbles + added_marbles total_stones = stones + added_stones total_objects = total_marbles + total_stones result = total_objects return result
Maria has an assortment of buttons. She keeps them in 60 small jars. In the first 20 jars, there are 5 stacks of 12 buttons each. The rest of the jars each have 8 stacks of 6 buttons. How many buttons are in Maria's collection?
def solve() -> int: first_jars = 20 stacks_per_first_jar = 5 buttons_per_stack_first_jar = 12 second_jars = 60 - first_jars stacks_per_second_jar = 8 buttons_per_stack_second_jar = 6 first_jar_buttons = first_jars * stacks_per_first_jar * buttons_per_stack_first_jar second_jar_butto...
A bookstore has 150 books that they want to sell for $20 each. They offer a discount of 15%. How much money will they make after selling all the books?
def solve() -> int: price_per_book = 20 discount_rate = 0.15 total_price_before_discount = 150*price_per_book discounted_price = total_price_before_discount * discount_rate total_price_after_discount = total_price_before_discount - discounted_price result = total_price_after_discount return ...
A company sells a product for $800 and makes a profit of 20%. What is the cost of producing the product?
def solve() -> int: selling_price = 800 profit_percent = 20 cost_price = selling_price / (1 + profit_percent/100) result = cost_price return result
Tom invested $5000 in a stock that gave him a 10% return. How much money did he make from the investment?
def solve() -> int: investment_amount = 5000 percent_return = 0.1 profit = investment_amount * percent_return result = profit return result
Luca has 12 crates of oranges. Each crate contains 24 oranges and each orange can be squeezed to get 150 ml of juice. If Luca sells his juice in cups of 250 ml each, how many cups can he sell in total?
def solve() -> int: total_juice = 12 * 24 * 150 cups = total_juice // 250 result = cups return result
A company has 500 employees, and each employee receives a bonus of $300. If the company deducts 20% tax on the bonus, calculate the amount of tax the company will pay.
def solve() -> int: number_of_employees = 500 bonus_per_employee = 300 total_bonus = number_of_employees*bonus_per_employee tax = total_bonus*0.2 result = tax return result
Tim bought a jacket for $90 and paid 3% sales tax. How much money did he spend in total for the jacket?
def solve() -> int: sales_tax_percentage =.03 cost_of_jacket = 90 sales_tax = cost_of_jacket * sales_tax_percentage total_cost_before_tax = cost_of_jacket + sales_tax result = total_cost_before_tax return result
Mary can paint a house in 8 hours. If she works with a partner, she can paint the same house in 4 hours. How long would it take for the partner to paint the house alone?
def solve() -> int: mary_time = 8 mary_work_rate = 1/mary_time mary_and_partner_time = 4 mary_and_partner_work_rate = 1/mary_and_partner_time partner_work_rate = mary_and_partner_work_rate - mary_work_rate partner_time = 1/partner_work_rate result = partner_time return result
A pen has 2 ml of ink, a marker 5 ml, and a highlighter 3 ml. If Bob used 10 pens, 6 markers, and 8 highlighters for his project, calculate how many milliliters of ink he used.
def solve() -> int: ink_pen = 2 ink_marker = 5 ink_highlighter = 3 ink_total = ink_pen * 10 + ink_marker * 6 + ink_highlighter * 8 result = ink_total return result