question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Katie and Ryan each received $50 from their parents. Katie spent 60% of her money on new clothes while Ryan saved his money and didn't spend any of it. How much did Katie and Ryan spend in total, in dollars?
def solve() -> int: katie_money = 50 ryan_money = 50 katie_spent = katie_money * 0.6 ryan_spent = 0 total_spent = katie_spent + ryan_spent result = total_spent return result
A box contains 4 dozen eggs and 3 times as many oranges as eggs. If half of the oranges are bad, how many good oranges are there in the box?
def solve() -> int: egg_count = 4*12 orange_count = 3*egg_count bad_oranges = 0.5*orange_count good_oranges = orange_count - bad_oranges result = good_oranges return result
A hospital had 100 beds with 26 patients occupying them. 16 patients were discharged and another 12 were admitted. How many beds are left unoccupied in the hospital?
def solve() -> int: beds = 100 occupied = 26 discharged = 16 admitted = 12 remaining = occupied - discharged + admitted unoccupied = beds - remaining result = unoccupied return result
Alex the programmer develops 3 new apps but only 2 are successful, when he tries to sell to a tech giant he's told his apps are outdated. If Alex earns $1000 for every successful app he develops, how much money is he left with?
def solve() -> int: successful_apps = 2 earning_per_app = 1000 total_earning = successful_apps * earning_per_app result = total_earning return result
Student: A plant grows at a rate of 0.3 inches per day. If it was initially 4 inches tall, how tall will it be after 3 weeks?
def solve() -> int: growth_rate = 0.3 initial_height = 4 days_in_a_week = 7 weeks = 3 total_days = weeks * days_in_a_week total_growth = growth_rate * total_days final_height = initial_height + total_growth result = final_height return result
Lily has one-third as many flowers as Maya. Maya has three times as many flowers as Nina. If Nina has 15 flowers, how many flowers does Lily have?
def solve() -> int: nina = 15 maya = 3 * nina lily = 1 / 3 * maya result = lily return result
A car can travel a distance of 60 km in 2 hours. What is the speed of the car in km/h?
def solve() -> int: distance = 60 time = 2 speed = distance / time result = speed return result
If Emma can do a bicep curl with 40 pounds for 10 reps but increases the reps to 15, how much more weight can she lift to maintain the same level of exertion?
def solve() -> int: initial_weight = 40 initial_reps = 10 new_reps = 15 weight_increase = (new_reps / initial_reps) * initial_weight - initial_weight result = weight_increase return result
A bag of jelly beans contains 5 red, 6 blue, and 4 green candies. If a person randomly selects one candy, what is the probability it will be blue?
def solve() -> int: total_candies = 5 + 6 + 4 probability_blue = 6/total_candies result = probability_blue return result
Tom had 90 marbles in his jar. He lost 20 of them while playing with his friends. He then found 15 more marbles on the ground and put them in his jar. How many more marbles did he need to have 100 marbles in his jar?
def solve() -> int: marbles = 90 marbles = marbles - 20 marbles = marbles + 15 difference = 100 - marbles result = difference return result
If a rectangular field has an area of 450 square meters, and its length is 15 meters, what is the width of the field?
def solve() -> int: area = 450 length = 15 width = area / length result = width return result
Jenny bought 10 apples at $2 each, 5 oranges at $1 each, and 2 pineapples at $5 each. If she gave a $20 bill, how much change did she receive?
def solve() -> int: apples_cost = 2*10 oranges_cost = 1*5 pineapples_cost = 5*2 total_cost = apples_cost + oranges_cost + pineapples_cost change = 20 - total_cost result = change return result
A swimmer swims 100 meters in 2 minutes. What is the average speed of the swimmer in meters per second?
def solve() -> int: distance = 100 time = 2 * 60 speed = distance / time result = speed return result
The school nurse wants to determine the average temperature of every of the 36 students in grade 3A. She takes the temperature of each student and find out that the average temperature is 34.56°C. How much temperature change does she have to make in order to raise the average temperature to 36°C?
def solve() -> int: n = 36 avg_temp = 34.56 target_temp = 36 total_diff = (target_temp - avg_temp) * n result = total_diff return result
A student weighs 80 kg at the start of summer break. He is on a diet that allows him to lose 2.5 kg per week until school starts again. How much will he weigh on the first day of school?
def solve() -> int: start_weight = 80 weight_loss_per_week = 2.5 weeks = 12 final_weight = start_weight - (weight_loss_per_week * weeks) result = final_weight return result
If a recipe calls for 2 cups of sugar, but you only have 1 cup, how much more do you need?
def solve() -> int: sugar_needed = 2 current_sugar = 1 extra_sugar_needed = sugar_needed - current_sugar result = extra_sugar_needed return result
A pizza place offers a deal of buy one pizza and get another one for half price. The regular price of a pizza is $10. How much does it cost to buy 4 pizzas with the deal?
def solve() -> int: cost_of_one_pizza = 10 cost_of_second_pizza = 10 * 0.5 cost_of_two_pizzas = cost_of_one_pizza + cost_of_second_pizza cost_of_four_pizzas = cost_of_two_pizzas * 2 result = cost_of_four_pizzas return result
Michelle goes to the gym every weekday morning for one hour, and goes on a 50 mile bike ride every weekend. If Michelle bikes at a rate of 15 miles per hour, how many hours does she spend exercising in a week?
def solve() -> int: weekday_hours = 1 weekend_miles = 50 bike_rate = 15 weekday_time = weekday_hours * 5 weekend_time = weekend_miles / bike_rate total_time = weekday_time + weekend_time result = total_time return result
A glass bottle measures 12 cm by 6 cm by 8 cm. A recycling plant wants to melt eight glass bottles and mold them into glass balls. Each glass ball has a volume of 3 cubic cm. How many glass balls have been molded?
def solve() -> int: length = 12 width = 6 height = 8 volume_bottle = length * width * height volume_ball = 3 num_bottles = 8 total_volume_bottles = volume_bottle * num_bottles num_balls = total_volume_bottles // volume_ball result = num_balls return result
Isaac sees five ships on the horizon and tries to estimate their lengths. He knows that the one in the middle is 70 meters long. The one on the left looks like it is 60% of the length of the middle one. The one on the right looks 25 meters shorter than if the ship on the left and middle were attached end to end. How lo...
def solve() -> int: middle_ship = 70 left_ship = 0.6 * middle_ship right_ship = left_ship + middle_ship - 25 total_length = middle_ship + left_ship + right_ship result = total_length return result
A runner takes 30 minutes to run the first 2 miles of a race. He then runs the next 3 miles in 20 minutes. What is the average speed of the runner for the entire race?
def solve() -> int: distance1 = 2 distance2 = 3 time1 = 0.5 time2 = 0.33 total_time = time1 + time2 total_distance = distance1 + distance2 average_speed = total_distance / total_time result = average_speed return result
A toy rocket has an acceleration of 4 m/s². It starts from rest, and will reach maximum velocity in 10 seconds. What is the rocket's maximum velocity?
def solve() -> int: acceleration = 4 time = 10 velocity = acceleration * time result = velocity return result
A train travels at an average speed of 80 miles per hour. If the train travels for 6 hours, how far will it go?
def solve() -> int: avg_speed = 80 time = 6 distance = avg_speed * time result = distance return result
A street has 12 houses numbered from 1 to 12. If the sum of the house numbers on one side of the street is 49, what is the sum of the house numbers on the other side of the street?
def solve() -> int: total_houses = 12 sum_of_one_side = 49 sum_of_all_houses = (total_houses*(total_houses+1))//2 sum_of_other_side = sum_of_all_houses - sum_of_one_side result = sum_of_other_side return result
In a class of 30 students, 20% of them are failing math. If 40% of the students who are not failing math are boys, how many boys are in the class?
def solve() -> int: num_failing_math = 30 * 0.2 num_passing_math = 30 - num_failing_math num_girls = num_passing_math * 0.6 num_boys = num_passing_math - num_girls result = num_boys return result
A recipe calls for 2 cups of flour and 1 cup of sugar to make 12 cookies. How much flour and sugar are needed to make 36 cookies?
def solve() -> int: x = (2 * 36) / 12 y = (1 * 36) / 12 result = (x, y) return result
Ben is a painter, he charges $50 for painting a small room and $100 for painting a large room. If he painted 2 small rooms and 1 large room on Monday, 3 small rooms and 2 large rooms on Tuesday, and 4 small rooms and 1 large room on Wednesday, how much did he earn in total?
def solve() -> int: small_room_price = 50 large_room_price = 100 total_small_rooms = 2 + 3 + 4 total_large_rooms = 1 + 2 + 1 small_room_earnings = total_small_rooms * small_room_price large_room_earnings = total_large_rooms * large_room_price total_earnings = small_room_earn...
A rectangular prism has dimensions of length 6 cm, width 4 cm, and height 9 cm. What is the volume of the prism?
def solve() -> int: length = 6 width = 4 height = 9 volume = length * width * height result = f'The volume of the rectangular prism is {volume} cubic centimeters.' result = volume return result
Carlos has 20 candies and he wants to divide them equally among his 4 friends and himself. He realizes that he has one extra candy. How many candies does each person get?
def solve() -> int: candies = 20 people = 5 candies_per_person = candies // people extra = candies % people result = candies_per_person return result
John has 16 dolls. He gives two thirds of them to Lena and a quarter of them to Nancy. How many dolls does John have left?
def solve() -> int: dolls_given_to_lena = 16 * (2/3) dolls_given_to_nancy = 16 * (1/4) dolls_left_with_john = 16 - dolls_given_to_lena - dolls_given_to_nancy result = dolls_left_with_john return result
After winning a $1000 prize, Ryan decided to split the money equally among himself and two friends. Ryan spent $80 on drinks and then the rest of his money was equally shared among three people, himself and his two friends. How much did each friend receive?
def solve() -> int: prize_money = 1000 ryan_share = prize_money / 3 money_after_drinks = ryan_share - 80 total_shares = 3 friend_share = money_after_drinks / total_shares result = friend_share return result
Michelle ran 20 miles in the morning. In the evening, she cycled only half the distance she had run in the morning. If she travelled a total distance of 40 miles that day, how far did Michelle cycle in the evening?
def solve() -> int: morning_running = 20 total_distance = 40 evening_cycling = (total_distance - morning_running)/2 result = evening_cycling return result
Student: 8. John collected 10 stones while at the beach. He kept 2 stones for himself and gave the rest to his sister. How many stones did John give to his sister?
def solve() -> int: stones_collected = 10 stones_kept = 2 stones_given = stones_collected - stones_kept result = stones_given return result
John is making a square-shaped cake and wants the ratio of the length of the sides to be 3:4:5. What is the length of each side?
def solve() -> int: side1 = 3 side2 = 4 side3 = 5 side1_len = side1 * side2 * side3 / ((side1 ** 2) * (side2 ** 2) * (side3 ** 2)) ** 0.5 side2_len = side1_len * side2 side3_len = side1_len * side3 result = (side1_len, side2_len, side3_len) return result
If Miko's weight is 10 kilograms less than triple the weight of Angel, and their total weight is 72 kilograms, how much does Angel weigh?
def solve() -> int: angel_weight = (72 + 10) / (3 + 1) result = angel_weight return result
Karen baked 36 cupcakes and 48 muffins. She sold each cupcake for $1.50 and each muffin for $2.00 at a bake sale. She donated 25% of her earnings to a charity. How much money did she keep for herself?
def solve() -> int: cupcake_num = 36 muffin_num = 48 cupcake_price = 1.50 muffin_price = 2.00 cupcake_earnings = cupcake_num * cupcake_price muffin_earnings = muffin_num * muffin_price total_earnings = cupcake_earnings + muffin_earnings donation_fraction = 0.25 donation = total_e...
Grace and Gavin decided to start a furniture business. Grace invested $6,000 while Gavin invested 5/6 as much as Grace. The company earned a 9% profit on the total investment, and they decided to split the profits equally. What was each person's share of the profits?
def solve() -> int: grace_investment = 6000 gavin_investment = grace_investment * 5/6 total_investment = grace_investment + gavin_investment profit = total_investment * 0.09 grace_share = profit / 2 gavin_share = profit / 2 result = f'Grace\'s share of the profits is ${grace_share:.2f} ...
Ben has a jar of candy that contains 12 red candies, 8 blue candies, and 4 green candies. He wants to share the candy with his 5 siblings equally. How many candies of each color will each sibling get?
def solve() -> int: RED_CANDIES = 12 BLUE_CANDIES = 8 GREEN_CANDIES = 4 SIBLINGS = 5 total_candies = RED_CANDIES + BLUE_CANDIES + GREEN_CANDIES candies_each = total_candies / SIBLINGS red_each = RED_CANDIES / SIBLINGS blue_each = BLUE_CANDIES / SIBLINGS green_each = GR...
Lily loves collecting stickers and has an album of 150 stickers in her backpack. She recently bought 30 new stickers and used 10 stickers to decorate her notebook. She then traded 5 stickers with her friend and received 7 stickers in return. She then bought another 20 stickers and used 8 stickers to decorate her phone ...
def solve() -> int: stickers = 150 bought = 0 bought += 30 bought -= 10 bought -= 5 bought += 7 bought += 20 bought -= 8 bought -= 10 bought += 4 stickers += bought result = stickers return result
Emma is shopping for a new phone. The phone company is offering a deal where you can get 50% off your new phone if you trade in your old one. If the new phone costs $900.00 and Emma's old phone is worth $200.00, how much money does she save with the 50% off deal?
def solve() -> int: new_phone_cost = 900.00 old_phone_value = 200.00 discount = 0.5 discounted_price = new_phone_cost * discount trade_in_value = old_phone_value total_savings = discounted_price + trade_in_value result = total_savings return result
san earns $25 an hour for working in the store, she works 5 days a week for 8 hours a day. How much money does Susan make in 3 weeks?
def solve() -> int: total_hours_in_3_weeks = 8 * 5 * 3 total_earnings = total_hours_in_3_weeks * 25 result = total_earnings return result
Student: Tim runs for 30 minutes at a pace of 5 miles per hour and then runs for another 45 minutes at a pace of 6 miles per hour. What is his total distance?
def solve() -> int: time1 = 30/60 time2 = 45/60 pace1 = 5 pace2 = 6 distance1 = time1 * pace1 distance2 = time2 * pace2 total_distance = distance1 + distance2 result = total_distance return result
A hotel has 8 floors with 20 rooms on each floor. If all the rooms in the hotel are rented out, how many guests are staying in the hotel?
def solve() -> int: num_rooms = 8 * 20 num_guests = num_rooms result = num_guests return result
The average of three numbers is 10. If one of the numbers is 5, what are the other two numbers?
def solve() -> int: avg = 10 num1 = 5 total = avg * 3 num2_plus_num3 = total - num1 num2 = num2_plus_num3 / 2 num3 = num2_plus_num3 / 2 result = f"The other two numbers are {num2} and {num3}" return result
Student: A rectangular lawn has a length of 30 meters and a width of 20 meters. If we divide the lawn into four equal parts, what is the area of each part?
def solve() -> int: length = 30 width = 20 area = length * width part_area = area / 4 result = part_area return result
Possible new questions and programs are: Jenny wants to bake some cookies for her friends. She has a recipe that makes 24 cookies and requires 2 cups of flour, 1 cup of sugar, and 0.5 cup of butter. She only has 4 cups of flour, 2.5 cups of sugar, and 1.25 cups of butter in her pantry. How many cookies can she make wit...
def solve() -> int: flour_ratio = 4 / 2 sugar_ratio = 2.5 / 1 butter_ratio = 1.25 / 0.5 limiting_ratio = min(flour_ratio, sugar_ratio, butter_ratio) cookies_per_batch = 24 max_cookies = limiting_ratio * cookies_per_batch result = int(max_cookies) return result
A group of 70 students went to the zoo. One third of them went to see the monkeys first, and then half of the remaining students went to see the giraffes. If there were 11 students remaining, how many students went to the zoo?
def solve() -> int: total_students = 70 monkeys_first = total_students//3 remaining_students = total_students - monkeys_first giraffes_second = remaining_students//2 remaining_students = remaining_students - giraffes_second students_went_to_zoo = remaining_students + monkeys_first + giraffes_sec...
A rectangular box has dimensions of 5 cm by 4 cm by 3 cm. A factory wants to stack 8 such boxes and put them in a bigger box. The bigger box can take a maximum of 48 cubic cm. What is the volume of the empty space in the bigger box?
def solve() -> int: length_box=5 width_box=4 height_box=3 vol_box=length_box*width_box*height_box num_box=8 vol_8box=num_box*vol_box max_space=48 empty_space=max_space-vol_8box result=empty_space return result
Anthony wants to buy snacks for his party. He needs to purchase 4 bags of chips and 6 bottles of soda. The chips cost $3 each and the soda costs twice that amount. How much does he spend in total? Jacob and Emily went apple picking. Jacob picked 24 apples and Emily picked 16. Emily challenged herself to pick 5 oranges ...
def solve() -> int: num_chips = 4 num_soda = 6 chip_cost = 3 soda_cost = chip_cost * 2 total_cost = (num_chips * chip_cost) + (num_soda * soda_cost) num_apples_jacob = 24 num_apples_emily = 16 num_oranges_emily = num_apples_jacob * 5 num_oranges_emily = num_oranges_emily / ...
Student: A car driving at a steady speed of 100 km/h will travel how far in 1 hour, 30 min?
def solve() -> int: speed = 100 time = 1.5 distance = speed * time result = distance return result
A store sells a product for $50 and gives a 10% discount. How much will a customer pay for the product?
def solve() -> int: price = 50 discount = price * 0.10 total = price - discount result = total return result
A car can travel 28 miles per gallon of gas. If it has a 15 gallon tank, how far can it go before needing to refuel?
def solve() -> int: gas_mileage = 28 tank_size = 15 distance_before_refuel = gas_mileage * tank_size result = distance_before_refuel return result
Isla and Aiden are training for a tennis tournament and need to build their stamina. If Aiden can play twice as many games as Isla every hour and he plays for 2 hours, how many games will they have played together?
def solve() -> int: isla_games_per_hour = 5 aiden_games_per_hour = 2 * isla_games_per_hour aiden_hours_played = 2 isla_hours_played = 2 total_isla_games = isla_games_per_hour * isla_hours_played total_aiden_games = aiden_games_per_hour * aiden_hours_played total_games_played = total_isl...
Mia has a bag of candies, and she eats 25% of them every month. If there were 80 candies in the bag initially, how many candies are left after 6 months?
def solve() -> int: initial_candies = 80 eaten_candies = initial_candies * 0.25 remaining_candies = initial_candies - eaten_candies for i in range(5): eaten_candies = remaining_candies * 0.25 remaining_candies = remaining_candies - eaten_candies result = remaining_candies return ...
A family has a total of 5 children. The ages of the youngest and oldest children add to 10. If the average age of the children is 7, what is the sum of the ages of the 3 middle children?
def solve() -> int: youngest = 0 oldest = 10 middle_three_sum = (7*5) - youngest - oldest middle_three_sum -= min(middle_three_sum-3*oldest, 3*oldest-middle_three_sum) // 2 middle_three_sum -= max(middle_three_sum-3*youngest, 0) // 2 result = middle_three_sum return result
Kelly runs a lemonade stand on Saturdays. She sells each cup of lemonade for $0.75 and spends $0.25 on the ingredients for each cup. She sells an average of 60 cups per day. How much money does she make in a month (assume 4 Saturdays)?
def solve() -> int: net_income = 0.75 - 0.25 net_income_day = net_income * 60 net_income_month = net_income_day * 4 result = net_income_month return result
Alison is purchasing a ticket for a concert worth $80. The website is giving her 5% off the ticket price if she books two or more seats. She also has a $12 off coupon for her purchase, but it can only be used on her first transaction. How much will Alison pay for her ticket after using both the discount and coupon?
def solve() -> int: ticket_price = 80 discount = 0.05 coupon = 12 if ticket_price >= 2 * ticket_price: ticket_price -= ticket_price * discount ticket_price -= coupon result = ticket_price return result
Jenny has 15 percent fewer stickers than Clara, and Sam has four times as many stickers than Jenny. If Clara has 40 stickers, how many stickers does Sam have?
def solve() -> int: clara_sticker = 40 jenny_sticker = clara_sticker * 0.85 sam_sticker = jenny_sticker * 4 result = sam_sticker return result
Student: A school has 250 students and 20 teachers. Each student has to pay $5 for a field trip, and each teacher has to pay $10. The school also has to pay $100 for the bus rental. How much money does the school need to collect for the field trip?
def solve() -> int: students = 250 teachers = 20 student_fee = 5 teacher_fee = 10 bus_rental = 100 student_total = students * student_fee teacher_total = teachers * teacher_fee collected_total = student_total + teacher_total difference = collected_total - bus_rental result = diff...
Student: Gayle bought 3 dozen donuts that cost $1.50 per dozen. How much did Gayle spend in total?
def solve() -> int: num_dozen = 3 price_per_dozen = 1.50 total_cost = num_dozen * price_per_dozen result = total_cost return result
A furniture store has 30 lamps for sale but 10 of them had broken lightbulbs. After discarding those lamps, they started selling the remaining ones to customer Y who bought 1, customer Z who bought a certain amount, and customer A who bought 5 lamps. How many lamps were sold to customer Z?
def solve() -> int: total_lamps = 30 broken_lamps = 10 remaining_lamps = total_lamps - broken_lamps customer_Y = 1 customer_A = 5 lamps_sold = customer_Y + customer_A lamps_sold_to_Z = remaining_lamps - lamps_sold result = lamps_sold_to_Z return result
If Denise walks 6 kilometers per day, how many kilometers will she walk in 9 days?
def solve() -> int: distance_per_day = 6 days = 9 total_distance = distance_per_day * days result = total_distance return result
Linda deposited a check for $75, which was worth a fifth of her new account balance after the check amount was added. What was her account balance before depositing the check?
def solve() -> int: check_amount = 75 fraction_of_balance = 1/5 new_balance = check_amount / fraction_of_balance old_balance = new_balance - check_amount result = old_balance return result
Max just opened a new restaurant and need to buy oranges for his famous recipe. Each orange costs $0.75 and he needs to buy 90 oranges. How much money will he spend in total?
def solve() -> int: ORANGE_PRICE = 0.75 NUMBER_ORANGES = 90 ORANGE_TOTAL = ORANGE_PRICE * NUMBER_ORANGES result = ORANGE_TOTAL return result
A pizza parlor makes 12 pizzas in one hour. How many pizzas can they make in 5 hours?
def solve() -> int: pizzas_per_hour = 12 total_pizzas_in_five_hours = pizzas_per_hour * 5 result = total_pizzas_in_five_hours return result
Tom buys a car for $27,000. The dealer offers him to pay in three installments of $9,000 each. How much did Tom pay in total?
def solve() -> int: payment1 = 9000 payment2 = 9000 payment3 = 9000 total_payment = payment1 + payment2 + payment3 result = 27000 return result
When Maryann, Ned, Owen, and Penelope were conversing about their houses, Maryann mentioned that the total area of the other three houses was the same as her own. Her goal was to have a house that was 3 times bigger than what she had now. Ned said that when he first moved in, he could onlyDuring a lunch break, Mr. John...
def solve() -> int: sandwiches = 25 wraps = 3 * sandwiches total_people = sandwiches + wraps result = total_people return result
q:Carol and David want to buy some books from an online store. They find 5 books that they like, each costing $12. The online store charges $5 for shipping, but offers free shipping for orders over $50. They also have a promo code that gives them 20% off their order. How much do Carol and David pay for their books?
def solve() -> int: books = 5 book_price = 12 book_cost = books * book_price shipping_base = 5 shipping_threshold = 50 if book_cost >= shipping_threshold: shipping_cost = 0 else: shipping_cost = shipping_base total_cost = book_cost + shipping_cost discount_rate = 0.2 ...
A family has 3 sons and 2 daughters. How many children are in the family in total?
def solve() -> int: sons = 3 daughters = 2 total_children = sons + daughters result = total_children return result
Student: Ten fruits, Apple, Banana, Cherry, Date, Elderberry, Fig, Grape, Honeydew, Kiwi, and Lemon, have 60000 seeds. Grape has 1/6 times the total seeds in the ten fruits. If the seeds of Apple are 40 percent of Grape's seeds, how many seeds does Kiwi have?
def solve() -> int: apple = 0 banana = 0 cherry = 0 date = 0 elderberry = 0 fig = 0 grape = 0 honeydew = 0 kiwi = 0 lemon = 0 total_seeds = 60000 grape = total_seeds / 6 apple = 0.4 * grape one_fruit = (total_seeds - apple - grape) / 8 banana = one_fruit c...
A box of 250 pencils costs $25. How many pencils can you buy for $100?
def solve() -> int: cost_per_pencil = 25 / 250 num_pencils_per_dollar = 1 / cost_per_pencil num_pencils_for_100_dollars = num_pencils_per_dollar * 100 result = f'<<<{num_pencils_for_100_dollars}>>>' result = num_pencils_for_100_dollars return result
A teacher has 45 students in a class. If the pass rate is 60%, how many students passed the class?
def solve() -> int: num_students = 45 pass_rate = 0.6 num_passed = int(num_students * pass_rate) result = num_passed return result
If each day Jacob spends $16.80 on food, and he plans to save for two weeks, how much money will he have saved?
def solve() -> int: cost = 16.8 * 14 result = 235.2 return result
A bag contains 5 red balls and 3 blue balls. If you select three balls at random (without replacement), what is the probability that at least two of them are red?
def solve() -> int: total_balls = 8 total_red_balls = 5 total_second_red_balls = 4 total_third_red_balls = 3 result = (total_red_balls/total_balls) * (total_second_red_balls/(total_balls-1)) * (total_third_red_balls/(total_balls-2)) result += (total_red_balls/total_balls) * ((total_balls-total_r...
There are 30 students in a math class. Eighteen students are boys and the rest are girls. What is the ratio of boys to girls in the math class?
def solve() -> int: boys = 18 girls = 30 - boys result = boys / girls return result
John deposited $10,000 in a savings account that pays 3% interest per year. If he made no withdrawals, how much would he have after 4 years?
def solve() -> int: principal = 10000 rate = 0.03 time = 4 amount = principal * ((1 + rate) ** time) result = f"${round(amount, 2)}" result = round(amount, 2) return result
A plant nursery has 200 plants in its inventory. They sold 15 plants in-store on Tuesday and 20 plants online. On Wednesday, they sold twice as many plants in-store and increased their online sales by 10 plants. They also received a delivery of 120 plants. How many plants do they currently have?
def solve() -> int: inventory = 200 plants_sold_instore_tuesday = 15 plants_sold_online_tuesday = 20 plants_sold_instore_wednesday = plants_sold_instore_tuesday * 2 plants_sold_online_wednesday = plants_sold_online_tuesday + 10 plants_received_wednesday = 120 total_sold_tuesda...
A book has 280 pages. In the first week, Sarah read 1/7 of the book. In the second week, she read 30 more pages than she did in the first week. In the third week, she read 3/7 of the remaining pages. How many pages were left unread by the end of week three?
def solve() -> int: total_pages = 280 week1 = total_pages * (1/7) week2 = week1 + 30 remaining_pages = total_pages - week1 - week2 week3 = remaining_pages * (3/7) unread_pages = remaining_pages - week3 result = unread_pages return result
Student: On Saturday, Emma has 45 eggs. She ate a quarter of the eggs and gave away 5 eggs. On Sunday, Emma ate a third of the eggs, how many eggs does Emma have left?
def solve() -> int: eggs_on_saturday = 45 eggs_eaten_on_saturday = eggs_on_saturday / 4 eggs_left_on_saturday = eggs_on_saturday - eggs_eaten_on_saturday - 5 eggs_eaten_on_sunday = eggs_left_on_saturday / 3 eggs_left_on_sunday = eggs_left_on_saturday - eggs_eaten_on_sunday result = eggs_left_on_...
Molly wants to become more flexible. She dedicates 20 minutes a day to stretching, and attends two hour-long yoga classes each week. How many hours total does she spend stretching each week?
def solve() -> int: stretching_minutes_per_day = 20 yoga_classes_per_week = 2 minutes_per_hour = 60 stretching_minutes_per_week = stretching_minutes_per_day * 7 stretching_hours_per_week = stretching_minutes_per_week / minutes_per_hour yoga_hours_per_week = yoga_classes_per_week * 1 ...
Ryan and Rachel were solving math problems. In the first session, Ryan solved 12 problems, which was two less than Rachel. In the second session, Ryan solved four problems less than Rachel who solved 16 problems. How many problems did Ryan and Rachel solve in the two sessions?
def solve() -> int: rachel_problems = 12 + 2 ryan_problems = rachel_problems - 4 total_problems = rachel_problems + 16 + ryan_problems + 4 result = total_problems return result
Alice bought three shirts at $25 each and two skirts at $30 each. If she gets a 20% discount on all the items she purchased, how much did she pay in all?
def solve() -> int: shirts_cost = 3 * 25 skirts_cost = 2 * 30 total_cost = shirts_cost + skirts_cost discount = 0.2 * total_cost total_cost_after_discount = total_cost - discount result = total_cost_after_discount return result
The ratio of the length of a rectangle to its width is 3:4. If the width is 24, find the length.
def solve() -> int: num1 = 3/4 num2 = 24*num1 result = int(num2) return result
Sarah has $20.00 worth of nickels. Her cousin, John, has a third of that amount but then trades 8 nickels for 2 dimes. How many nickels does John have now?
def solve() -> int: nickels_sarah = 20.00 nickels_john = nickels_sarah / 3 dimes = 8 / 2 nickels_john -= dimes result = nickels_john return result
An investor invests $10,000 in an investment with an annual interest rate of 3%. After four years, what is the total amount of money invested by the investor?
def solve() -> int: investment = 10000 year_1 = investment * 1.03 year_2 = year_1 * 1.03 year_3 = year_2 * 1.03 year_4 = year_3 * 1.03 total_amount = year_4 result = total_amount return result
Student: A recipe calls for 2/3 cup of sugar. If you want to make half the recipe, how much sugar is needed?
def solve() -> int: recipe_amount = 2/3 desired_amount = 0.5 sugar_needed = desired_amount * recipe_amount result = sugar_needed return result
A car dealership wants to increase their sales by 15%. If they sell 200 cars per month, how many cars will they need to sell to reach their goal?
def solve() -> int: sales_goal = 200 * 1.15 result = sales_goal return result
A right triangle has legs of 15 cm and 20 cm. What is the length of the hypotenuse of the triangle in cm?
def solve() -> int: from math import sqrt leg1 = 15 leg2 = 20 hypotenuse = sqrt(leg1**2 + leg2**2) result = hypotenuse return result
Possible new questions and programs: Tony works as a part-time tutor and charges $15 per hour for teaching math and $20 per hour for teaching science. He teaches 3 math students and 2 science students every week, with each student having a 2-hour session. How much does Tony earn in a month with 5 weeks?
def solve() -> int: math_rate = 15 science_rate = 20 math_students = 3 science_students = 2 session_hours = 2 math_income = math_rate * math_students * session_hours science_income = science_rate * science_students * session_hours monthly_income = (math_income + science_income) * 5 r...
A student studied in the library for 8 hours and read a total of 240 pages. How many pages did the student read in each hour if the time was divided equally?
def solve() -> int: total_pages = 240 total_hours = 8 pages_per_hour = total_pages / total_hours result = pages_per_hour return result
Nathan is saving his money to buy a new watch that costs $200. His weekly allowance is $10. His parent will pay him an extra $25 to grocery shop. His neighbor will pay him $8 per hour to clean the pool. He has already saved up $150. He plans on cleaning the pool for 3 hours this Sunday. How much more money does Nathan ...
def solve() -> int: watch_cost = 200 weekly_allowance = 10 grocery_payment = 25 pool_cleaning_rate = 8 hours_cleaning_pool = 3 current_savings = 150 total_earnings = weekly_allowance + grocery_payment + (pool_cleaning_rate * hours_cleaning_pool) + current_savings money_needed =...
A bike store has 20 bikes, some in red and some in blue. If there are twice as many red bikes as blue, how many red and blue bikes are there?
def solve() -> int: total_bikes = 20 ratio_red_blue = 2 num_blue = total_bikes / (ratio_red_blue + 1) num_red = num_blue * ratio_red_blue result = (num_red, num_blue) return result
A customer has 18 books and 24 items with her for check out. If each item is charged at $2, how much money does the customer have to pay in total?
def solve() -> int: books = 18 items = 24 price_per_item = 2 total_cost = books + items * price_per_item result = total_cost return result
Student: Maria went shopping and bought 4 bags of chips costing $3 each, 3 bottles of juice costing $2 each and 5 bags of popcorn costing $1.50 each. How much did she pay in total?
def solve() -> int: num_chips = 4 cost_chips = 3 num_juice = 3 cost_juice = 2 num_popcorn = 5 cost_popcorn = 1.50 total_cost = num_chips * cost_chips + num_juice * cost_juice + num_popcorn * cost_popcorn result = total_cost return result
Matthew saves for the holiday season by putting away $10 in January, $20 in February, $30 in March, and so on. By the end of the year, how much will he have saved?
def solve() -> int: amount_saved = 0 for i in range(12): amount_saved += (i+1)*10 result = amount_saved return result
A thief has broken into a museum and taken a sculpture, which weighed 18 kg. How many distance he can cross with his loot in a period of four miles when his weight is 68 kg?
def solve() -> int: totalWeight = 68 + 18 distance = 4 * totalWeight result = distance return result
Nadia has 28 meters of ribbon and needs to divide them so that each of the 8 boxes get the same amount. How many meters of ribbon will each box get?
def solve() -> int: total_ribbon = 28 num_boxes = 8 result = total_ribbon // num_boxes return result
Elliot harvested 52 apples and filled 7 baskets, how many apples are in each basket?
def solve() -> int: applesAmount = 52 basketsAmount = 7 inEach = applesAmount // basketsAmount result = inEach return result
**** Craig owns 28 texts books. Each text book contains 700 pages. He lent out 8 of the text books to his classmate. How many pages worth of text books does Craig have left?
def solve() -> int: total_pages = 28 * 700 num_lent_books = 8 pages_lent = num_lent_books * 700 result = total_pages - pages_lent return result
Katie sells cookies that are 2/3 as many as Alex's. If the combined number of cookies they sold is 90, how many cookies did Katie sell?
def solve() -> int: alex_cookies = 90 katie_cookies = (2/3) * alex_cookies result = katie_cookies return result