question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Joe needs to buy batteries for his toys, each toy requires 3 batteries. If he has 15 toys, how many batteries does he need to purchase?
def solve() -> int: toys = 15 batteries_each_toy = 3 batteries_to_buy = toys * batteries_each_toy result = 45 return result
There are 42 students in a class. If 18 students are girls and the rest are boys. What is the percentage of boys in the class?
def solve() -> int: total_students = 42 girls = 18 boys = total_students - girls boys_percentage = (boys/total_students)*100 result = boys_percentage return result
Sophie and Jack are collecting coins for a charity. Sophie has 18 more coins than Jack, and Jack has 6 times as many coins as Oliver. If Oliver has 5 coins, how many coins do they have together?
def solve() -> int: oliver = 5 jack = 6 * oliver sophie = jack + 18 total = oliver + jack + sophie result = total return result
John runs for 2 miles every day for 3 days a week for 10 years. How many miles did he run in total?
def solve() -> int: days_per_week = 3 weeks_per_year = 52 years = 10 miles_per_day = 2 total_miles = miles_per_day * days_per_week * weeks_per_year * years result = total_miles return result
Jason wants to buy a video game for $59.99. If he has a coupon for 10% off and has to pay 7.5% tax, how much will he end up spending in total?
def solve() -> int: video_game_price = 59.99 coupon_percentage = 0.1 tax_percentage = 0.075 discounted_price = video_game_price * (1 - coupon_percentage) total_cost = discounted_price * (1 + tax_percentage) result = total_cost return result
Jennifer has 20 coins consisting of quarters and nickels. If the total value of the coins is $3.25, how many of each coin does she have?
def solve() -> int: num_coins = 20 total_value = 3.25 for num_quarters in range(num_coins + 1): num_nickels = num_coins - num_quarters value = (0.25 * num_quarters) + (0.05 * num_nickels) if value == total_value: break result = (num_quarters, num_nickels) retur...
Jen goes to the movie theater every weekend. She pays $30 for a ticket. If she goes to the movies every weekend for 10 weeks, how much does she spend in total?
def solve() -> int: cost = 30 weeks = 10 total_cost = cost * weeks result = total_cost return result
Jacob wants to install a pool in his backyard. He spends $500 on permits and then hires a contractor who charges $100 per hour and works for 3 days at 7 hours per day. He also pays a lifeguard 75% less to certify the pool's safety. How much does it all cost?
def solve() -> int: permits = 500 contractor_rate = 100 contractor_hours = 3 * 7 lifeguard_discount = 0.75 contractor_cost = contractor_rate * contractor_hours lifeguard_cost = contractor_cost * (1 - lifeguard_discount) total_cost = permits + contractor_cost + lifeguard_cost re...
Anna buys 6 books from a bookstore. The original price of each book is $8, but she gets a 25% discount. How much does she pay in total?
def solve() -> int: books_bought = 6 original_price = 8 discount_rate = 0.25 discounted_price = original_price * (1 - discount_rate) total_payment = books_bought * discounted_price result = total_payment return result
A skateboarder starts at a speed of 5 m/s and accelerates at a rate of 2 m/s^2 for 10 seconds. What is the final speed of the skateboarder?
def solve() -> int: final_speed = 5 + 2 * 10 result = f'<<<{final_speed}>>>' result = final_speed return result
A warehouse can hold up to 1,200 boxes. If 60 boxes are unloaded in the next hour and 100 are shipped out, how many more boxes can the warehouse store before reaching its capacity?
def solve() -> int: warehouse_capacity = 1200 boxes_unloaded = 60 boxes_shipped = 100 net_boxes = boxes_unloaded - boxes_shipped remaining_capacity = warehouse_capacity - net_boxes result = remaining_capacity return result
Ian is planning a road trip and needs to make sure he has enough money for gas. He knows his car gets 25 miles per gallon and the trip is 500 miles long. He also knows gas is $3 per gallon. How much money will he need to spend on gas?
def solve() -> int: miles_per_gallon = 25 trip_distance = 500 gas_price = 3 gallons_needed = trip_distance / miles_per_gallon total_cost = gallons_needed * gas_price result = total_cost return result
Student: Emma has 8 markers and her brother gives her 5 more. If she gives 3 markers to her friend, how many markers does Emma have left?
def solve() -> int: markers_emma = 8 markers_emma += 5 markers_emma -= 3 result = markers_emma return result
A teacher wants to divide a class of 30 students into groups of 5. How many groups can the teacher form?
def solve() -> int: total_students = 30 students_in_group = 5 groups = total_students // students_in_group result = groups return result
A store has a sale where everything is 20% off the regular price. If a shirt normally costs $25, how much will it cost during the sale?
def solve() -> int: regular_price = 25 discount_percentage = 0.2 discounted_price = regular_price - (regular_price * discount_percentage) result = discounted_price return result
A rectangle has a width of 10cm and a ratio of 3:8 for its length to width. What is the length of the rectangle?
def solve() -> int: width = 10 ratio = 3 / 8 length = width / ratio result = length return result
In China, they normally produce an average of 2000 toys a day. With 250 days left in the year, they've produced 450,000 toys. How many toys on average do they need to produce to match the normal average?
def solve() -> int: average_toys_per_day = 2000 days_left = 250 total_toys_produced = 450000 toys_needed_to_match_average = (average_toys_per_day * days_left) - total_toys_produced result = toys_needed_to_match_average return result
How many 1-inch cubes can fit into a rectangular prism with a length of 4 inches, a width of 3 inches, and a height of 2 inches?
def solve() -> int: l = 4 w = 3 h = 2 cube_volume = 1 rect_volume = l * w * h result = rect_volume // cube_volume return result
Q1. Marie is 10 years old. She gave $800 to her grandparents as a gift. She spent two-fifth of it at a store. Fernando, her brother, spent twice as much as Marie. How much money did Fernando spend?
def solve() -> int: marie = 800 fernando = 2*marie result = fernando return result
Student: Roger has 225 donuts. He gives away 1/4 of them. How many donuts does he have left?
def solve() -> int: donuts = 225 donuts_given_away = donuts * 1/4 donuts_left = donuts - donuts_given_away result = donuts_left return result
Rachel aims to drink 2 liters of water in a day. She drinks 300 milliliters of water every 2 and a half hours. In how many hours will she consume her daily water intake goal?
def solve() -> int: liters_per_day = 2 milliliters_per_hour = 300 hours_per_interval = 2.5 milliliters_per_day = liters_per_day * 1000 intervals_per_day = milliliters_per_day / milliliters_per_hour hours_per_day = intervals_per_day * hours_per_interval result = hours_per_day re...
New blank line Write your questions below: A cake is cut into 24 equal slices. Four slices are eaten by Alice, six slices are eaten by Bob, and the rest are shared equally by Charlie and David. How many slices does each of them get?
def solve() -> int: total = 24 remaining = total - 4 - 6 share = remaining / 2 result = share return result
Student: Q6: Sheila baked 5 cookies last week. Each cookie has 3 pieces of chocolate chips. This week she tripled the amount of cookies she baked. How many pieces of chocolate chips did Sheila use in total?
def solve() -> int: cookies_last_week = 5 chocolate_chips_per_cookie = 3 chocolate_chips_last_week = cookies_last_week * chocolate_chips_per_cookie cookies_this_week = cookies_last_week * 3 chocolate_chips_this_week = cookies_this_week * chocolate_chips_per_cookie total_chocolate_chips = chocola...
Carla and Maria are comparing their button collections and want to know whose collection has more buttons. They are about to count each button, but their mother suggests that they see whose collection has more buttons per unit area. Carla's collection has more buttons, but then Maria notices that Carla's buttons have a...
def solve() -> int: carla_area = 200 carla_buttons_per_inch = 5 carla_total_buttons = carla_area * carla_buttons_per_inch maria_area = 50 maria_buttons_per_inch = 20 maria_total_buttons = maria_area * maria_buttons_per_inch if carla_total_buttons > maria_total_buttons: resu...
A group of friends went out to eat. The total bill including tax was $125.75. If the tax rate was 8%, what was the cost of the meal itself, without tax?
def solve() -> int: total_bill = 125.75 tax_rate = 0.08 meal_cost = total_bill / (1 + tax_rate) result = "Your answer here" return result
Possible questions and programs: Jane buys a 10-pound bag of apples. She uses 3 pounds of apples to make a pie and the rest to make juice. How many ounces of juice does she get if she needs 8 ounces of apples for 1 cup of juice?
def solve() -> int: pounds_for_juice = 10 - 3 ounces_for_juice = pounds_for_juice * 16 cups_of_juice = ounces_for_juice / 8 ounces_of_juice = cups_of_juice * 8 result = ounces_of_juice return result
Lucas has a fish tank with 3 goldfish, 2 angelfish, and 1 betta fish. How many fish are in the tank?
def solve() -> int: goldfish = 3 angelfish = 2 betta_fish = 1 total_fish = goldfish + angelfish + betta_fish result = total_fish return result
If there are six times as many apples as mangoes in a certain fruit basket and the basket has 24 apples, how many fruits would Mark have left if he eats 5/7 of each fruit's quantity in the basket?
def solve() -> int: apples = 24 mangoes = apples / 6 fruits_consumed = (apples * 5/7) + (mangoes * 5/7) fruits_remaining = (apples + mangoes) - fruits_consumed result = fruits_remaining return result
Jack has to pay $60 for his monthly Wi-Fi bill. He does extra chores in the neighborhood that pay him $10 each. If he has to pay his bills for the next 6 months, how many more chores does he have to do to cover his Wi-Fi costs?
def solve() -> int: bill = 60 extra_chore_pay = 10 months = 6 total_earnings = extra_chore_pay * months remaining_bill = bill * months - total_earnings extra_chores_needed = remaining_bill / extra_chore_pay result = extra_chores_needed return result
Liam buys 4 packs of gum for $0.75 each and 2 chocolate bars for $1.25 each at a convenience store. He also gets a lottery ticket for $2.00 and a pack of cigarettes for $8.00. He pays with a $20 bill and does not receive any change. How much sales tax does he pay? Assume the sales tax rate is 7%.
def solve() -> int: gum_price = 0.75 chocolate_price = 1.25 lottery_price = 2.00 cigarette_price = 8.00 subtotal = 4 * gum_price + 2 * chocolate_price + lottery_price + cigarette_price sales_tax = subtotal * 0.07 total = subtotal + sales_tax paid = 20 - total ...
Valerie is currently 25 years old. In 6 years, she will be one-fifth the age of her grandfather. How old is Valerie's grandfather today? John and Sarah are running around a park. John can run 10 laps around the park and each lap is 400 meters. Sarah can run 15 laps around the park and each lap is 200 meters. Every time...
def solve() -> int: valerie_age = 25 age_diff = (1/5) * (valerie_age + 6) grandfather_age_in_6_years = age_diff + 6 grandfather_age = grandfather_age_in_6_years - 6 john_distance = 10 * 400 sarah_distance = 15 * 200 total_distance = john_distance + sarah_distanc...
Student: A gym has 150 members. They lose 20% of their members and then gain 50 more members. If they now have a total of 170 members, how many members did they lose?
def solve() -> int: initial_members = 150 members_lost = initial_members * 0.2 new_members = initial_members - members_lost members_gained = 50 final_members = new_members + members_gained members_lost = initial_members - final_members result = members_lost return result
Student: Betty bought 3 boxes of chocolates, each with 24 pieces. She gave away half of the chocolates to her friends and ate 4 pieces herself. How many chocolates does she have left?
def solve() -> int: num_boxes = 3 pieces_per_box = 24 total_pieces = num_boxes * pieces_per_box half_pieces = total_pieces / 2 remaining_pieces = half_pieces - 4 result = remaining_pieces / pieces_per_box return result
Student: 1. April deposited $5,000 in a bank account in January. She also deposited $3,000 in the same account in February and $2,000 in March. What is the total amount of money currently in April’s account?
def solve() -> int: january_deposit = 5000 february_deposit = 3000 march_deposit = 2000 total_amount = january_deposit + february_deposit + march_deposit result = total_amount return result
The large box is 10 inches longer than the medium box, and the medium box is 5 inches longer than the small box. If the large box is 30 inches long, how long is the small box in inches?
def solve() -> int: small = 1 medium = small + 5 large = medium + 10 small = 30 - 5 - 10 result = small return result
Denise is making a quilt that is 60 inches wide and 80 inches long. She has 10 inch by 10 inch squares of fabric in different colors. How many squares of fabric does she need to make the quilt?
def solve() -> int: quilt_width = 60 square_width = 10 squares_width = quilt_width / square_width quilt_length = 80 square_length = 10 squares_length = quilt_length / square_length squares_total = squares_width * squares_length result = squares_total return result
Mary inherited a sum of $300,000 from her grandfather and invested some of it in a mutual fund with a return rate of 6% per year. After 2 years, she had earned $36,000 from the mutual fund. How much did she originally invest?
def solve() -> int: rate = 0.06 time = 2 interest = 36000 principal = interest/(rate*time) result = principal return result
If a car travels 45 miles in 1.5 hours, what is its average speed in miles per hour (mph)?
def solve() -> int: average_speed = 45/1.5 result = average_speed return result
If the first telescope was invented 400 years ago, how many years in the future will it be 50 years before its 500th anniversary of being invented?
def solve() -> int: first_telescope_invented = 400 years_until_500th_anniversary = 500 - first_telescope_invented years_before_500th_anniversary = years_until_500th_anniversary - 50 result = years_before_500th_anniversary return result
In a store, there are 50 shirts on sale. If 3/8 of the shirts are blue and 15 shirts are green, how many shirts are not blue or green?
def solve() -> int: shirt_count = 50 blue_shirts = shirt_count * 3 / 8 green_shirts = 15 other_shirts = shirt_count - blue_shirts - green_shirts result = other_shirts return result
Maria needs 4 ingredients to make her famous salsa. It costs $10 to buy all of the ingredients and she sells each jar of salsa for $8 at the farmer's market. If she sells 15 jars, what is her net profit?
def solve() -> int: cost_of_ingredients = 10 price_per_jar = 8 number_of_jars = 15 total_cost = cost_of_ingredients total_revenue = price_per_jar * number_of_jars net_profit = total_revenue - total_cost result = net_profit return result
How much chocolate would be in a 9-pound box of the same chocolate bar?
def solve() -> int: pounds = 9 pound_to_kg = 0.453592 kg = pounds * pound_to_kg total_weight_kg = kg * 2 weight_bar = 125 total_bars = total_weight_kg * 1000 / weight_bar result = total_bars return result
What is the total amount of food each side is eating after 15 days?
def solve() -> int: first_side_soldiers = 4000 second_side_soldiers = first_side_soldiers - 500 first_side_food = 10 second_side_food = first_side_food - 2 days = 15 total_first_side_food = first_side_soldiers * first_side_food * days total_second_side_food = second_side_soldiers * seco...
arah has a total of 100 stickers - 40 of them are unicorns, 20 of them are cats, and the rest are dogs. What is the percentage of unicorn stickers in total?
def solve() -> int: dog_stickers = 100 - 40 - 20 total_unicorns = 40 percentage_unicorns = (total_unicorns / 100) * 100 result = percentage_unicorns return result
Jill spends $15 every week on gas and $25 every week on groceries. If Jill's income is $200 per week, how much money will she have left after her expenses for 4 weeks and 2 days?
def solve() -> int: weekly_expenses = 15 + 25 total_expenses = weekly_expenses * 4 + weekly_expenses * 2/7 money_left = 200 - total_expenses result = money_left return result
Jack collects 9 stamps, 6 coins, and 3 postcards from different countries. Each stamp has a value of 10 cents, each coin has a value of 25 cents, and each postcard has a value of 50 cents. How much is Jack's collection worth?
def solve() -> int: stamps = 9 stamp_value = 0.10 coins = 6 coin_value = 0.25 postcards = 3 postcard_value = 0.50 stamp_total = stamps * stamp_value coin_total = coins * coin_value postcard_total = postcards * postcard_value collection_total = stamp_total + coin_total +...
Liam had 60 coins. He spent 15 coins on a toy car and 12 coins on a comic book. He earned 20 coins by mowing the lawn and 10 coins by washing the dishes. How many coins does Liam have now?
def solve() -> int: coins_left = 60 - 15 - 12 coins_left = coins_left + 20 + 10 result = coins_left return result
In a volleyball season, Dave scored an average of 55 points in each of his 10 games. If he wants to have an average of 65 for the season, how many points must he score in the remaining 12 games?
def solve() -> int: total_games = 22 games_played = 10 total_points = 55 * games_played required_points = 65 * total_games points_needed = required_points - total_points result = float(points_needed / 12) return result
A manufacturer has produced 5000 units of a product. If the defective rate of the product is 2%, how many units are defective?
def solve() -> int: total_units = 5000 defective_rate = 0.02 num_defective = total_units * defective_rate result = num_defective return result
Chris had 35 stickers. Lily gave him double her own 20 stickers. How many stickers does Chris have now?
def solve() -> int: chris_stickers = 35 lily_stickers = 20 chris_stickers += 2 * lily_stickers result = chris_stickers return result
A recipe calls for 2 1/2 cups of milk but you only have a 1/2 cup measuring cup. How many times do you need to fill up the cup to get the right amount of milk?
def solve() -> int: required_amount = 2.5 measuring_cup = 0.5 num_cups_needed = required_amount/measuring_cup result = num_cups_needed return result
Manuel is trying to make pizza dough. He plans to make 4 pizzas. his pizza dough recipe calls for 2 cups of flour for each pizza. How many cups of flour does he need to buy for all 4 pizzas?
def solve() -> int: numberofpizzas = 4 cupsofflour_per_pizza = 2 total_cupsofflour = numberofpizzas * cupsofflour_per_pizza result = total_cupsofflour return result
Liam has a collection of 12 toy soldiers. He loses half of his toy soldiers but he still has three times as many as his sister. How many toy soldiers do they have altogether?
def solve() -> int: toy_soldiers = 12 lost_soldiers = toy_soldiers / 2 remaining_soldiers = toy_soldiers - lost_soldiers sister_soldiers = remaining_soldiers / 3 total_soldiers = remaining_soldiers + sister_soldiers result = total_soldiers return result
Julie and her family drove 350 kilometers to a zoo. If their average speed was 40 km/h and they stopped every two hours for 20 minutes for lunch, how long did it take them to get to the zoo?
def solve() -> int: total_time = 350 / 40 rest_time = 20 / (60 * 2) total_time += rest_time result = total_time return result
Student: A phone plan costs $20 per month plus an additional $0.10 per minute. If you talk for 150 minutes in one month, how much will your bill be?
def solve() -> int: monthly_cost = 20 per_minute_cost = 0.10 minutes = 150 total_cost = monthly_cost + per_minute_cost * minutes result = total_cost return result
Tom drives 70 miles per hour and wants to drive 500 miles. How long will it take him to reach his destination?
def solve() -> int: speed = 70 distance = 500 time = distance / speed result = time return result
A box contains 25 pens and 15 pencils. If 5 pens are removed, what is the new ratio of pens to pencils in the box?
def solve() -> int: pens_initial = 25 pencils_initial = 15 pens_final = pens_initial - 5 pens_to_pencils = f'{pens_final}:{pencils_initial}' result = pens_to_pencils return result
David borrowed $5,000 from his friend at a 6% annual interest rate. He agreed to pay back the loan in 12 equal monthly installments. How much interest did he pay in total at the end of the year?
def solve() -> int: monthly_rate = 0.06 / 12 payment = (monthly_rate * 5000) / (1 - (1 + monthly_rate) ** -12) total_payment = payment * 12 interest = total_payment - 5000 result = interest return result
Eva is planning a road trip and wants to drive a total of 1500 miles. If she can only drive for 4 hours per day, how many days will it take her to complete the trip if she travels the same distance each day?
def solve() -> int: total_distance = 1500 hours_per_day = 4 days = total_distance / hours_per_day result = days return result
A company has two offices, one in New York and one in Los Angeles. The company has 1200 employees in total, and 45% of them work in the New York office. How many employees work in the Los Angeles office?
def solve() -> int: total_employees = 1200 ny_ratio = 0.45 ny_employees = total_employees * ny_ratio la_employees = total_employees - ny_employees result = round(la_employees, 2) return result
Samantha had 36 balloons. She found 22 more balloons at a party and her mom bought her 14 more balloons. Samantha gave 8 balloons to her cousin and 6 to her neighbor. How many balloons does Samantha have left?
def solve() -> int: balloons_start = 36 balloons_found = 22 balloons_bought = 14 balloons_given_cousin = 8 balloons_given_neighbor = 6 total_balloons = balloons_start + balloons_found + balloons_bought total_given = balloons_given_cousin + balloons_given_neighbor balloons_left = tot...
Here are some possible new questions and Python programs: Rita has three dogs. Each one drinks 3 cups of water in the morning and 4 cups of water in the evening. She also fills a large bowl with 12 cups of water for them to share during the day. How many cups of water does she need for her dogs for 5 days?
def solve() -> int: cups_per_dog = 3 + 4 cups_shared = 12 cups_per_day = cups_per_dog * 3 + cups_shared cups_for_five_days = cups_per_day * 5 result = cups_for_five_days return result
A class has 50 students. If the ratio of boys to girls is 3:4, how many girls are in the class?
def solve() -> int: total_students = 50 boy_ratio = 3 girl_ratio = 4 total_ratio = boy_ratio + girl_ratio girl_ratio = girl_ratio / total_ratio girls_count = girl_ratio * total_students result = girls_count return result
A company employs 50 people, 30 of whom are women. What percentage of the employees are women?
def solve() -> int: total_employees = 50 num_women = 30 percent_women = (num_women / total_employees) * 100 result = percent_women return result
Stella is making flower arrangements. She needs seven stems of lilies for each arrangement. Her lily plant has approximately 50 stems. How many flower arrangements can Stella make with her lily plant?
def solve() -> int: lily_stems = 50 stems_per_arrangement = 7 arrangements = lily_stems // stems_per_arrangement result = arrangements return result
A rectangular garden has a length of 15 meters and a width of 10 meters. Alice wants to plant flowers along the perimeter of the garden. She needs one flower for every meter of the perimeter. How many flowers does she need?
def solve() -> int: perimeter = 2 * (15 + 10) flowers = perimeter * 1 result = flowers return result
Kieran buys a phone for $600, which is 15% less than what Taylor bought the same phone for. How much did Taylor pay for her phone?
def solve() -> int: price_kieran = 600 discount_percentage = 15 price_taylor = price_kieran / (1 - discount_percentage/100) result = price_taylor return result
Emma attends swimming lessons every Saturday and Sunday during the week for a total of 8 hours. If she spends 4 hours every Saturday, how many hours does she spend swimming on Sunday?
def solve() -> int: total_hours = 8 hours_per_saturday = 4 hours_for_sunday = total_hours - hours_per_saturday result = hours_for_sunday return result
A rectangular prism-shaped fish tank is 24 inches long, 12 inches wide, and 16 inches tall. How much water is needed to fill it completely?
def solve() -> int: length = 24 width = 12 height = 16 volume = length * width * height water_needed = volume / 231 result = water_needed return result
There are 420 candies in a bag. 24% of the candies are sour, and a quarter of those also have rainbow colors. How many sour and rainbow colored candies are there?
def solve() -> int: candies = 420 sour_candies = candies * 0.24 sour_and_rainbow_colored_candies = sour_candies * 0.25 result = sour_and_rainbow_colored_candies return result
In a library with 800 books, 20% of the books are fiction, and 15% of the fiction books are mysteries. How many of the fiction books are not mysteries?
def solve() -> int: books = 800 fiction_percentage = 0.2 mystery_percentage = 0.15 fiction_books = books * fiction_percentage fiction_mystery_books = fiction_books * mystery_percentage fiction_non_mystery_books = fiction_books - fiction_mystery_books result = fiction_non_mystery_books re...
Anna likes to collect stickers, so she has been counting how many stickers she has. Today, she has 120 stickers, which is 50% more than what she had a week ago. How many stickers did Anna have a week ago?
def solve() -> int: stickers_today = 120 factor = 1.5 stickers_a_week_ago = stickers_today / factor result = stickers_a_week_ago return result
Noah needs to travel 480 miles. He can travel 65 miles per hour. How long would it take him to travel the entire distance?
def solve() -> int: distance = 480 speed = 65 time = distance / speed result = time return result
The ratio of dogs to cats at a pet shop is 3:5. If there are 40 cats, how many dogs are there?
def solve() -> int: cat_ratio = 5 / (3 + 5) dogs = 40 / cat_ratio result = dogs return result
If a number is multiplied by 8, and the result is 72, what is the number?
def solve() -> int: result_mult = 72 num = result_mult/8 result = num return result
Student: John works part-time and earns $12 per hour. Last week, he worked 25 hours and used $40 from his paycheck to buy groceries. How much money did he have left after buying groceries?
def solve() -> int: hourly_wage = 12 hours_worked = 25 amount_spent = 40 total_earnings = hourly_wage * hours_worked remaining_amount = total_earnings - amount_spent result = remaining_amount return result
The volume of a cube is 27 cubic centimeters. What is the length of one edge of the cube?
def solve() -> int: volume = 27 edge_length = volume ** (1/3) result = edge_length return result
Student: If 40% of a number is 100, what is the number?
def solve() -> int: percentage = 40 number = 100 result = number / (percentage / 100) return result
Student: John went shopping for 3 days. He spent a total of $700. On the first day, he spent $200. How much did he spend on the remaining two days?
def solve() -> int: total_spent = 700 first_day_spent = 200 remaining_days_spent = total_spent - first_day_spent result = remaining_days_spent return result
Student: A bike is on sale for 20% off its original price of $500. What is the sale price?
def solve() -> int: original_price = 500 discount_percentage = 0.2 sale_price = original_price * (1 - discount_percentage) result = sale_price return result
Jake wants to buy snacks for his road trip. There are 4 people in the car. If each person wants 5 snacks, and each pack has 10 pieces, how many packs of snacks does he need to buy?
def solve() -> int: num_people = 4 num_snacks_per_person = 5 num_snacks_per_pack = 10 total_snacks_needed = num_people * num_snacks_per_person num_packs_needed = total_snacks_needed / num_snacks_per_pack result = num_packs_needed return result
Sam is making lemonade for a party. He needs 6 lemons for every liter of water. He has 24 lemons and 4 liters of water. How many liters of lemonade can he make?
def solve() -> int: ratio = 6 / 1 lemon_water = 24 / ratio lemonade = min(lemon_water, 4) result = lemonade return result
Oliver has half as many toys as Sophia. Chloe has three times as many toys as Sophia. If Chloe has 45 toys, how many toys do Oliver, Sophia, and Chloe have altogether?
def solve() -> int: sophia_toys = 45 / 3 oliver_toys = sophia_toys / 2 chloe_toys = 45 total_toys = sophia_toys + oliver_toys + chloe_toys result = total_toys return result
Books are stacked on a shelf at even intervals to maximize storage space. If the first book is placed 5 inches from the edge of the shelf, and the second book is placed 3 inches away from the first book, how many books will fit on a 3 ft long shelf?
def solve() -> int: dist_between_books = 3 dist_from_edge = 5 shelf_length = 3 * 12 num_books = (shelf_length - dist_from_edge) // dist_between_books result = num_books return result
A baker is making loaves of bread using a recipe that calls for 4 cups of flour, 2 cups of water, and 0.5 ounces of yeast for each loaf. He has 20 cups of flour, 15 cups of water, and 2 ounces of yeast in his pantry. How many loaves of bread can he make with his available ingredients?
def solve() -> int: flour_per_loaf = 4 water_per_loaf = 2 yeast_per_loaf = 0.5 flour_total = 20 water_total = 15 yeast_total = 2 loaves = 0 flour_limit = flour_total // flour_per_loaf water_limit = water_total // water_per_loaf yeast_limit = yeast_total // yeast_per...
``` A square has a perimeter that measures 32 cm. What is the length of one side in centimeters?
def solve() -> int: perimeter = 32 side_length = perimeter / 4 result = side_length return result
A bookshop had 150 books to sell. In the morning, 68 books were sold and 8 books were sold in the afternoon. In the evening, thrice the number of books was sold than the books sold in the morning. How many books were left unsold?
def solve() -> int: books_total = 150 books_sold_morning = 68 books_sold_afternoon = 8 books_sold_evening = 3 * books_sold_morning books_sold_total = books_sold_morning + books_sold_afternoon + books_sold_evening books_left_unsold = books_total - books_sold_total result = books_lef...
At a karaoke night, Singer Anne sings 9 songs and scores an average of 8 points for each song. However, she also knows that she needs a total of 85 points to win the competition. How many additional points does she need to win?
def solve() -> int: songs = 9 average_score = 8 total_points_needed = 85 total_points_scored = songs * average_score additional_points_needed = total_points_needed - total_points_scored result = additional_points_needed return result
The sum of two numbers is 50 and one of the numbers is 15. What is the other number?
def solve() -> int: sum_of_numbers = 50 known_num = 15 unknown_num = sum_of_numbers - known_num result = unknown_num return result
Student: After playing some games, Danny won 15 more tokens than Derek. If Derek won 75 tokens, how many tokens did they have together?
def solve() -> int: derek = 75 danny = derek + 15 total = danny + derek result = total return result
Student: A group of friends bought a pizza for $20. If there are 8 slices in a pizza and they ate 3 slices each, how many friends shared the pizza?
def solve() -> int: pizza_cost = 20 pizza_slices = 8 slices_each = 3 total_slices = slices_each * pizza_cost friends = total_slices / pizza_slices result = friends return result
A smoothie recipe calls for 1 banana, 1/2 cup of blueberries and 1/2 cup of milk. If you want to make 5 servings, how many bananas and cups of milk do you need?
def solve() -> int: num_servings = 5 banana_per_serving = 1 milk_per_serving = 1/2 blueberries_per_serving = 1/2 bananas_needed = num_servings * banana_per_serving milk_needed = num_servings * milk_per_serving result = (bananas_needed, milk_needed) return result
In a game, a player can earn 25 points for each level completed and there are 6 levels in total. How many points can the player earn by completing all levels?
def solve() -> int: points_per_level = 25 total_levels = 6 total_points = points_per_level * total_levels result = total_points return result
There are 18 balloons and 12 candles on a birthday cake. Each balloon has 3 strings and each candle has 2 wicks. How many strings and wicks are there on the cake in total?
def solve() -> int: balloons = 18 candles = 12 strings_per_balloon = 3 wicks_per_candle = 2 strings = balloons * strings_per_balloon wicks = candles * wicks_per_candle total_items = strings + wicks result = total_items return result
A farmer has 180 ducks. She wants to feed them using buckets. Every bucket can feed 12 ducks. How many buckets will the farmer need?
def solve() -> int: ducks = 180 ducks_per_bucket = 12 buckets = ducks // ducks_per_bucket result = f'{buckets}' result = buckets return result
There are 150 vehicles in a parking lot. The owner of the lot asked 1/3 of the vehicles to exit. After this, 1/4 of the remaining vehicles left. How many vehicles are left?
def solve() -> int: vehicles = 150 vehicles_left_first = vehicles * 0.6666667 vehicles_left_second = vehicles_left_first * 0.75 result = vehicles_left_second return result
Marcus won $250.00 in a game show. He put a quarter of his winnings towards buying himself a new phone and put the rest into a retirement fund. The fund had a 5% annual interest rate. How much money will Marcus have in his retirement fund after 10 years?
def solve() -> int: winnings = 250.00 phone_cost = winnings / 4 retirement_fund = winnings - phone_cost interest_rate = 0.05 years = 10 for i in range(years): retirement_fund += retirement_fund * interest_rate result = round(retirement_fund, 2) return result
It takes 8 apples to make 2 pies. How many apples are needed to make 10 pies?
def solve() -> int: num_pies = 10 pie_ratio = num_pies / 2 apples_ratio = 8 apples_needed = pie_ratio * apples_ratio result = apples_needed return result
John and Emma are both studying for an exam. John studies for 3 hours and then takes a 40-minute break while Emma studies for 2 hours and then takes a 20-minute break. They continue to study for another 2 hours without taking any breaks. If John studies at a rate of 10 pages an hour, how many more pages will he have co...
def solve() -> int: john_rate = 10 john_study_time = 3 emma_rate = 8 emma_study_time = 2 no_break_study_time = 2 john_break_time = 40 / 60 emma_break_time = 20 / 60 john_study_after_break = (john_study_time-john_break_time) * john_rate emma_study_after_break = (emma_study_time-emma_b...
Cindy has 7 books. The first book has 100 pages, the second book has 20 more pages than the first book, and each subsequent book has 20 more pages than the previous book. If Cindy reads 40 pages every day, how many days will it take for her to finish all the books?
def solve() -> int: books = 7 pages_1 = 100 pages_2 = pages_1 + 20 pages_3 = pages_2 + 20 pages_4 = pages_3 + 20 pages_5 = pages_4 + 20 pages_6 = pages_5 + 20 pages_7 = pages_6 + 20 total_pages = pages_1 + pages_2 + pages_3 + pages_4 + pages_5 + pages_6 + pages_7 pages_...