question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Student: Stacey has 8 years more than her sister now. Her sister just had her 25th birthday. How old was Stacey on her sister’s 15th birthday?
def solve() -> int: sister_age = 25 sister_age_15 = 15 stacey_age = sister_age + 8 stacey_age_15 = stacey_age - (sister_age - sister_age_15) result = stacey_age_15 return result
David has a sales-based commission that grows by a fixed percentage every month. In January he earned $5,000 and a commission of $500. In February he earned $10,000. What will be David's total earnings for February including his commission?
def solve() -> int: jan_earnings = 5000 jan_commission = 500 feb_earnings = 10000 commission_percentage = (jan_commission / jan_earnings) * 100 feb_commission = (feb_earnings * commission_percentage) / 100 total_earnings = feb_earnings + feb_commission result = total_earnings ...
Rachel runs a flower shop. She charges $15 for a bouquet of roses, $25 for a bouquet of lilies, and $35 for a mixed bouquet, but she has to buy a new vase for $10 for every five bouquets sold. Today, she has sold four bouquets of roses, six bouquets of lilies, and ten mixed bouquets. If she makes $270 in sales, how muc...
def solve() -> int: roses_price = 15 lilies_price = 25 mixed_price = 35 vase_price = 10 roses_sold = 4 lilies_sold = 6 mixed_sold = 10 total_sales = (roses_price * roses_sold) + (lilies_price * lilies_sold) + (mixed_price * mixed_sold) num_vases = (roses_sold + lilies_sold + mix...
Ava is a lover of painting and likes to collect different colors of paints. She asks for ten every birthday and six each Christmas. Ava always gets the gifts she asks for, and asks for these same gifts every year for 4 years. At the end of the 4 years, her parents give her quadruple the number of paint colors she alrea...
def solve() -> int: birthday_paints = 10 christmas_paints = 6 years = 4 total_paints = (birthday_paints * 2 + christmas_paints) * years final_paints = total_paints * 4 result = final_paints return result
Sophie has two different trains she can take to go from city A to city B. One train can travel at a speed of 120 km/h and the other at 80 km/h. If she takes the faster train for the first 2 hours and the slower train for the next 3 hours, how long will it take her to travel from city A to B, given that the distance bet...
def solve() -> int: speed_fast = 120 speed_slow = 80 time_fast = 2 time_slow = 3 distance = 400 distance_fast = speed_fast * time_fast distance_slow = speed_slow * time_slow total_distance = distance_fast + distance_slow time_total = total_distance / (speed_fast + speed_slo...
At the beginning of the year, a company had 25 employees. During the year, they hired 10 new employees and fired 5 old employees. How many employees does the company have now?
def solve() -> int: num_employees = 25 num_hired = 10 num_fired = 5 result = num_employees + num_hired - num_fired return result
At the aquarium, octopuses are given six shrimp each day. The stingrays are given half as many shrimp as the octopuses while the other sea creatures are given ten times as many shrimp as the octopuses. How many days will 900 shrimp last?
def solve() -> int: octopus_shrimp_per_day = 6 stingray_shrimp_per_day = octopus_shrimp_per_day / 2 other_sea_creatures_shrimp_per_day = octopus_shrimp_per_day * 10 total_shrimp_per_day = octopus_shrimp_per_day + stingray_shrimp_per_day + other_sea_creatures_shrimp_per_day days = 900 / tot...
Possible questions and programs: Rene and Sara had 18 candies and decided to share them. They gave 1/3 of the candies to their friend Leo and then ate 2/5 of the remaining candies. How many candies did they have left?
def solve() -> int: leo_candies = 18 * (1/3) after_leo_candies = 18 - leo_candies ate_candies = after_leo_candies * (2/5) left_candies = after_leo_candies - ate_candies result = left_candies return result
A company has 40 employees. On a certain day, 1/4 of the employees called in sick. How many employees showed up to work on that day?
def solve() -> int: sick_employees = 40 * (1/4) remaining_employees = 40 - sick_employees result = remaining_employees return result
Ellie saves 5 quarters every other day for 33 days. Her cousin, Liam, puts 70 cents in his savings jar every day for 28 days. Chloe saves 1 dollar every day for 15 days. How much money do they save in total?
def solve() -> int: ellie_quarters = 5 ellie_days = 33 ellie_total = ellie_quarters * 0.25 * (ellie_days // 2) liam_cents = 70 liam_days = 28 liam_total = liam_cents * 0.01 * liam_days chloe_dollars = 1 chloe_days = 15 chloe_total = chloe_dollars * chloe_days total...
Student: If Khalil has 32 potatoes and his friend Nick has 3 times as many potatoes, how many potatoes does Nick have?
def solve() -> int: khalil_potatoes = 32 nick_potatoes = 3 * khalil_potatoes result = nick_potatoes return result
If a car rental company charges $20 per day plus $0.25 per mile, how many miles would you need to travel each day to make the cost of renting $40 per day?
def solve() -> int: cost = 40 daily_rental_fee = 20 daily_mileage_fee = cost - daily_rental_fee mileage_fee_per_mile = 0.25 miles_per_day = daily_mileage_fee / mileage_fee_per_mile result = int(miles_per_day) return result
Sarah has $20 more than half what Rachel has. Sarah then donates a tenth of it to charity. If Rachel has $62, how much money does Sarah have left?
def solve() -> int: rachel_money = 62 sarah_money = (rachel_money / 2) + 20 donated_money = sarah_money / 10 sarah_money_left = sarah_money - donated_money result = sarah_money_left return result
The library has 7 shelves of books and 5 shelves of magazines. Each shelf of books has 20 books and each shelf of magazines has 15 magazines. How many publications are there in total?
def solve() -> int: shelves_of_books = 7 shelves_of_magazines = 5 books_per_shelf = 20 magazines_per_shelf = 15 total_books = shelves_of_books * books_per_shelf total_magazines = shelves_of_magazines * magazines_per_shelf total_publications = total_books + total_magazines ...
Student: At a charity function, there are 100 people in attendance. If 40% of the attendees are wearing red, and 25% of those wearing red are also wearing a red hat, how many people are wearing red and a red hat?
def solve() -> int: attendees = 100 red_percent = 0.4 red_hat_percent = 0.25 red_wearers = attendees * red_percent red_hat_wearers = red_wearers * red_hat_percent result = red_hat_wearers return result
Student: A shop has a shelf with 6 rows of books. Each row has 8 books. If each book costs $12, how much does the shop make if they sell all the books?
def solve() -> int: num_rows = 6 num_books_per_row = 8 cost_per_book = 12 total_num_books = num_rows * num_books_per_row total_cost = total_num_books * cost_per_book result = total_cost return result
A box of pencils contains 144 pencils. If 12 pencils are used every day, how long will the box last?
def solve() -> int: pencils_in_box = 144 pencils_used_daily = 12 days = pencils_in_box / pencils_used_daily result = days return result
Student: Jake had 15 apples and he gave some to his friends. He gave 2 apples to each of his 4 friends and then he ate 3 apples himself. How many apples does Jake have left?
def solve() -> int: apples = 15 apples = apples - 2 * 4 apples = apples - 3 result = apples return result
A fruit juice factory can produce 60 boxes of juice per hour. How many boxes can they produce in 8 hours?
def solve() -> int: boxes_per_hour = 60 total_hours = 8 total_boxes = boxes_per_hour * total_hours result = total_boxes return result
A construction worker needs cement mix for a project. He needs to build a wall that is 10m long and 3m high and 15cm thick. A bag of cement mix can cover 3 square meters of wall surface area. How many bags of cement mix does the worker need?
def solve() -> int: wall_area = 10 * 3 per_bag_area = 3 per_bag_thickness = 0.15 num_bags_needed = wall_area / (per_bag_area * per_bag_thickness) result = num_bags_needed return result
Sarah bikes 2.5 miles to her piano lesson and 3 miles to the park twice a week. What is her weekly mileage?
def solve() -> int: miles_to_lesson = 2.5 miles_to_park = 3 days_per_week = 2 weekly_mileage = (miles_to_lesson + miles_to_park * 2) * days_per_week result = weekly_mileage return result
A pizza is divided into 8 equal slices. If 3 people each eat 2 slices, how many slices are left?
def solve() -> int: total_slices = 8 slices_per_person = 2 people = 3 leftover_slices = total_slices - slices_per_person*people result = leftover_slices return result
Rachel puts $10 in her savings account every day for 2 months to pay for tuition. She spent $500 from her savings on textbooks. How much money does she have left in her savings for tuition?
def solve() -> int: savings_per_day = 10 days_in_2_months = 2 * 30 textbook_cost = 500 total_savings = savings_per_day * days_in_2_months remaining_savings = total_savings - textbook_cost result = remaining_savings return result
A class has 30 students. If the ratio of boys to girls is 2:3, how many boys are in the class?
def solve() -> int: total_students = 30 boy_to_girl_ratio = "2:3" boy_ratio, girl_ratio = map(int, boy_to_girl_ratio.split(":")) total_ratio = boy_ratio + girl_ratio num_boys = round(total_students / total_ratio) * boy_ratio result = int(num_boys) return result
David spends 35 minutes washing his car and half as long detailing it. Then he goes for a bike ride on a 15-mile trail. If David rides his bike at 18 miles per hour, how much time does he spend with his car and bike ride total?
def solve() -> int: car_wash_time = 35 car_detail_time = car_wash_time / 2 bike_distance = 15 bike_speed = 18 bike_time = bike_distance / bike_speed * 60 total_time = car_wash_time + car_detail_time + bike_time result = total_time return result
Bruno bought 10 muffins at $1.25 each. He also bought cookies at $0.75 each. How many cookies did Bruno buy if he paid a total of $15 for the muffins and cookies?
def solve() -> int: muffins_cost = 10 * 1.25 remaining_amount = 15 - muffins_cost cookie_price = 0.75 cookies = remaining_amount / cookie_price result = cookies return result
The Lions scored 1 fewer goal than the Panthers in the first period, twice the amount of the Panthers in the second period, and 3 more goals than the Panthers in the third period. The Jaguars scored half the amount of the Panthers in the first period, one more goal than the Panthers in the second period, and triple tha...
def solve() -> int: panthers_first = 3 panthers_second = panthers_first // 2 panthers_third = panthers_second + 3 lions_first = panthers_first - 1 lions_second = panthers_second * 2 lions_third = panthers_third + 3 jaguars_first = panthers_first // 2 jaguars_second = panthers_second + 1 ...
- Noah works as a delivery driver and earns $9 an hour plus $1.5 for each delivery he makes. He works 30 hours a week and makes an average of 15 deliveries a day. He has to pay $50 a week for gas and $100 a month for car insurance. He wants to save up for a vacation that costs $800. How many weeks will it take him to s...
def solve() -> int: daily_income = 9 * 8 + 1.5 * 15 weekly_income = daily_income * 5 weekly_expenses = 50 + 100 / 4 weekly_savings = weekly_income - weekly_expenses weeks = 800 / weekly_savings weeks = int(weeks) + 1 result = weeks return result
Student: An artist buys 780lbs of clay to make sculptures. He uses 1/4 of the clay for each sculpture he makes. How many sculptures can he make?
def solve() -> int: clay = 780 fraction = 1/4 clay_per_sculpture = fraction * clay sculptures = clay / clay_per_sculpture result = sculptures return result
In a restaurant, 80 plates of food were served. 40 percent of them were vegetarian, and 50 percent of the vegetarian plates were gluten-free. How many vegetarian plates were also gluten-free?
def solve() -> int: total_plates = 80 vegetarian_plates = total_plates * 0.4 gluten_free_plates = vegetarian_plates * 0.5 result = gluten_free_plates return result
Student: Alexa has a 50ml bottle of shampoo that she wants to divide equally into 10 containers. How much shampoo will be in each container?
def solve() -> int: shampoo_amount = 50 num_containers = 10 shampoo_per_container = shampoo_amount / num_containers result = shampoo_per_container return result
Student: John went to a grocery store and bought some apples for $3.50 per pound and oranges for $2.50 per pound. If he bought 2.5 pounds of apples and 3 pounds of oranges, how much did he spend in total?
def solve() -> int: apples_price = 3.50 oranges_price = 2.50 apples_weight = 2.5 oranges_weight = 3 apples_cost = apples_price * apples_weight oranges_cost = oranges_price * oranges_weight total_cost = apples_cost + oranges_cost result = total_cost return result
Michael can run 10 km in 70 minutes, and Jake can run 8 km in 50 minutes. How many kilometers can they run in total in 2 hours? In five years, Ms. Garcia will be twice as old as José is now. If José is 25, what is 15 years less than their average age?
def solve() -> int: m_speed = 10 / 70 j_speed = 8 / 50 total_distance = (m_speed + j_speed) * 120 garcia_age = 2 * 25 + 5 avg_age = (garcia_age + 25) / 2 result = avg_age - 15 return result
- Ben, Maria and Kevin went to see a movie at the theater. The tickets cost $8, $9 and $10 respectively for each of them. They also bought some snacks that cost $12 in total. How much should each pay if they want to split the total cost evenly?
def solve() -> int: total_cost = 8 + 9 + 10 + 12 even_share = total_cost / 3 result = even_share return result
A grocery store sells apples for $. 50 each. If you buy 4 apples you get 1 free. How much does it cost to buy 25 apples?
def solve() -> int: regular_price_per_apple =.5 number_of_apples_to_get_a_free_one = 4 actual_price_per_apple = regular_price_per_apple*(number_of_apples_to_get_a_free_one-1) total_cost = actual_price_per_apple*25 result = total_cost return result
-Write the questions in ascending order, starting with '' Four jars P, Q, R and S contain different numbers of differently colored balls. Jar P contains 5 blue balls and 2 green balls. Jar Q contains 3 red balls and 4 green balls. Jar R contains 6 yellow balls and 1 green ball. Jar S contains 2 blue balls and 7 yellow ...
def solve() -> int: totals = [] totals.append(5 + 2) totals.append(3 + 4) totals.append(6 + 1) totals.append(2 + 7) largest = max(totals) smallest = min(totals) difference = largest - smallest result = difference return result
ppose the current population of Roseville is 25000 and increases by 5% every 3 years. What will the population be after 12 years?
def solve() -> int: population = 25000 num_years = 3 n_iterations = int(12 / num_years) for _ in range(n_iterations): population *= 1.05 result = population return result
Student: Jack went to a pet store and bought 3 hamsters that each cost $12. He also bought 5 bags of food. If Jack spent $84 in total, how much did a single bag of food cost in dollars?
def solve() -> int: hamsters = 3 hamster_cost = 12 bags = 5 total = 84 hamster_total = hamsters * hamster_cost remaining = total - hamster_total bag_cost = remaining / bags result = bag_cost return result
Kevin runs 2 miles and then walks 3 times as far. He runs at a speed of 6 miles per hour and walks at a speed of 3 miles per hour. How long does he take to complete his exercise?
def solve() -> int: run_distance = 2 walk_distance = run_distance * 3 run_speed = 6 walk_speed = 3 run_time = run_distance / run_speed walk_time = walk_distance / walk_speed total_time = run_time + walk_time result = total_time return result
Student: Nick buys furniture for a party he is planning. He purchases 4 rugs for $450 each, 8 sofa for $900 each, and 12 tables for $400 each. How much did he spend in total?
def solve() -> int: rugs = 4 rug_price = 450 sofas = 8 sofa_price = 900 tables = 12 table_price = 400 total_rug_price = rugs * rug_price total_sofa_price = sofas * sofa_price total_table_price = tables * table_price total_price = total_rug_price + total_sofa_price + total_table_p...
Student: If the ratio of the length to the width of a rectangle is 4:3 and the perimeter is 140, what is the length of the rectangle?
def solve() -> int: length = None width = None ratio = 4/3 perimeter = 140 width = perimeter / (ratio + 1) length = ratio * width result = length return result
Student: Mary spent $135 on 9 shirts. How much money will she spend if she buys 6 more shirts?
def solve() -> int: num_shirts_bought = 9 cost_per_shirt = 135 / num_shirts_bought num_shirts_to_buy = 6 total_cost = cost_per_shirt * (num_shirts_bought + num_shirts_to_buy) result = total_cost return result
Student: There are 40 goats in the field, 25 percent of them are Boers. How many Boer goats in the field?
def solve() -> int: total_goats = 40 percent_boers = 0.25 boer_goats = total_goats * percent_boers result = boer_goats return result
Ava wants to make gift bags for her classmates. She needs to make enough gift bags for all her classmates, one bag for each classmate. First, Ava makes 20 gift bags for the 20 classmates she has. Then she finds out that 1/3 of the classmates want to bring a friend to class, so Ava needs to make more gift bags. Eventual...
def solve() -> int: classmates = 20 extra_classmates = classmates * (1/3) gift_bags = classmates + extra_classmates - 5 + 7 result = gift_bags return result
Rachel has 28 stickers. She has twice as many unicorn stickers as cat stickers. She has 12 fewer butterfly stickers than unicorn stickers. How many stickers does Rachel have in all?
def solve() -> int: num_cat_stickers = 7 num_unicorn_stickers = 2 * num_cat_stickers num_butterfly_stickers = num_unicorn_stickers - 12 num_total_stickers = num_cat_stickers + num_unicorn_stickers + num_butterfly_stickers result = num_total_stickers return result
There are 100 students, out of which 40% are girls. How many boys are there in the class?
def solve() -> int: total_students = 100 percent_girls = 40 boys = total_students - (percent_girls/100)*total_students result = boys return result
Student: Andre has 45 beads. He gave away 1/2 of his beads. How many beads does he have left?
def solve() -> int: beads = 45 beads_given_away = beads / 2 beads_left = beads - beads_given_away result = beads_left return result
Matthew is baking muffins for a bake sale and wants to make sure each customer gets at least 2 muffins. He has to bake enough for 50 customers, including himself, and each muffin weighs 4 ounces. How many ounces of muffins should he make in total?
def solve() -> int: customers = 50 muffins_per_customer = 2 muffin_weight = 4 total_muffins = customers * muffins_per_customer total_weight = total_muffins * muffin_weight result = total_weight return result
A basketball player has to score 60 points in three games to enter the playoffs. In the first two games, she scored 40 points and 30 points, respectively. What is the minimum number of points the player should score in the final game to enter the playoffs?
def solve() -> int: total_points_needed = 60 points_game1 = 40 points_game2 = 30 total_points_scored = points_game1 + points_game2 remaining_points_needed = total_points_needed - total_points_scored result = remaining_points_needed return result
Janice's smoothie has 20 grams of fiber for every 16 ounces. Her cereal has 5 grams of fiber per serving and her bread has 7 grams of fiber per slice. If she has two 8-ounce smoothies, 2 servings of cereal, and 3 slices of bread, how many grams of fiber will she consume?
def solve() -> int: smoothie_fiber_per_ounce = 20 / 16 cereal_fiber_per_serving = 5 bread_fiber_per_slice = 7 smoothie_ounces = 8 smoothie_servings = 2 cereal_servings = 2 bread_slices = 3 smoothie_fiber = smoothie_fiber_per_ounce * smoothie_ounces * smoothie_servings cerea...
In a football match, Team A scored three times as much as Team B. If team B scored six goals, how many goals did team A score?
def solve() -> int: team_b_goals = 6 team_a_goals = team_b_goals * 3 result = team_a_goals return result
After losing 4 pencils, Sarah has half as many pencils as before. If Sarah originally had 22 pencils, how many pencils does she have now?
def solve() -> int: sarah_pencils_before = 22 sarah_pencils_after = (sarah_pencils_before - 4) / 2 result = sarah_pencils_after return result
Diego earns $32 per hour and works 40 hours a week. He pays 25% of his income as taxes every month. He also spends $800 on rent every month, $400 on groceries every month, and $200 on transportation every month. How much money can he save every month?
def solve() -> int: wage = 32 hours = 40 rent = 800 groceries = 400 transportation = 200 income = wage * hours * 4 tax = income * 0.25 income_after_tax = income - tax saving = income_after_tax - rent - groceries - transportation result = saving return result
Erica and Jess went out for drinks and appetizers. Erica left a 10% tip of $4.50, but Jess suggested they leave a 12% tip instead. How much is a 12% tip?
def solve() -> int: tip_percentage = 0.12 erica_tip = 4.50 jess_tip = erica_tip * (tip_percentage / 0.10) result = jess_tip return result
A family needs to have at least $10,000 in savings for an emergency. They have $5000 in savings right now. If they save $300 per month, in how many months will they have enough money for the emergency?
def solve() -> int: emergency_fund = 10000 current_savings = 5000 monthly_savings = 300 months_needed = (emergency_fund - current_savings) / monthly_savings result = months_needed return result
Mark buys a dozen donuts for $6 every Tuesday and Friday. On Wednesday, he spends $4 to buy a cup of coffee. How much does he spend on breakfast over the course of a month?
def solve() -> int: donuts_per_week = 2 donut_price = 6 coffee_price = 4 weeks_in_month = 4 donut_cost_per_week = donuts_per_week * donut_price coffee_cost_per_month = coffee_price total_cost = (donut_cost_per_week * 2) + coffee_cost_per_month * weeks_in_month result = tot...
Possible questions and programs: Alice sells cupcakes for $2 each and brownies for $3 each. She makes a profit of 50 cents for each cupcake and 75 cents for each brownie. How much profit does she make if she sells 15 cupcakes and 12 brownies in one day?
def solve() -> int: cupcake_profit = 0.5 brownie_profit = 0.75 cupcakes_sold = 15 brownies_sold = 12 total_profit = cupcake_profit * cupcakes_sold + brownie_profit * brownies_sold result = total_profit return result
Emily needs to drive 120 miles. Her car can travel 30 miles per gallon. How many gallons of gas will she need for the trip?
def solve() -> int: distance = 120 gas_mileage = 30 gas_needed = distance / gas_mileage result = gas_needed return result
Lily returned from Switzerland with 100 francs. Normally, 1 Swiss franc is worth 1.08 dollars, but the exchange rate at the bank only gave Lily one-half of the official exchange rate. How many dollars did Lily get?
def solve() -> int: francs = 100 official_exchange_rate = 1.08 exchange_rate_at_bank = official_exchange_rate / 2 dollars = francs * exchange_rate_at_bank result = dollars return result
John is 12 years older than Kate. In 8 years, John will be twice as old as Kate. How old is Kate?
def solve() -> int: age_difference = 12 years_ahead = 8 age_ratio = 2 kate_age = (age_difference + years_ahead) / (age_ratio - 1) - years_ahead result = f'{kate_age}' result = kate_age return result
If it takes 5 workers 4 days to complete a project, how many days would it take 7 workers to complete the same project?
def solve() -> int: workers_initial = 5 days_initial = 4 workers_new = 7 result = (workers_initial*days_initial)/workers_new return result
Alice works as a babysitter and charges $12 per hour. She gets a 10% tip from each family she works for. She works for three families in a week: 5 hours for the first family, 3 hours for the second family, and 4 hours for the third family. How much does she earn in a week?
def solve() -> int: total_hours = 5 + 3 + 4 payment = total_hours * 12 tip = payment * 0.1 income = payment + tip result = income return result
To make a rectangular cake, you mix together 2 cups of flour with 1 cup of sugar. You need 8 cups of flour to make the cake. How many cups of sugar will you need?
def solve() -> int: flour = 8 flour_to_sugar_ratio = 2/1 sugar = (flour/flour_to_sugar_ratio)*0.5 result = sugar return result
Mary bought 5 dresses and 3 skirts for a total of $280. Each dress costs $40 and each skirt costs $20. How much was the discount (%) she got on her purchase?
def solve() -> int: num_dresses = 5 num_skirts = 3 total_items = num_dresses + num_skirts total_cost = 280 cost_per_dress = 40 cost_per_skirt = 20 subtotal = num_dresses * cost_per_dress + num_skirts * cost_per_skirt discount = 100 * (subtotal - total_cost) / subtotal result = discou...
A bakery can make 24 cupcakes in one batch. If it takes 1 cup of sugar and 1 egg to make each cupcake, how many cups of sugar and eggs does the bakery need for a total of 120 cupcakes?
def solve() -> int: total_cupcakes = 120 sugar_and_eggs_cupcake = 1 + 1 sugar_and_eggs_total = total_cupcakes * sugar_and_eggs_cupcake result = sugar_and_eggs_total return result
Student: A supermarket earns $5000 in a week. If the total expenses for the week amount to $3800, what is the percentage profit for the supermarket for this week?
def solve() -> int: revenue = 5000 expenses = 3800 profit = revenue - expenses percentage_profit = (profit / revenue) * 100 result = percentage_profit return result
Carolina owns a small factory for making home decor items. She buys the material for $25 per piece and sells each item for $55 each. Calculate the profit she will make from selling 400 items.
def solve() -> int: material_cost = 25 sell_price = 55 num_items = 400 total_cost = material_cost * num_items total_profit = sell_price * num_items profit = total_profit - total_cost result = profit return result
In a toy store, there are three times as many action figures than dolls. If there are 60 dolls and action figures altogether, how many action figures are there?
def solve() -> int: dolls = 60 total = dolls * 4 action_figures = total - dolls result = action_figures return result
Student: Three people, Alex, Ben and Charlie, decided to split the bill for dinner at a restaurant. The total bill was £65. Alex ate £25 worth of food, Ben ate £20 worth of food, and Charlie ate the rest. How much did Charlie eat?
def solve() -> int: total_bill = 65 alex_food = 25 ben_food = 20 charlie_food = total_bill - alex_food - ben_food result = charlie_food return result
Some possible questions are: A school has 800 students and 40 teachers. The students are divided into four grades, each with the same number of students. The teachers are divided into two groups, one with 60% of the teachers and the other with 40% of the teachers. Each group teaches two grades. How many teachers are th...
def solve() -> int: students_per_grade = 800 // 4 teachers_60 = 0.6 * 40 teachers_40 = 0.4 * 40 teachers_3 = teachers_40 // 2 teachers_4 = teachers_3 teachers_3_4 = teachers_3 + teachers_4 result = teachers_3_4 return result
John can paint a room in 4 hours while Bob can paint the same room in 6 hours. If they work together, how long will it take to paint the room?
def solve() -> int: john_time = 4 bob_time = 6 painting_together_time = (john_time * bob_time) / (john_time + bob_time) result = painting_together_time return result
If Ben has a 30-question art exam with a total of 45 minutes allotted, and he finishes 1/3 of the questions in the first 10 minutes, how many minutes does he have for each question to finish within the allotted time?
def solve() -> int: total_questions = 30 total_time = 45 time_spent = 10 questions_completed = total_questions / 3 questions_left = total_questions - questions_completed time_left = total_time - time_spent time_per_question = time_left / questions_left result = time_per_question ...
Emily works 8 hours per day. Last week, she worked for 5 days. If her hourly rate is $15 per hour, calculate her total weekly wage (before taxes).
def solve() -> int: total_hours = 8 * 5 hourly_rate = 15 weekly_wage = total_hours * hourly_rate result = weekly_wage return result
If a notebook costs $3.50 and a pen costs $0.75, how much would it cost to buy 2 notebooks and 3 pens?
def solve() -> int: notebook_price = 3.50 pen_price = 0.75 total_price = (notebook_price * 2) + (pen_price * 3) result = f'<<<{total_price}>>>' result = total_price return result
Tom gathered 30 pounds of almonds. He turned 1/5David went to the beach to collect seven dozen seashells. To carry them home, he brought three equally-sized plastic bags and a smaller backpack. In the backpack, he put one-third of the seashells he placed in each of the plastic bags. How many seashells did he put in the...
def solve() -> int: almonds_gathered = 30 plastic_bags = 3 seashells_per_dozen = 12 seashells_collected = 7 * seashells_per_dozen seashells_per_bag = seashells_collected / plastic_bags seashells_in_backpack = seashells_per_bag / 3 result = seashells_in_backpack return result
A sack of toys contains 8 balls and 4 times as many dolls. How many dolls are there?
def solve() -> int: balls = 8 dolls = 0 dolls = balls * 4 result = dolls return result
Student: A toy company produces toy cars which are sold in boxes of 6. How many cars can the company produce with 132 boxes of toys?
def solve() -> int: num_boxes = 132 cars_per_box = 6 total_cars = num_boxes * cars_per_box result = total_cars return result
If a train traveled 120 km in 3 hours, how long will it take it to travel 240 km at the same speed?
def solve() -> int: distance_1 = 120 time_1 = 3 speed = distance_1 / time_1 distance_2 = 240 time_2 = distance_2 / speed result = time_2 return result
John borrows 150 dollars from his friend Tom at 8% simple interest for 3 years. What is the total amount that John needs to pay Tom back?
def solve() -> int: principal = 150 rate = 0.08 time = 3 interest = principal*rate*time result = principal + interest return result
A basketball team scores an average of 80 points per game for 30 games. If they want to increase their average to 90 points per game, how many points do they need to score in the next game?
def solve() -> int: total_points = 80 * 30 points_needed = (90 * 31) - total_points result = points_needed return result
Jeff had 54 marbles. He gave 3/5 of them to his friend Kevin. Kevin then gave 1/3 of his portion to his brother. How many marbles does Kevin have left?
def solve() -> int: number_of_marbles_jeff = 54 amount_shared_by_kevin = 3 / 5 * number_of_marbles_jeff amount_shared_with_brother = 1 / 3 * amount_shared_by_kevin amount_with_kevin = amount_shared_by_kevin - amount_shared_with_brother result = amount_with_kevin return result
It takes 10 cups of tarragon to make 2 cups of pesto. If Sarah harvests 50 cups of tarragon every week for 8 weeks, how many cups of pesto can she make?
def solve() -> int: a = 10 b = 50 c = 8 d = 2 result = b*c/a*d return result
The perimeter of a square is 40 cm. What is the area of the square?
def solve() -> int: perimeter = 40 side = perimeter/4 area = side**2 result = int(area) return result
Sarah is cooking dinner for her family for 1 hour each day. She decides to double her cooking time every day. How much time will she be spending on cooking every week?
def solve() -> int: days_in_week = 7 cooking_time = 1 total_cooking_time = 0 for day in range(days_in_week): total_cooking_time += cooking_time cooking_time *= 2 result = total_cooking_time return result
While hiking, Mark saw a group of 3 birds in the tree. Afterwards, he spotted 9 more birds with 4 squirrels. If there were also 2 hikers walking towards him, how many animals and hikers are there?
def solve() -> int: birds_in_tree = 3 birds_and_squirrels = 9 + 4 hikers = 2 total_animals_and_hikers = birds_in_tree + birds_and_squirrels + hikers result = total_animals_and_hikers return result
Student: A group of friends wants to split the bill for their dinner equally. The total bill is $60 and there are 4 friends. How much does each friend need to contribute?
def solve() -> int: total_bill = 60 num_friends = 4 contribution_per_friend = total_bill / num_friends result = contribution_per_friend return result
A cyclist rode 12 miles at a speed of 15 miles per hour. How long did it take to complete the ride?
def solve() -> int: distance_in_miles = 12 speed_in_mph = 15 time_in_hours = distance_in_miles / speed_in_mph result = time_in_hours return result
A milkman delivered 30 liters of milk in a society with 100 flats. How much milk on average did each flat receive?
def solve() -> int: milk_delivered = 30 num_flats = 100 milk_per_flat = milk_delivered / num_flats result = milk_per_flat return result
A teacher has 120 pens to give to her students. In the first day, she distributed 25 pens to some of her students. In the second day, she distributed 30 more pens than in the first day. In the third day, she distributed 15 fewer pens than in the second day. How many pens did she distribute in the second and third day?
def solve() -> int: day1 = 25 day2 = day1 + 30 day3 = day2 - 15 total_pens = day1 + day2 + day3 result = day2, day3 return result
Sarah is a caterer for a wedding reception. There are 100 guests attending and each person eats 2 appetizers. It takes. 2 ounces of ingredients per appetizer. If ingredients cost $0.75 per ounce, how much does Sarah spend on ingredients for the appetizers?
def solve() -> int: num_guests = 100 num_appetizers_per_guest = 2 ounces_per_appetizer = 0.2 cost_per_ounce = 0.75 total_appetizers = num_guests * num_appetizers_per_guest total_ounces = total_appetizers * ounces_per_appetizer total_cost = total_ounces * cost_per_ounce result =...
A company has 120 employees. If 25% of them are managers and the rest are workers, how many workers does the company have?
def solve() -> int: total_employees = 120 managers_percentage = 0.25 managers_count = managers_percentage * total_employees workers_count = total_employees - managers_count result = workers_count return result
A store sells sweatshirts for $30. They have a 15% off sale. If a customer buys 2 sweatshirts, they get a third sweatshirt for 50% off. If a customer buys 4 sweatshirts, they get a fifth sweatshirt for free. How much would it cost to buy 5 sweatshirts?
def solve() -> int: sweatshirt_price = 30 num_sweatshirts = 5 sale_discount = 0.15 third_sweatshirt_discount = 0.5 num_thirds = int(num_sweatshirts / 3) num_fifths = int(num_sweatshirts / 5) subtotal = sweatshirt_price * num_sweatshirts subtotal_with_discount = subtotal * (1 - sale_disco...
A company sells a product for $50. The company spends $20 per product on manufacturing and $10 per product on shipping. If the company expects to sell 1000 products in the first month, how much profit will the company make?
def solve() -> int: price = 50 cost_of_goods_sold = 20 shipping_cost = 10 num_products = 1000 revenue = price * num_products total_costs = (cost_of_goods_sold + shipping_cost) * num_products profit = revenue - total_costs result = profit return result
A car travels at a constant speed of 80 km/h for 2 hours and then at a constant speed of 60 km/h for 1.5 hours. What is the average speed of the car for the whole journey in km/h?
def solve() -> int: distance_80 = 80 * 2 distance_60 = 60 * 1.5 total_distance = distance_80 + distance_60 total_time = 2 + 1.5 average_speed = total_distance / total_time result = average_speed return result
Rachel has $24 in quarters, loonies and toonies. She has 6 loonies. How many quarters and toonies does she have?
def solve() -> int: total = 24 loonies = 6 value_loonies = 1 remaining = total - loonies quarters = remaining // 0.25 toonies = remaining // 2 result = quarters + toonies return result
Student: **** A rack of charging phones was placed on the 12th floor. Charlie and Frank both live above the 12th floor. Charlie lives four floors above Frank's floor and Frank lives four floors above Dennis' floor. What floor is Dennis living on?
def solve() -> int: charlie = 12 + 4 + 4 frank = 12 + 4 dennis = frank - 4 result = dennis return result
Liam has a spinner with 8 equal sections, numbered from 1 to 8. He spins it 40 times and records the results. How many times should he expect to spin a number that's a multiple of 4 or a prime number?
def solve() -> int: result = 0.75 * 40 return result
Sarah, Michael and John are sharing a box of 300 chocolates. If Michael takes 15%, and Sarah and John are to share the remainder in the ratio 3:4 respectively, how many chocolates will John get?
def solve() -> int: total_chocolates = 300 michael_share = total_chocolates * 0.15 remaining_chocolates = total_chocolates - michael_share sarah_share = remaining_chocolates * (3 / 7) john_share = remaining_chocolates * (4 / 7) result = john_share return result
John runs at a speed of 8 MPH for 2 hours and then slows down to 5 MPH for the next 1 hour and 30 minutes. What is the total distance John ran at?
def solve() -> int: time_run1 = 2 time_run2 = 1.5 speed_run1 = 8 speed_run2 = 5 distance_run1 = speed_run1 * time_run1 distance_run2 = speed_run2 * time_run2 total_distance = distance_run1 + distance_run2 result = total_distance return result
Frank has 10 more pens than Gary. Gary has half of the number of pens that Helen has. If Helen has 18 pens, how many pens do the three of them have in total?
def solve() -> int: Helen = 18 Gary = Helen // 2 Frank = Gary + 10 total = Helen + Gary + Frank result = 37 return result