question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
One pound of apples costs $2.50. Jasmine bought 6 pounds of apples and got a 20% discount because she is a regular customer. She paid with a $20 bill. How much change did Jasmine get back?
def solve() -> int: price_per_pound = 2.50 total_cost = 6 * price_per_pound discounted_price = total_cost * 0.80 change = 20 - discounted_price result = change return result
A rectangle is 10 cm wide and 17 cm long. What is its perimeter and area?
def solve() -> int: width = 10 length = 17 perimeter = 2*(width + length) area = width * length result = (perimeter, area) return result
In a park, there are 200 people, 90 of them play frisbee, 85 of them play soccer, and 40 of them play both. How many people don't play either frisbee or soccer?
def solve() -> int: frisbee = 90 soccer = 85 both = 40 total = 200 result = total - (frisbee + soccer - both) return result
Possible questions and programs are: Dan has a garden with roses. He can cut 12 roses in 15 minutes. He wants to make 20 bouquets of 6 roses each. How long will it take him to cut enough roses for the bouquets?
def solve() -> int: roses_needed = 20 * 6 roses_per_minute = 12 / 15 time_in_minutes = roses_needed / roses_per_minute hours = int(time_in_minutes // 60) minutes = int(time_in_minutes % 60) result = f"It will take Dan {hours} hours and {minutes} minutes to cut enough roses fo...
an and Amber are planning a camping trip for the summer. Sean had $10 saved up and Amber had $15 saved up. Sean then worked at a restaurant at night for a week, earning $25.00 each night, while Amber donated plasma every day for 5 days and earned $30.00 each day. How much more money will Sean and Amber need to make in ...
def solve() -> int: Sean_initial_money = 10 Amber_initial_money = 15 Sean_restaurant_income = 125 Amber_plasma_income = 150 Sean_total = Sean_initial_money + Sean_restaurant_income Amber_total = Amber_initial_money + Amber_plasma_income total_together = Sean_total + Ambe...
If Maria can bake 24 cupcakes in one hour, how many cupcakes can she bake in 3 and a half hours?
def solve() -> int: rate = 24 time = 3.5 total_cupcakes = rate * time result = total_cupcakes return result
Student: Emily's computer login combination requires different components for security reasons. It contains 4 uppercase letters, 6 lowercase letters, 3 numbers, and 2 special characters. How many total characters are in Emily's login combination?
def solve() -> int: uppercase_letters = 4 lowercase_letters = 6 numbers = 3 special_characters = 2 total_characters = uppercase_letters + lowercase_letters + numbers + special_characters result = total_characters return result
repeat Possible questions and programs: Jack and Jill are collecting seashells on the shore. Jack has 3 times as many seashells as Jill does. The total number of seashells they have is 180. If Jill gives 12 seashells to Jack, how many seashells does Jack have now?
def solve() -> int: total = 180 ratio = 3 jill = total / (ratio + 1) jack = ratio * jill given = 12 jack = jack + given result = jack return result
Some possible questions and programs are: Evan has 24 red balloons and 15 blue balloons. He gives his sister half of his red balloons and a third of his blue balloons. How many balloons does he have left?
def solve() -> int: red_given = 24 // 2 blue_given = 15 // 3 red_left = 24 - red_given blue_left = 15 - blue_given total_left = red_left + blue_left result = total_left return result
If a company sold 2535 laptops in a year, and they want to sell 3000 the following year, what percentage increase in sales is that?
def solve() -> int: prev_sales = 2535 new_sales = 3000 sales_increase = new_sales - prev_sales pct_increase = (sales_increase / prev_sales) * 100 result = pct_increase return result
A supermarket sells a box of cereal for $3.75 and a carton of milk for $2.50. If you buy 3 boxes of cereal and 2 cartons of milk, what is your total cost?
def solve() -> int: cereal_cost = 3.75 milk_cost = 2.50 total_cost = 3 * cereal_cost + 2 * milk_cost result = total_cost return result
A cell phone plan charges $10 for unlimited texts and $0.20 per minute for calls. If John spent 100 minutes on calls last month, how much did he pay for his plan?
def solve() -> int: text_charge = 10 calls_minutes = 100 call_charge = 0.20 * calls_minutes total_charge = text_charge + call_charge result = total_charge return result
A car rental company rents 15 more sedans than SUVs every day. If the company rents 45 SUVs every day, how many sedans and SUVs will it rent in a quarter? Assume that a quarter has 90 days.
def solve() -> int: SUVs = 45 sedans = SUVs + 15 days = 90 total_SUVs = SUVs * days total_sedans = sedans * days result = (total_SUVs, total_sedans) return result
The Pirate Captain needs to divide 360 gold coins equally between his 6 crew members. How many gold coins will each crew member get?
def solve() -> int: coins = 360 crew_members = 6 coins_per_member = coins / crew_members result = coins_per_member return result
A store gave out loyalty points to customers. Tiffany received 20 points, then she received twice as much compared to the last time, and then the store gave her additional 10 times the amount she received the last two times. How many points did Tiffany get in total?
def solve() -> int: points_1 = 20 points_2 = 2 * points_1 points_3 = 10 * (points_1 + points_2) total_points = points_1 + points_2 + points_3 result = total_points return result
- Here are some possible questions and programs: Lisa baked some cookies for her classmates. She gave 6 cookies to Kevin and 8 cookies to Amy. She kept 12 cookies for herself and divided the rest equally among 4 other friends. How many cookies did each of her other friends get?
def solve() -> int: kevin = 6 amy = 8 lisa = 12 total = kevin + amy + lisa + 4 * 5 remaining = total - (kevin + amy + lisa) each = remaining / 4 result = each return result
If you have $120 in a savings account that has a 5% interest rate, how much money will you have in the account after one year, assuming no additional deposits or withdrawals?
def solve() -> int: savings = 120 interest_rate = 0.05 savings_after_one_year = savings * (1 + interest_rate) result = savings_after_one_year return result
Student: You have 10 coupons that you can exchange for 15 candies. How many candies can you buy with 30 coupons?
def solve() -> int: coupons = 10 candies = 15 target = 30 ratio = candies / coupons result = ratio * target return result
Julia is buying school supplies. Each notebook costs $2.50 and each pen costs $0.50. If Julia needs to buy enough supplies for 15 students, how much will she spend in total?
def solve() -> int: num_notebooks = 15 notebook_cost = 2.50 num_pens = 15 pen_cost = 0.50 total_notebook_cost = num_notebooks * notebook_cost total_pen_cost = num_pens * pen_cost total_cost = total_notebook_cost + total_pen_cost result = total_cost return result
A company offers a plan to pay for an item in equal installments with no additional interest. A phone costs $600 and is paid over 12 months. How much will John pay each month?
def solve() -> int: total_cost = 600 number_of_payments = 12 payment_per_month = total_cost / number_of_payments result = payment_per_month return result
If the price of a shirt is $20 and it is on sale for 30% off, what is the sale price?
def solve() -> int: price = 20 discount = 0.3 sale_price = price - (price * discount) result = sale_price return result
In a classroom there are 50 students. If 70% of them are girls, how many girls are there in the classroom?
def solve() -> int: total_students = 50 girls = total_students * 0.7 girls = round(girls) result = girls return result
A car rental agency rents cars for $50/day and SUVs for $70/day. If a group of 8 friends wants to rent enough cars and SUVs for their trip, and they need 3 cars and 2 SUVs, how much will they pay?
def solve() -> int: car_rental_price = 50 suv_rental_price = 70 num_cars = 3 num_suvs = 2 total_cost = (num_cars * car_rental_price) + (num_suvs * suv_rental_price) result = total_cost return result
A recipe calls for 2 and 1/2 cups of flour. If you only have 1 and 1/4 cups of flour, how much more flour do you need?
def solve() -> int: required_flour = 2.5 current_flour = 1.25 remaining_flour = required_flour - current_flour result = remaining_flour return result
Student: Jim bought 3 apples for 80 cents each. How much money did Jim pay for the apples?
def solve() -> int: num_apples = 3 price_per_apple = 0.8 total_cost = num_apples * price_per_apple result = total_cost return result
A soccer team has 18 players. Two-sevenths of them prefer orange jerseys. One-third of the remaining players prefer black jerseys, and the rest prefer white jerseys. How many players prefer white jerseys?
def solve() -> int: total_players = 18 orange_players = total_players * 2 / 7 remaining_players = total_players - orange_players black_players = remaining_players / 3 white_players = remaining_players - black_players result = white_players return result
Grace's turtle weighed 1.5 lbs the first time she weighed it at age 1. By the time the turtle was 3 months old, it had quadrupled in weight. It doubled in weight three more times before adding 2 pounds to reach its final weight at 2 years old. How much does the turtle weigh as a full adult in pounds?
def solve() -> int: turtle_weight = 1.5 turtle_weight *= 4 turtle_weight *= 2 turtle_weight *= 2 turtle_weight *= 2 turtle_weight += 2 result = turtle_weight return result
Chloe has two jars of coins. One jar contains 150 pennies and the other jar contains 50 quarters. If she has four times as many dimes as she does pennies and twice as many quarters as she does dimes, how many dimes does she have?
def solve() -> int: pennies = 150 quarters = 50 dimes = pennies * 4 quarters = dimes * 2 result = dimes return result
A baker makes 10 loaves of bread and 16 muffins every day. He sells each loaf of bread for $2 and each muffin for $1.5. However, he also has to pay $0.5 for each ingredient he uses. If he uses 3 ingredients for each loaf of bread and 2 ingredients for each muffin, how much profit does he make every day?
def solve() -> int: total_ingredients = 10 * 3 + 16 * 2 ingredient_cost = total_ingredients * 0.5 bread_revenue = 10 * 2 muffin_revenue = 16 * 1.5 total_revenue = bread_revenue + muffin_revenue total_profit = total_revenue - ingredient_cost result = total_profit return result
A museum has 75 exhibits. One-fourth of them are paintings, and one-seventh of the remaining are sculptures. The rest are photographs. How many exhibits are photographs?
def solve() -> int: total_exhibits = 75 paintings = total_exhibits * 1/4 remaining_exhibits = total_exhibits - paintings sculptures = remaining_exhibits * 1/7 photographs = total_exhibits - paintings - sculptures result = photographs return result
Student: Every day Jane walks 4 miles to work, takes a 30-minute break, and walks 4 miles back home. How many miles does she walk in a week?
def solve() -> int: miles_per_day = 4 * 2 days_per_week = 5 total_miles_per_week = miles_per_day * days_per_week result = total_miles_per_week return result
A bus travels at a speed of 40 km/hour for the first 2 hours and then at a speed of 60 km/hour for the next 4 hours. What is the average speed of the bus for the entire journey?
def solve() -> int: time1 = 2 speed1 = 40 time2 = 4 speed2 = 60 distance = speed1*time1 + speed2*time2 average_speed = distance/(time1+time2) result = average_speed return result
Bianca went to a store and bought 3 items: a silver bracelet, a gold necklace, and a diamond ring. She paid 2 times the price of the bracelet for the necklace, but only a one half the price of the necklace and the ring combined. If the bracelet cost $6, how much, in dollars, did the necklace cost?
def solve() -> int: bracelet = 6 necklace = 2 * bracelet ring = 2 * necklace result = necklace return result
Student: Brett can paint a bedroom in 8 hours and put up curtains in 2 hours. How long will it take him to paint the bedroom and put up the curtains?
def solve() -> int: paint_time = 8 curtain_time = 2 total_time = paint_time + curtain_time result = total_time return result
Student: Liam has 120 stickers. He gave 1/2 of them to his sister. Then he traded 1/3 of his remaining stickers with his friend. How many stickers does he have left?
def solve() -> int: total_stickers = 120 sister_share = 1/2 friend_share = 1/3 stickers_to_sister = total_stickers * sister_share stickers_left = total_stickers - stickers_to_sister stickers_to_friend = stickers_left * friend_share stickers_left = stickers_left - stickers_to_friend ...
Eva ate 8 pieces of cake on Monday and half as many on Tuesday. On Wednesday, Eva ate 8 times as many as she did on Monday. How many pieces of cake did Eva eat in total in the three days? Sarah and John are cooking pasta. Sarah’s pot holds 2 cups more than twice the amount of pasta John’s pot holds. If Sarah’s pot hold...
def solve() -> int: monday_cake = 8 tuesday_cake = monday_cake / 2 wednesday_cake = 8 * monday_cake total_cake = monday_cake + tuesday_cake + wednesday_cake sarah_pot = 8 john_pot = (sarah_pot - 2) / 2 result = total_cake + john_pot return result
A school bought 20 packs of pencils and 15 packs of erasers. Each pack of pencils contained 12 pencils and each pack of erasers contained 10 erasers. If each pencil cost $0.1 and each eraser cost $0.2, how much money did the school spend on the pencils and erasers?
def solve() -> int: pencil_number = 20 * 12 eraser_number = 15 * 10 pencil_cost = pencil_number * 0.1 eraser_cost = eraser_number * 0.2 total_cost = pencil_cost + eraser_cost result = total_cost return result
Mr. Jones buys 8 tickets for a movie theater. The price for an adult ticket is $12. The price for a child ticket is $8. Mr. Jones pays with a $100 bill. How much change does he get back?
def solve() -> int: cost_adult_tickets = 4 * 12 cost_child_tickets = 4 * 8 total_cost_tickets = cost_adult_tickets + cost_child_tickets change = 100 - total_cost_tickets result = change return result
Grant has 30 marbles. If he wants to divide them equally among his 5 friends, how many marbles will each friend get?
def solve() -> int: marbles = 30 friends = 5 result = marbles / friends return result
A square has a perimeter of 20 cm. What is the area of the square?
def solve() -> int: perimeter = 20 side_length = perimeter / 4 area = side_length ** 2 result = area return result
Rachel has to hire a hair stylist. She pays $300 upfront. She then gets charged $50 per styling session. The stylist has to work for 10 sessions. It takes twice that long in hair treatments. Her friend pays half the fee. How much did Rachel pay?
def solve() -> int: upfront_payment = 300 styling_session_cost = 50 num_sessions = 10 hair_treatment_sessions = 2 * num_sessions friend_payment = upfront_payment / 2 total_payment = upfront_payment + (styling_session_cost * num_sessions) + (styling_session_cost * hair_treatment_sessions) + ...
The age difference between Liam and Zoe is one-tenth of the total number of books Zoe has. If their ages add up to 100, and Liam is 40 years old, how many books does Zoe have?
def solve() -> int: liam_age = 40 total_age = 100 zoe_age = total_age - liam_age age_difference = zoe_age - liam_age books = age_difference * 10 result = books return result
am and Jenny have each agreed to save enough money for a trip. Sam earns $1300 a month and saves 1/3 of it. Jenny earns $1200 a month and saves 1/4 of it. How much money will they both have saved after 8 months?
def solve() -> int: sam_monthly_income = 1300 jenny_monthly_income = 1200 sam_savings_ratio = 1/3 jenny_savings_ratio = 1/4 sam_monthly_savings = sam_monthly_income * sam_savings_ratio jenny_monthly_savings = jenny_monthly_income * jenny_savings_ratio monthly_total_saving...
Jackie has 120 crackers and she wants to divide them equally between her 6 friends. Each friend wants her share of crackers to be divided in the ratio of 2:3:4. How many crackers will each friend get?
def solve() -> int: num_crackers = 120 num_people = 6 ratio_sum = 2+3+4 crackers_per_group = num_crackers // num_people crackers_for_ratio_2 = crackers_per_group * 2 // ratio_sum crackers_for_ratio_3 = crackers_per_group * 3 // ratio_sum crackers_for_ratio_4 = crackers_per_group * 4 // ratio...
Ethan, Grace, and Jack are friends who like coins. Ethan has 12 coins, which is 40% of Grace's coins, and Jack has twice as many coins as Ethan. How many coins do all of the friends have?
def solve() -> int: ethan_coins = 12 grace_coins = ethan_coins / 0.4 jack_coins = ethan_coins * 2 total_coins = sum([ethan_coins, grace_coins, jack_coins]) result = total_coins return result
Alex is buying a new bike that costs 20% less than his monthly salary. If Alex earns $5000 per month and $2000 of that goes to taxes and rent, calculate the total amount he spends on the bike and the remaining amount he has left.
def solve() -> int: salary = 5000 taxes_rent = 2000 bike_cost = salary * 0.8 remaining_amount = salary - taxes_rent - bike_cost total_amount = bike_cost + remaining_amount result = total_amount return result
Sam wants to tile his rectangular kitchen which has dimensions of 10 feet by 15 feet. Tiles he is going to use are square and have dimensions of 1 foot by 1 foot. How much tiles does he need to cover the whole kitchen?
def solve() -> int: width = 10 length = 15 tile_area = 1 kitchen_area = width * length tiles_needed = kitchen_area / tile_area result = tiles_needed return result
Mary's Café has 30 muffins in each tray and includes 4 trays in each order. If Ming orders 45 orders of muffins, how many muffins will she get in total?
def solve() -> int: muffins_per_tray = 30 trays_per_order = 4 orders = 45 total_muffins = orders * trays_per_order * muffins_per_tray result = total_muffins return result
Emma buys a bag of candy that weighs 2 pounds and costs $12. She splits the bag equally among her four friends and herself. How much does each person pay for their share of candy?
def solve() -> int: total_weight = 2 people = 5 weight_per_person = total_weight / people price_per_pound = 12 / total_weight cost_per_person = weight_per_person * price_per_pound result = cost_per_person return result
A recipe calls for 2/3 cup of sugar and makes 12 cookies. If you want to make 48 cookies, how much sugar do you need?
def solve() -> int: sugar_per_cookie = 2/3 num_cookies = 48 sugar_needed = (sugar_per_cookie * num_cookies) / 12 result = sugar_needed return result
Student: A rectangular garden has a perimeter of 60 feet and an area of 180 square feet. What are the length and width of the garden?
def solve() -> int: perimeter = 60 area = 180 length = area / (perimeter / 2 - 2) width = perimeter / 2 - length result = (length, width) return result
-Put each new question in a new paragraph Possible new questions: A pizza shop sells 8 slices of pizza every hour, each slice costing $3. How many hours does the shop need to work to earn $360 in revenue?
def solve() -> int: slices_per_hour = 8 slice_price = 3 revenue = 360 slices_needed = revenue / slice_price hours = slices_needed / slices_per_hour result = hours return result
A department store offers a free gift card for a minimum purchase of $75. Michael shopped for clothes and spent $60 on pants and $20 on shirts. How much more does he need to spend to get the free gift card?
def solve() -> int: pants_cost = 60 shirts_cost = 20 minimum_purchase = 75 total_spent = pants_cost + shirts_cost if total_spent < minimum_purchase: amount_needed = minimum_purchase - total_spent else: amount_needed = 0 result = amount_needed return result
Student: Toby has six fewer apples than Cassandra, and gives away 2 apples. How many apples does Toby have if Cassandra has 10?
def solve() -> int: toby = 10 - 6 cassandra = 10 toby = toby - 2 result = toby return result
A bucket of popcorn costs $2 less than a movie ticket. The movie ticket is 75% more expensive than a $8 soda. How much does the bucket of popcorn cost?
def solve() -> int: soda_price = 8 ticket_price = soda_price * 1.75 popcorn_price = ticket_price - 2 result = popcorn_price return result
Student: - Nora has five times as many coins as Oscar. Oscar has six times the number of coins as Pia. Pia has 8 fewer coins than Quinn. How many coins do they have together if Quinn has 24 coins?
def solve() -> int: quinn_coins = 24 pia_coins = quinn_coins - 8 oscar_coins = 6 * pia_coins nora_coins = 5 * oscar_coins total_coins = quinn_coins + pia_coins + oscar_coins + nora_coins result = total_coins return result
Student: Lily rows a boat for 3 hours at a speed of 4 miles per hour. She then stops for 30 minutes to have a snack and rows for another 2 hours at the same speed. How many miles did she cover?
def solve() -> int: time_row1 = 3 speed = 4 time_stop = 0.5 time_row2 = 2 total_time = time_row1 + time_stop + time_row2 total_distance = total_time * speed result = total_distance return result
If the length of a rectangle is decreased by 20% and its width is increased by 25%, what is the percentage change in its area?
def solve() -> int: original_length = 10 original_width = 5 new_length = original_length * 0.8 new_width = original_width * 1.25 original_area = original_length * original_width new_area = new_length * new_width percentage_change = ((new_area - original_area) / original_area) * 100 resul...
Student: A store has a sale where they offer a discount of 20% on all items. If a customer buys a $50 item, how much will they pay after the discount is applied?
def solve() -> int: discount = 0.2 item_price = 50 discounted_price = item_price * (1 - discount) result = discounted_price return result
A marathon is 26.2 miles long. George has already run 12.3 miles. How many more miles does he need to run to complete the marathon?
def solve() -> int: marathon_distance = 26.2 distance_completed = 12.3 distance_remaining = marathon_distance - distance_completed result = distance_remaining return result
The perimeter of a right-angled triangle is 60 meters and the ratio of the length of the shortest side to the length of the hypotenuse is 1:5. Find the area of the triangle in square meters.
def solve() -> int: perimeter = 60 a_to_c = 1/5 a = perimeter * a_to_c * 2 c = perimeter * (1+2*a_to_c) b = (c**2 - a**2)**0.5 area = 0.5 * a * b result = area return result
If Tom works for $30 an hour and works 4 hours a day on weekdays and 5 hours on weekends, how much does he earn in a week?
def solve() -> int: hourly_rate = 30 weekdays_hours_worked = 4 weekends_hours_worked = 5 weekdays = 5 weekends = 2 total_hours_worked = (weekdays * weekdays_hours_worked) + (weekends * weekends_hours_worked) total_pay = hourly_rate * total_hours_worked result = total_pay return resu...
An enterpreneur had $60,000 to start a business and invested 30% of the money. How much money did the entrepreneur invest?
def solve() -> int: total_amount = 60000 amount_invested = 0 amount_invested = total_amount*0.3 result = amount_invested return result
Student: An athlete runs 4km in 20 minutes. How many minutes would it take the athlete to run 8km?
def solve() -> int: distance_1 = 4 time_1 = 20 distance_2 = 8 time_2 = None speed = distance_1 / time_1 time_2 = distance_2 / speed result = time_2 return result
Jeremy goes on a birdwatching trip to four different forests. He spends 1 week in the first forest and doubles the time in each remaining forest. How many weeks does he spend on his trip?
def solve() -> int: first_forest = 1 second_forest = first_forest * 2 third_forest = second_forest * 2 fourth_forest = third_forest * 2 total_weeks = first_forest + second_forest + third_forest + fourth_forest result = total_weeks return result
A restaurant server earns an hourly wage of $8.50 and works 32 hours per week. How much money does the server earn in a week?
def solve() -> int: hourly_wage = 8.50 hours_worked = 32 weekly_pay = hourly_wage * hours_worked result = weekly_pay return result
Amanda is twice as old as her son. Their ages add up to 42. How old is Amanda?
def solve() -> int: Total_age = 42 Son_age = Total_age/3 Amanda_age = 2*Son_age result = Amanda_age return result
Tina made a necklace with 15 beads. Five beads are white and the number of pink beads is two more than the number of white beads. Three beads are purple and the rest are green. How many green beads are there?
def solve() -> int: total = 15 white = 5 pink = white + 2 purple = 3 green = total - white - pink - purple result = green return result
Harry wants to purchase a bike that costs $700. If he buys directly, he pays the full amount but has to pay only $630 if he pays within 10 days. If he opts for an installment plan of 6 months, he has to pay $680. How much can he save if he pays within 10 days?
def solve() -> int: full_price = 700 discount_price = 630 savings = full_price - discount_price result = savings return result
Ben has $80. He wants to buy a book that costs $25 and a toy that costs $15. Can he afford both items?
def solve() -> int: totalMoney = 80 bookCost = 25 toyCost = 15 canAfford = totalMoney >= bookCost + toyCost result = canAfford return result
Karen invests $4000 and after 3 years it grows by 10%. She then withdraws 25% of the portfolio. After 4 more years the remaining portfolio grows by 12%. What is her final portfolio worth after 7 years from when she started?
def solve() -> int: initial_portfolio = 4000 growth_rate_1 = 0.1 years_1 = 3 withdrawal_rate = 0.25 years_2 = 4 growth_rate_2 = 0.12 portfolio_after_growth_1 = initial_portfolio * (1 + growth_rate_1)**years_1 withdrawal_amount = portfolio_after_growth_1 * withdrawal_rate portfolio_af...
A field is 60 feet wide and 100 feet long. If each square foot of the field can produce 4 pounds of crops, how many pounds of crops can be produced from the entire field?
def solve() -> int: width_of_field = 60 length_of_field = 100 total_square_feet = width_of_field * length_of_field pounds_of_crops_per_square_foot = 4 total_pounds_of_crops = total_square_feet * pounds_of_crops_per_square_foot result = total_pounds_of_crops return result
If Jenny is 15 years younger than Sam, and Sam is twice as old as Tom, how old is Jenny when Tom is 12?
def solve() -> int: Tom_age = 12 Sam_age = 2 * Tom_age Jenny_age = Sam_age - 15 result = Jenny_age return result
John wants to make a cake and he needs 500 grams of flour. He only has 250-gram bags of flour. How many bags does he need to buy?
def solve() -> int: total_flour = 500 bag_flour = 250 num_bags = total_flour // bag_flour result = num_bags return result
Alex and his family are going to the beach. They have 18 towels and need one towel per person. If there are 8 people in his family, how many extra towels do they need to buy?
def solve() -> int: towels = 18 family = 8 towels_needed = family * 1 towels_extra = towels_needed - towels result = towels_extra return result
Lisa has 20 marbles. She gives 6 marbles to Tom, and then receives 8 marbles from Mia. How many more marbles does Lisa have than Tom?
def solve() -> int: lisa = 20 - 6 lisa = lisa + 8 tom = 6 difference = lisa - tom result = difference return result
John has 40% of the total money in a group of friends. If he gives $50 to his friend, what percentage of the total money does he have now?
def solve() -> int: john_money_percentage = 0.4 john_money_percentage_after = (0.4 * 100 - 5) / 100 * 100 result = john_money_percentage_after return result
A teacher has 56 pencils and can fit 7 pencils in a row in her pencil case. She also has 70 pens and can fit 5 pens in a row. If she arranges two rows per desk, how many desks does she need for all her writing supplies?
def solve() -> int: num_pencils = 56 pencils_per_row = 7 num_pens = 70 pens_per_row = 5 total_pencil_rows = num_pencils // pencils_per_row total_pen_rows = num_pens // pens_per_row total_rows = total_pencil_rows + total_pen_rows desks_needed = (total_rows + 1) // 2 res...
Student: Lisa went on a shopping spree and bought books, games, and DVDs. She spent $12,000 in total. She spent twice as much on games as she did on books. What she spent on books was 1/4 the cost of DVDs. If Lisa's game purchase was $3,000, what amount did she spend on DVDs?
def solve() -> int: total_cost = 12000 game_cost = 3000 book_cost = game_cost / 2 dvd_cost = book_cost * 4 result = dvd_cost return result
There are 64 students in a class. If each row can fit 4 students, how many rows are needed for all students to be seated?
def solve() -> int: num_students = 64 students_per_row = 4 num_rows = num_students // students_per_row result = num_rows return result
Student: Sam needs to get a loan from the bank for his new home. The total amount that he is seeking is $200,000 and the loan has an interest rate of 5%. How much will he need to pay in total?
def solve() -> int: loan_amount = 200000 interest_rate = 0.05 total_payment = loan_amount * (1 + interest_rate) result = total_payment return result
At the beginning of the month, there were 48 cows in a farm. At the end of the month, 26 cows left. How many cows were left?
def solve() -> int: start = 48 end = 26 result = start - end return result
Kirsten bought a laptop for $750. After 2 years, the laptop depreciated by 10% for every year. How much is the laptop worth now?
def solve() -> int: init_price = 750 num_years = 2 percent_depreciation = 10 / 100 depreciation = init_price * (percent_depreciation * num_years) result = init_price - depreciation return result
Olivia has 15 stickers to give to her friends. She realized she needed 6 more stickers and then gave out 9 stickers to her classmates. How many stickers does Olivia have now?
def solve() -> int: stickers = 15 additional_stickers = 6 given_stickers = 9 total_stickers = stickers + additional_stickers - given_stickers result = total_stickers return result
Student: Shirley has a stack of paper, each paper weigh 100 grams. She gave away one third of the stack and gained an extra 15 paper. How many papers are in the stack now?
def solve() -> int: weight_of_each_paper = 100 number_of_papers_given_away = (1/3) * weight_of_each_paper number_of_papers_gained = 15 result = number_of_papers_given_away + number_of_papers_gained return result
A company sells a product for $50, which costs $30 to make. For every 10 products sold, the company receives an additional $200 in revenue. If the company sells 500 products, what is their profit?
def solve() -> int: product_price = 50 cost_to_make = 30 additional_revenue = 200 total_products_sold = 500 total_revenue = product_price * total_products_sold additional_revenue = (total_products_sold // 10) * additional_revenue total_cost = cost_to_make * total_products_sold...
3. Mrs. Smith counted the number of guests coming to her sons graduation party. In the end, she had 83 guests visiting. She knew that 3 out of every 10 guests were her colleagues. How many of her colleagues visited?
def solve() -> int: total_guests = 83 ratio_colleagues = 3/10 colleagues_visited = total_guests * ratio_colleagues result = "{} colleagues visited Mrs. Smith's son's graduation party.".format(colleagues_visited) return result
The ratio of boys to girls in a class is 5:8. If there are 65 students in the class, how many boys are in the class?
def solve() -> int: total_students = 65 boy_ratio = 5 / (5 + 8) boys = total_students * boy_ratio result = round(boys) return result
A school has enough textbooks for 100 students for 120 days. On the 30th day, 20 students transferred to another school. How many more days will the textbooks be sufficient for the remaining students?
def solve() -> int: students = 100 days = 120 transferred = 20 remaining_students = students - transferred remaining_days = (days - 30) * (students / remaining_students) result = remaining_days - (days - 30) return result
Each navy book has 710 pages. Each lavender book has 640 pages. Harry read 6 navy books and 7 lavender books. How many more navy pages did Harry read than lavender pages?
def solve() -> int: navy_read = 6 * 710 lavender_read = 7 * 640 difference = navy_read - lavender_read result = difference return result
Keri was given the same task as Bianca, Celeste, and McClain but she was only allowed to complete the task in 6.25 hours. How many more hours did Keri have left to finish her task compared to the other 3 combined?
def solve() -> int: hours_combined = 12.5 + (2 * 12.5) + (2 * 12.5 - 8.5) hours_keri = 6.25 result = hours_keri - hours_combined return result
Student: Mary wanted to buy 88 textbooks. eBook textbooks cost $5 and paperback textbooks cost $7. How much money should Mary be prepared to pay for the textbooks?
def solve() -> int: num_ebooks = 88 cost_ebooks = 5 num_paperbacks = 88 cost_paperbacks = 7 total_cost = num_ebooks * cost_ebooks + num_paperbacks * cost_paperbacks result = total_cost return result
Student: A hoodie and a t-shirt have a total cost of $60. If the hoodie costs twice as much as the t-shirt, what is the cost of the t-shirt?
def solve() -> int: hoodie_cost = 0 t_shirt_cost = 0 total_cost = 60 hoodie_cost = 2 * t_shirt_cost total_cost = hoodie_cost + t_shirt_cost total_cost = 2 * t_shirt_cost + t_shirt_cost t_shirt_cost = total_cost / 3 result = t_shirt_cost return result
Mia spends 1/2 of an hour doing homework before and after school. She spends 2 full hours on homework during the weekend. She has a deadline for her assignment in 15 days. How many hours should she plan on setting aside to complete her project?
def solve() -> int: hours_per_day = 1/2 hours_per_weekend = 2 days = 15 total_hours = (hours_per_day * 5) + (hours_per_weekend * 2) + (hours_per_day * days) result = total_hours return result
Student: A rectangular room is 10 meters long, 8 meters wide and 5 meters high. What is the volume of the room?
def solve() -> int: length = 10 width = 8 height = 5 volume = length * width * height result = volume return result
A bookshelf has 4 shelves, each holding 15 books. If 20 books are removed, how many are left on the bookshelf?
def solve() -> int: total_books = 4 * 15 books_left = total_books - 20 result = books_left return result
A bowl of candies has 24 chocolates, 18 gummy bears, and 30 lollipops. If one candy is randomly chosen, what is the probability of choosing a gummy bear?
def solve() -> int: total_candies = 24 + 18 + 30 gummy_bears = 18 probability = gummy_bears / total_candies result = probability return result
A pizza parlor sells a 12-inch pizza for $8. If a 16-inch pizza costs $14, how much cheaper is the 12-inch pizza?
def solve() -> int: price_12 = 8 price_16 = 14 cost_per_inch_12 = price_12 / 12 cost_per_inch_16 = price_16 / 16 price_difference = cost_per_inch_16 - cost_per_inch_12 result = price_difference return result
Student: Ali collects stamps from different countries. He has 25 stamps from China, 15 stamps from India, and 10 stamps from Brazil. He wants to arrange them in rows of 5 stamps each. How many rows does he need and how many stamps will he have left over?
def solve() -> int: china = 25 india = 15 brazil = 10 total = china + india + brazil rows = total // 5 remainder = total % 5 result = (rows, remainder) return result
This year, Larry had gone to the library 4 times and had stayed for 5 hours each time. How many hours has Larry spend at the library this year?
def solve() -> int: def library_hours(trips, hours): total_hours = trips*hours return total_hours result = library_hours(4, 5) return result