question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Student: Juan has 12 apples and gave 6 apples to his friend. How many apples does he have now?
def solve() -> int: apples_initial = 12 apples_given = 6 apples_remaining = apples_initial - apples_given result = apples_remaining return result
In a zoo, there are 50 monkeys. If 2/5 of them are juveniles and 3/4 of the adults are in the outdoor enclosure, how many adults are in the enclosure?
def solve() -> int: monkeys = 50 juveniles = (2/5) * monkeys adults = monkeys - juveniles adults_in_enclosure = (3/4) * adults result = adults_in_enclosure return result
Lisa is selling popcorn at a movie theater. She buys each bag of popcorn for $2 and sells it for $4. She also pays a $20 fee to rent the popcorn machine. She sells 50 bags of popcorn. How much profit does she make?
def solve() -> int: bags = 50 buy_price = 2 sell_price = 4 fee = 20 revenue = bags * sell_price expense = bags * buy_price + fee profit = revenue - expense result = profit return result
If there are 45 tablets, each containing 10 pills, how many pills are there in total?
def solve() -> int: num_tablets = 45 num_pills = 10 total_pills = num_tablets*num_pills result = total_pills return result
Emily needs to get her laptop fixed and it would cost $1000. The technician charges $50 per hour and it takes 5 hours to repair the laptop. There is also a $75 fee for the initial diagnosis. Insurance covers 70% of the total amount. How much is Emily left to pay?
def solve() -> int: total_cost = 1000 hourly_rate = 50 repair_time = 5 diagnosis_fee = 75 insurance_coverage = 0.7 repair_cost = hourly_rate * repair_time total_cost += diagnosis_fee + repair_cost insurance_payment = total_cost * insurance_coverage emily_payment = total_cost - i...
Emily, the librarian, shelved 22 novels, 14 magazines, and 6 newspapers on the top shelf. The number of books on the bottom shelf was three times the novels, and she rearranged them quickly. She then shelved the remaining books, which included 9 journals and 11 encyclopedias,Rohan wants to make guacamole and has $12 to...
def solve() -> int: novels = 22 magazines = 14 newspapers = 6 bottom_shelf_books = 3 * novels total_books = novels + magazines + newspapers + bottom_shelf_books + 9 + 11 money = 12 avocado_cost = 1.5 avocados_needed = 2 avocados_affordable = money // avocado_cost cups_of_guacamol...
John has $20. He spends $4 on lunch, $8 on a shirt, and $3 on a book. If he then finds a $10 bill on the ground, how much money does he have now?
def solve() -> int: initial_money = 20 spent_money = 4 + 8 + 3 remaining_money = initial_money - spent_money total_money = remaining_money + 10 result = total_money return result
Q2: Niven is planning their birthday party for 80 people. They want to provide 2 times as many cupcakes as cake slices. If each cake slice costs $12 and each cupcake costs $7, how much is the total budget?
def solve() -> int: a = 12 b = 7 x = 80 y = 2 * x result = x * a + y * b return result
-Some possible new questions and programs are: Julian buys a pack of 12 muffins every week for $7.50. He eats 3 muffins for breakfast every Monday, Wednesday, and Friday, and gives the rest to his friends. How much does he spend on muffins every month?
def solve() -> int: pack_cost = 7.5 pack_size = 12 muffins_eaten = 3 days = 3 weeks = 4 total_cost = pack_cost * weeks result = total_cost return result
An amusement park has 150 rides. They will be conducting a safety check for three days. For each day, the authority will have to close 25% of the rides that need maintenance for that day and all the subsequent days. How many rides will be shut on the third day of the safety check?
def solve() -> int: rides = 150 maintenance_percentage = 0.25 rides_day1 = rides rides_day2 = rides_day1 - (rides_day1 * maintenance_percentage) rides_day3 = rides_day2 - (rides_day2 * maintenance_percentage) result = rides_day3 return result
Student: The school has 12 desks and 9 chairs. How many more desks than chairs are at the school?
def solve() -> int: desks = 12 chairs = 9 difference = desks - chairs result = difference return result
Mary purchased a laptop for $1000 and sold it for $1200. She also paid $50 for shipping and handling. What was her total profit?
def solve() -> int: cost = 1000 selling_price = 1200 shipping_cost = 50 profit = selling_price - cost - shipping_cost result = f'<<<{profit}>>>' result = profit return result
There are 79 marbles, of which 15 are yellow, 37 are purple, and 27 are green. What is the ratio of purple marbles to other colored marbles?
def solve() -> int: yellow = 15 purple = 37 green = 27 total_number = yellow + purple + green other_colored_marbles = total_number - purple ratio = purple/other_colored_marbles result = ratio return result
John has 128 marbles and he wants to divide them into 4 equal bags. How many marbles will be in each bag and how many marbles will he have left?
def solve() -> int: marbles_per_bag = 128 / 4 leftover_marbles = 128 % 4 result = (marbles_per_bag, leftover_marbles) return result
Madison and Oliver order pad thai for $11, spring rolls for $4, and 3 glasses of Thai iced tea for $3 each. The tax is $3. Later, Oliver decides to order 1 more glass of Thai iced tea as he is still thirsty. How much change should they get from $30?
def solve() -> int: pad_thai_price = 11 spring_rolls_price = 4 iced_tea_price = 3 tax = 3 total_cost = pad_thai_price + spring_rolls_price + (3 * iced_tea_price) + tax additional_iced_tea_price = iced_tea_price change = 30 - total_cost + additional_iced_tea_price result = chang...
A pizza place sells 12 inch pies for $10 each and 16 inch pies for $15 each. If the store sells 200 12 inch pies and 150 16 inch pies in a month, how much money, in dollars, will the store receive in sales of pizzas per month?
def solve() -> int: price_small = 10 price_large = 15 num_small = 200 num_large = 150 total_sales = num_small * price_small + num_large * price_large result = total_sales return result
A basketball team won 60% of their games last season. If they played 50 games in total, how many games did they win?
def solve() -> int: total_games = 50 percentage_won = 60 games_won = total_games * percentage_won / 100 result = games_won return result
In 6 years, Henry will be 3 times the age of his younger brother Leo. If Leo's current age is 9 years, how old is Henry?
def solve() -> int: leo_age = 9 henry_age_in_6_years = 3 * (leo_age + 6) henry_age = henry_age_in_6_years - 6 result = henry_age return result
In Houston, there are 3.5 million people and 1/3 of them are elderly. If half of the elderly population has a medical condition that requires regular checkups, how many elderly people require regular checkups in Houston?
def solve() -> int: total_population = 3.5 * 10**6 elderly_population = total_population / 3 elderly_with_medical_condition = elderly_population / 2 result = elderly_with_medical_condition return result
Robert has some bills in his wallet which amount to $150. He has two $5 bills and four $25 bills, and the rest are $10 bills. How many $10 bills are in his wallet?
def solve() -> int: total = 150 five_dollars = 2 twenty_five_dollars = 4 ten_dollars = 0 ten_dollars = total - (five_dollars*5 + twenty_five_dollars*25) result = ten_dollars return result
A store has a stock of 500 t-shirts. It wants to increase its stock up to 1000 t-shirts. On the first day, 150 t-shirts are shipped, and five times this amount are shipped on the second day. How many more t-shirts need to be shipped to achieve the target?
def solve() -> int: initial_stock = 500 target_stock = 1000 first_day_shipment = 150 second_day_shipment = 5 * first_day_shipment current_stock = initial_stock + first_day_shipment current_stock += second_day_shipment remaining_stock = target_stock - current_stock res...
Jonathan has 10 toy cars in his collection. He gives away 4 of them to his cousin and 2 of them to his friend. How many toy cars does Jonathan have left?
def solve() -> int: cars = 10 cars_given_cousin = 4 cars_given_friend = 2 cars_left = cars - cars_given_cousin - cars_given_friend result = cars_left return result
Mike's salary increased by 15% to $9000 this year. John's salary from last year was equal to six times Mike's salary this year. If John's current salary is 20% more than his salary last year, what is his current salary?
def solve() -> int: mikes_salary = 9000 johns_salary_last_year = 6 * mikes_salary johns_salary_current = johns_salary_last_year * 1.2 result = johns_salary_current return result
Possible new questions: Belinda sells lemonade at a school fair. She makes $240 from selling 120 cups of lemonade. She pays $80 for the lemons, sugar, and cups. She gives 25% of her profit to the school fund, and 15% of her profit to a local animal shelter. How much money does Belinda have left after paying her expense...
def solve() -> int: profit = 240 - 80 school_donation = 0.25 * profit animal_donation = 0.15 * profit total_donation = school_donation + animal_donation remaining_money = profit - total_donation result = remaining_money return result
A store has a 20% discount on all items. A customer buys a shirt for $25 and pants for $30. How much will the customer save with the discount?
def solve() -> int: shirt_price = 25 pants_price = 30 total_price = shirt_price + pants_price discount = total_price * 0.2 result = round(discount, 2) return result
If Nathan reads 500 words every 15 minutes, how many words does he read per hour?
def solve() -> int: words_per_min = 500 minutes = 15 words_per_hour = words_per_min * minutes result = words_per_hour return result
Mary boards a train at 8:00 a.m. that takes 50 minutes to reach the first station, She reaches her destination at 11:00 a.m. What is the total time taken to travel from the first station to her destination?
def solve() -> int: start_time = 8 * 60 arrival_time = 11 * 60 travel_time = arrival_time - start_time - 50 result = travel_time return result
A rectangle has a length of 12 units and a width of 8 units. What is the perimeter of the rectangle?
def solve() -> int: perimeter = 2 * (12 + 8) result = perimeter return result
A restaurant's weekly revenue is $20,000. If 50% of the revenue goes towards food costs and $5,000 goes towards employee salaries, how much money is left for rent and utilities?
def solve() -> int: revenue = 20000 food_costs = revenue * 0.5 employee_salaries = 5000 remaining_money = revenue - food_costs - employee_salaries result = remaining_money return result
Student: A car rental company charges $20 per hour for renting a car and an additional $0.5 per mile driven. If John rents a car for four hours and drives 25 miles, how much does he pay?
def solve() -> int: hourly_rate = 20 mileage_rate = 0.5 rental_time = 4 driven_distance = 25 hourly_charge = hourly_rate * rental_time mileage_charge = mileage_rate * driven_distance total_cost = hourly_charge + mileage_charge result = total_cost return result
Student: A pizza restaurant sells a large pizza for $12.50 and a small pizza for $8.50. If Bob orders 2 large pizzas and 3 small pizzas, how much will he pay in total?
def solve() -> int: large_price = 12.50 small_price = 8.50 large_num = 2 small_num = 3 large_cost = large_price * large_num small_cost = small_price * small_num total_cost = large_cost + small_cost result = total_cost return result
A store is having a sale where every item is 15% off. If Jasmine buys 5 items and the original price for each item was $25, how much will she pay in total?
def solve() -> int: num_items = 5 original_price = 25 discount_percent = 0.15 total_cost = num_items * original_price total_discount = total_cost * discount_percent total_after_discount = total_cost - total_discount result = total_after_discount return result
A car is traveling at 60 km/hr for 2 hours and at 80 km/hr for the next 3 hours. What is the total distance that the car has traveled?
def solve() -> int: dist1 = 60 * 2 dist2 = 80 * 3 total_dist = dist1 + dist2 result = total_dist return result
David deposits $60 in his savings account every month for nine years. His sister, Laura, who is younger, saves 2/3 times less than David. What is the total amount of their savings in the bank?
def solve() -> int: david_savings_per_month = 60 laura_savings_per_month = david_savings_per_month * (2/3) david_savings_per_year = david_savings_per_month * 12 laura_savings_per_year = laura_savings_per_month * 12 david_total_savings = david_savings_per_year * 9 laura_total_savings = ...
Sarah is a toy seller who supplies toys to daycare centers. The first center needs 7 dolls, the second center needs 4 toy cars, and the third center needs 12 stuffed animals per week. How many dolls, toy cars, and stuffed animals does Sarah need to supply all the daycare centers in 2 weeks?
def solve() -> int: dolls_per_week = 7 cars_per_week = 4 animals_per_week = 12 total_dolls = dolls_per_week * 2 total_cars = cars_per_week * 2 total_animals = animals_per_week * 2 result = f'{total_dolls}, {total_cars}, {total_animals}' return result
Gina baked 240 cupcakes for her students. She wants to divide them equally among 20 kids but there were only 16 cupcakes left. Who among her students took more than their share of cupcakes?
def solve() -> int: total_cupcakes = 240 total_kids = 20 leftover_cupcakes = 16 equal_share = total_cupcakes // total_kids extra_cupcakes = leftover_cupcakes - equal_share result = extra_cupcakes return result
Ron received $1000 as a loan. He gave 1/3 of it to his sister and then spent $300 on repairing his car. How much money is left with Ron now?
def solve() -> int: loan = 1000 sister_share = loan / 3 remaining_money = loan - sister_share - 300 result = remaining_money return result
am deposited $100 into a savings account that earns 3% simple annual interest. How much money will be in the account after 5 years?
def solve() -> int: principal = 100 interest_rate = 0.03 years = 5 interest_earned = principal * interest_rate * years money_in_account = principal + interest_earned result = money_in_account return result
Karla has a box containing 75 marbles. She takes out 40% of them, then another 30% of the remaining. The rest she keeps in the box which she divides into three parts, two of which are equal in number of marbles. How many marbles are in each of the two parts?
def solve() -> int: marble_box = 75 removed1 = marble_box * 0.4 remaining1 = marble_box - removed1 removed2 = remaining1 * 0.3 remaining2 = remaining1 - removed2 two_equal_parts = remaining2 / 2 result = two_equal_parts return result
Carter and Olivia start typing a report at the same time. Carter can type 100 words in 5 minutes and Olivia can type 75 words in 5 minutes. If the report is 1000 words long, how many minutes later will Olivia finish after Carter finishes?
def solve() -> int: carter_speed = 100/5 olivia_speed = 75/5 report_length = 1000 carter_time = report_length/carter_speed olivia_time = report_length/olivia_speed time_difference = olivia_time - carter_time result = time_difference return result
Anna has 72 beads in two sizes. Each size has the same amount of beads. If Anna loses 8 beads in total, and twice as many were large than the rest combined, how many beads were in each size?
def solve() -> int: result = 24 return result
Ben had a basket of fruits. He counted 25 apples, 30 bananas, and 18 oranges. Later, he found some more fruits in the backyard and bought twice as many fruits as he found. In the end, he had 101 fruits. How many fruits did Ben buy?
def solve() -> int: apples = 25 bananas = 30 oranges = 18 total_fruits_initial = apples + bananas + oranges found_fruits = 101 - total_fruits_initial bought_fruits = found_fruits * 2 result = bought_fruits return result
A football team needs to travel 120 miles to their next game. If their bus travels at an average speed of 60 miles per hour, how long will it take them to arrive at the game?
def solve() -> int: distance = 120 speed = 60 time = distance / speed result = time return result
The price of a shirt is 25% off its original price. If the original price was $60, what is the discounted price?
def solve() -> int: original_price = 60 discount_percent = 25 discount_amount = original_price * (discount_percent/100) discounted_price = original_price - discount_amount result = discounted_price return result
A gardener is preparing a vegetable garden. Each plant needs to be spaced 2 feet apart, and there is a row of 15 feet. How many plants can the gardener fit in the row?
def solve() -> int: row_length = 15 spacing = 2 plants = row_length // spacing result = plants return result
A recipe calls for 2 cups of flour, 1 cup of sugar, and 3/4 cups of milk. If you want to make a double batch, how much of each ingredient do you need to use?
def solve() -> int: flour = 2 sugar = 1 milk = 3/4 double_flour = flour * 2 double_sugar = sugar * 2 double_milk = milk * 2 result = (double_flour, double_sugar, double_milk) return result
A library wants to buy 7 books and 5 magazines per each shelf in three sections. Each section has 12 shelves and each book costs 12 dollars and each magazine costs 8 dollars. How much money would the library spend on books and magazines in all?
def solve() -> int: total_shelves = 3 * 12 books_per_shelf = 7 magazines_per_shelf = 5 total_books = total_shelves * books_per_shelf total_magazines = total_shelves * magazines_per_shelf book_cost = 12 magazine_cost = 8 total_book_cost = total_books * book_cost to...
Ava went to the beauty salon to get a haircut, and then she went to the cafe. If the cafe bill was $24 which was half the cost of her haircut, how much did she spend in total?
def solve() -> int: haircut_cost = 24 * 2 total_cost = haircut_cost + 24 result = total_cost return result
Student: 6. A rectangular rug measures 5 meters by 8 meters. What is the perimeter of the rug in meters?
def solve() -> int: length = 5 width = 8 perimeter = 2 * length + 2 * width result = perimeter return result
A pizza has 8 slices with equal size. If Tom finished 3 slices, how many slices of pizza are remaining?
def solve() -> int: slices_of_pizza = 8 slices_finished = 3 slices_remaining = slices_of_pizza - slices_finished result = slices_remaining return result
Find the sum of the first 10 odd numbers.
def solve() -> int: n = 10 sum = n**2 result = sum return result
What is the total salary of Ruiz in one year after the two raises(2% and 5%)?
def solve() -> int: monthSalary = 521 years = 1 result = monthSalary * 12 * years result = 6252 return result
Liz is a dancer. She trains for 4 hours on Mondays and Thursdays, rehearses for 2 hours on Tuesdays and Fridays and attends dance classes for 1 hour on Wednesdays and Saturdays. How many hours does Liz spend training and rehearsing in total each week?
def solve() -> int: total_hours = 0 total_hours = total_hours + 4 * 2 total_hours = total_hours + 2 * 2 total_hours = total_hours + 1 * 2 result = total_hours return result
Chloe is packing boxes for a move. For every 5 boxes of books, she packs 8 boxes of clothes. She can fit 60 boxes altogether. Each box of books weighs 20 pounds and each box of clothes weighs 10 pounds. How many pounds of boxes will she be carrying in total?
def solve() -> int: books_per_set = 5 clothes_per_set = 8 total_sets = 60 / (books_per_set + clothes_per_set) total_books = total_sets * books_per_set total_clothes = total_sets * clothes_per_set total_weight = (total_books * 20) + (total_clothes * 10) result = total_weight return result...
Student: A painter charges $100 for painting a room and $10 for each gallon of paint used. If the painter needs 2 gallons of paint for each room and paints 3 rooms in a day, how much money does the painter make in a week if he works for 6 days?
def solve() -> int: room_price = 100 paint_price = 10 gallons_per_room = 2 rooms_per_day = 3 days_in_week = 6 total_gallons = gallons_per_room * rooms_per_day * days_in_week total_rooms = rooms_per_day * days_in_week total_price = room_price * total_rooms + paint_price * total_gallons ...
A store puts a markdown of 15% on all items. If a shirt initially costs $25 and a pair of shoes initially costs $70, how much does a customer pay if they buy 3 shirts and 2 pairs of shoes?
def solve() -> int: shirt_cost = 25 shoes_cost = 70 items_bought = 5 discount_percent = 15 discount_decimal = discount_percent/100 total_cost = (shirt_cost*3)+(shoes_cost*2) total_discount = total_cost*discount_decimal total_paid = total_cost-total_discount result = total_paid re...
Student: A jar has 100 candies. Sofia took 25 candies from the jar and gave 10 candies to her brother. How many candies are left in the jar?
def solve() -> int: candies_in_jar = 100 candies_taken = 25 candies_given = 10 candies_left = candies_in_jar - candies_taken - candies_given result = candies_left return result
A triangle has a base of 15 cm and a height of 10 cm. What is the area of the triangle?
def solve() -> int: base = 15 height = 10 area = base * height / 2 result = area return result
Student: A classroom has 30 students. The teacher conducted a test and the class scored an average of 80. If 5 students scored 90 or more, what was the average score of the rest of the class?
def solve() -> int: num_students = 30 total_score = num_students * 80 num_students_90_or_more = 5 total_score_rest = total_score - (num_students_90_or_more * 90) num_students_rest = num_students - num_students_90_or_more result = total_score_rest / num_students_rest return result
At the park, there are 9 children and 12 adults. What fraction of people at the park are adults?
def solve() -> int: children = 9 adults = 12 people = children + adults result = adults / people return result
Jack wants to buy a laptop that costs $600. He also wants to buy a mouse that costs $20 less than 1/10 of the laptop. If his sister wants the same, what will be the total cost of their purchase?
def solve() -> int: laptop_cost = 600 mouse_cost = (1/10) * laptop_cost - 20 total_cost = laptop_cost + mouse_cost result = total_cost return result
Sabrina has an investment account with $5000, which earns 4% interest every year. How much will she have in her account after 5 years, if she doesn't withdraw any money during that time?
def solve() -> int: initial_amount = 5000 interest_rate = 0.04 num_years = 5 future_value = initial_amount * (1 + interest_rate) ** num_years result = future_value return result
There are 45 students in a class, and the class is going on a field trip. If each bus can hold 15 students, how many buses will they need?
def solve() -> int: total_students = 45 students_per_bus = 15 total_buses = total_students // students_per_bus + (total_students % students_per_bus > 0) result = total_buses return result
A recipe requires 2/5 cups of oil. If you want to make 2 batches of the recipe, how many cups of oil do you need in total?
def solve() -> int: oil_per_batch = 2/5 num_batches = 2 total_oil = oil_per_batch * num_batches result = total_oil return result
In Mr. Smith's history class there are 36 students. Of those students, 25% have books. Of those who have books, 50% also have pens. How many students have both books and pens?
def solve() -> int: books = 0.25 * 36 books_and_pens = 0.5 * books result = books_and_pens return result
A class has 40 students. The ratio of girls to boys is 3:2. How many boys are in the class?
def solve() -> int: total_students = 40 ratio_girls = 3 ratio_boys = 2 total_ratio = ratio_girls + ratio_boys boys_fraction = ratio_boys / total_ratio boys_number = boys_fraction * total_students result = boys_number return result
During the first week of school, John's history class gained 17 new students. However, by the end of the year, 1/5 of the class had to drop out for personal reasons. If the class started with 120 students, how many students remained at the end of the year?
def solve() -> int: start_students = 120 new_students = 17 total_students = start_students + new_students dropped_out = total_students / 5 remaining_students = total_students - dropped_out result = remaining_students return result
A garden is 10 feet long and 6 feet wide. If you want to surround the garden with a fence, how much fence material will you need?
def solve() -> int: length = 10 width = 6 perimeter = 2*length + 2*width result = perimeter return result
Jacob weighs 75 kg. He does chin-ups lifting 1.5 times his weight and wearing wrist weights weighing 2 kg. What is his total weight he is lifting?
def solve() -> int: weight = 1.5 * 75 + 2 result = weight return result
Joe has a total of 36 coins consisting of dollar coins and cents. If the value of the coins is $3.60, how many coins of each type does Joe have?
def solve() -> int: dollar_coins = 0 cent_coins = 0 total_coins = 36 value = 3.60 ratio_dollar_to_cent = 1 cent_coins = value - ratio_dollar_to_cent dollar_coins = total_coins - cent_coins result = (dollar_coins, cent_coins) return result
Q7: Alex delivers pizzas and earns 12 tokens per delivery. Every fourth delivery, he gets an extra 3 tokens. If Alex does a total of 50 deliveries, how many tokens does he earn?
def solve() -> int: total_deliveries = 50 tokens_each_delivery = 12 extra_tokens = 3 tokens = 0 while total_deliveries > 0: tokens = tokens + tokens_each_delivery + extra_tokens total_deliveries = total_deliveries - 4 result = tokens return result
Liam buys five bags of popcorn. He eats one bag every day from Monday through Friday and half a bag each during the remaining days of the week. If it takes him 4 such weeks to finish the 5 bags, how many bags are in a popcorn?
def solve() -> int: bags = 5 days_in_week = 7 days_one_bag = 5 days_half_bag = days_in_week - days_one_bag bags_per_week = days_one_bag + 0.5 * days_half_bag total_bags = bags_per_week * 4 bags_in_popcorn = total_bags / bags result = bags_in_popcorn ...
There are 11 students waiting for the science lab and twice as many students waiting for the computer lab. If each student spends 45 minutes in the science lab and 25 minutes in the computer lab, how many minutes shorter is the shorter time?
def solve() -> int: science_lab_students = 11 computer_lab_students = 2 * science_lab_students science_lab_time = 45 computer_lab_time = 25 science_lab_total_time = science_lab_students * science_lab_time computer_lab_total_time = computer_lab_students * computer_lab_time shor...
Maryam has two empty buckets of different sizes, holding either 6 or 9 liters. She fills the 6-liter bucket and pours half of it into the 9-liter bucket. Then, she fills the 6-liter bucket again and pours as much as she can into the 9-liter bucket. How much water, in liters, is in the 9-liter bucket?
def solve() -> int: bucket_6 = 6 bucket_9 = 9 water_6 = 6 water_9 = water_6 / 2 water_6 = water_6 / 2 water_6 = 6 water_9 = min(water_9 + water_6, bucket_9) water_6 = water_6 - (water_9 - water_9) water_in_9 = water_9 result = water_in_9 return result
Ann purchased 6 apples and ate 2/3 of them. How many apples did Ann eat?
def solve() -> int: aaa = 6 bbb = 2 ccc = 3 result = aaa * (bbb / ccc) return result
Kelly had eight cookies and she shared them equally with her two sisters. How many cookies did each sister get?
def solve() -> int: cookies = 8 sisters = 2 cookies_per_sister = cookies / sisters result = cookies_per_sister return result
The length of a hallway is 16 meters. Its width is 5 meters. What is the area of the hallway in square meters?
def solve() -> int: length = 16 width = 5 area = length * width result = area return result
A pizza costs $12. If a person purchases 4 pizzas, they will get a 20% discount on the total bill. How much will they have to pay in total?
def solve() -> int: pizza_cost = 12 number_of_pizzas = 4 discount_percentage = 20 total_bill = pizza_cost * number_of_pizzas discount = total_bill * discount_percentage / 100 final_bill = total_bill - discount result = final_bill return result
One gallon of paint can cover 400 square feet of wall space. If a room has 4 walls that are each 8 feet tall and 12 feet wide, how many gallons of paint are needed to paint the room?
def solve() -> int: wall_height = 8 wall_width = 12 num_walls = 4 total_wall_space = wall_height * wall_width * num_walls gallons_needed = total_wall_space / 400 result = f'<<<{gallons_needed}>>>' result = gallons_needed return result
A vest requires 3.5 feet of fabric. David needs to make 12 vests for the wedding. He has 7 yards of fabric. How many feet of fabric does David still need for the vests?
def solve() -> int: total_yards = 7 feet_per_vest = 3.5 total_feet = feet_per_vest * 12 remaining_feet = total_yards * 3 - total_feet result = round(remaining_feet,2) return result
If the total cost of 4 pens and 3 pencils is $7, and the total cost of 2 pens and 2 pencils is $4, what is the cost of 1 pen and 1 pencil?
def solve() -> int: from sympy import symbols, Eq, solve x, y = symbols('x y') eq1 = Eq(4*x + 3*y, 7) eq2 = Eq(2*x + 2*y, 4) sol = solve((eq1, eq2), (x, y)) pen_cost = sol[x] pencil_cost = sol[y] total_cost = pen_cost + pencil_cost result = total_cost return result
There are 66 orange balls and half as many brown balls. If 22 orange balls and 11 brown balls were thrown away, how many balls are left?
def solve() -> int: orange = 66 brown = orange // 2 thrown_orange = 22 thrown_brown = 11 remaining_orange = orange - thrown_orange remaining_brown = brown - thrown_brown total = remaining_orange + remaining_brown result = total return result
Student: A store has a sale where everything is 20% off. If a shirt originally costs $25, what is the sale price?
def solve() -> int: original_price = 25 discount_rate = 0.2 sale_price = original_price * (1 - discount_rate) result = sale_price return result
Kimberly wants to bake cookies for her friends. She starts with 240 chocolate chips and adds a handful of 32 more chips. However, some of the chips keep falling out of her bag as she walks down the street. When she finally arrives, she only has 195 chips left. How many chocolate chips did Kimberly lose on her way to he...
def solve() -> int: chocolate_chips_start = 240 chocolate_chips_added = 32 chocolate_chips_left = 195 chocolate_chips_lost = (chocolate_chips_start + chocolate_chips_added) - chocolate_chips_left result = chocolate_chips_lost return result
Student: 5. Lindsey bought a new battery for her car that can run for 600 miles when it’s fully charged. She has used up two fifth of the battery, and she is planning to drive a total of 400 miles. How many miles will her car have left when she reaches her destination?
def solve() -> int: battery_capacity = 600 used_up = battery_capacity * 2/5 remaining = battery_capacity - used_up distance = 400 remaining_after_drive = remaining - distance result = remaining_after_drive return result
Possible questions are: Ann, Bob and Carol go to the apple orchard to pick some apples for a pie. They pay $3 each for a basket that can hold up to 10 pounds of apples. The orchard charges $1.5 per pound of apples, but gives a 10% discount if the basket is full. How much do they pay in total if they fill all three bask...
def solve() -> int: basket_weight = 10 num_baskets = 3 total_weight = basket_weight * num_baskets price_per_pound = 1.5 total_cost = total_weight * price_per_pound discount_rate = 0.1 if total_weight == basket_weight * num_baskets: total_cost = total_cost * (1 - discount_rate) ...
Q5: Jorge has 24 watermelons and Leah has 1/4 of that amount. How many watermelons does Leah have?
def solve() -> int: total_watermelons_jorge = 24 total_watermelons_leah = total_watermelons_jorge / 4 result = total_watermelons_leah return result
Sarah is counting the number of books she reads each week for her literature project. On the first week, she read 8 books. On the second week, she read 6 books. On the third week, she read one-half of the number of books she read on the second week. If the average number of books Sarah reads per week for the first thre...
def solve() -> int: week1 = 8 week2 = 6 week3 = week2 / 2 total_books = week1 + week2 + week3 average_books = total_books / 3 difference = 9 - average_books result = difference * 3 return result
Ella has a jar of candy. She counts 24 red candies and 18 green candies. She takes out 6 red candies and 4 green candies. She then adds 12 blue candies to the jar. How many candies are in the jar now?
def solve() -> int: red = 24 green = 18 blue = 12 red_taken = 6 green_taken = 4 candies_before = red + green candies_after = candies_before - red_taken - green_taken + blue result = candies_after return result
Emma wants to plant a garden with a perimeter of 28 meters. If she uses 6 plants per meter, how many plants does she need for her garden?
def solve() -> int: perimeter = 28 num_plants_per_meter = 6 total_plants = perimeter * num_plants_per_meter result = total_plants return result
If a rectangle has a length of 8 cm and a width of 4 cm, what is its area?
def solve() -> int: length = 8 width = 4 area = length*width result = area return result
Here are some possible questions and programs: Emma buys a pack of pencils with 8 green, 16 blue, and half as many red as green. Then she gives away 6 blue and 4 red pencils to her classmates. What percentage of Emma's pencils is green?
def solve() -> int: green = 8 blue = 16 red = green / 2 blue = blue - 6 red = red - 4 total = green + blue + red percentage = (green / total) * 100 result = percentage return result
Student: Frank has six times as many coins as Bob, and Andy has three times as many coins as Bob. If Andy has 162 coins, how many coins does Frank have?
def solve() -> int: bob_coins = 162 / 3 andy_coins = 162 frank_coins = bob_coins * 6 result = frank_coins return result
A recipe for a cake calls for 3 eggs, 2 cups of sugar, and 1 cup of flour. If you want to double the recipe, how many cups of sugar do you need?
def solve() -> int: cups_of_sugar = 2*2 result = cups_of_sugar return result
A store offers a 20% discount on all purchases during a sales event. If a customer purchases a $350 item, how much will they save during the sale?
def solve() -> int: original_price = 350 discount_percentage = 0.2 discount_amount = original_price * discount_percentage result = discount_amount return result
A class has 30 students. If the teacher grades a quiz with 50 questions, how many total points are in the quiz?
def solve() -> int: students = 30 questions = 50 points_per_question = 2 total_points = students * questions * points_per_question result = total_points return result
A farmer has 4536 kg of peaches and packages them in 9 kg boxes. He charges $63 for each box of peaches. How many boxes of peaches does the farmer have and how much money will he receive from the sale?
def solve() -> int: total_weight = 4536 weight_per_box = 9 price_per_box = 63 boxes = total_weight//weight_per_box cost = boxes*price_per_box result = cost return result
Kate has 4 piggy banks with 10 pennies in the first bank, 9 nickels in the second bank and 7 dimes in the third bank. How much, in dollars, does Kate have?
def solve() -> int: pennies = 10 nickels = 9 dimes = 7 total_pennies = pennies total_nickels = nickels*5 total_dimes = dimes*10 total = total_pennies + total_nickels + total_dimes result = total/100 return result
A square has a perimeter of 40 cm. What is the length of one side of the square?
def solve() -> int: perimeter = 40 length_of_one_side = perimeter / 4 result = length_of_one_side return result
A tower is made up of stacked up cubes with each side equal to 30 feet. The tower has to be at least 80 feet tall. How many cubes are needed in the tower?
def solve() -> int: height = 80 side = 30 total_height = side count = 1 while total_height < height: total_height += side count += 1 result = count return result