question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A store sold 150 toys. They had 30 toys left in stock. However, 20 more toys arrived in the store. The store then sold half of the toys they had in stock. How many toys were left in the store?
def solve() -> int: total_toys = 150 + 30 + 20 total_toys //= 2 result = total_toys return result
Jake has 10 candy bars. He wants to give half of his candy bars to his friend, Sam. How many candy bars will Jake have left after giving half to Sam?
def solve() -> int: jakes_candybars = 10 sam_share = jakes_candybars / 2 jakes_candybars_left = jakes_candybars - sam_share result = jakes_candybars_left return result
A recipe calls for 2/3 cup of oil and makes 16 cookies. If you want to make only 6 cookies, how much oil do you need?
def solve() -> int: oil_per_cookie = 2/3 / 16 num_of_cookies = 6 oil_needed = oil_per_cookie * num_of_cookies result = f'You need {oil_needed} cups of oil' result = oil_needed return result
A bakery sells three types of cakes: chocolate, vanilla, and carrot. Each chocolate cake costs $12, each vanilla cake costs $10, and each carrot cake costs $8. The bakery sells 15 chocolate cakes, 20 vanilla cakes, and 25 carrot cakes in a day. How much revenue does the bakery make in a day?
def solve() -> int: chocolate_revenue = 15 * 12 vanilla_revenue = 20 * 10 carrot_revenue = 25 * 8 total_revenue = chocolate_revenue + vanilla_revenue + carrot_revenue result = total_revenue return result
Student: Mia wants to buy a necklace and a bracelet for her birthday. She finds a store that offers 30 percent off on jewelry. The necklace costs $75 and the bracelet costs $45 before the discount. How much money does Mia need to pay for the necklace and the bracelet after the discount?
def solve() -> int: necklace = 75 bracelet = 45 total_before = necklace + bracelet discount_rate = 0.3 discount_amount = total_before * discount_rate total_after = total_before - discount_amount result = total_after return result
In a group of 25 people, 6 of them have brown hair and 7 of them have blonde hair. How many people have a different hair color?
def solve() -> int: total_people = 25 same_hair = 6 + 7 different_hair = total_people - same_hair result = different_hair return result
If a car travels 60km in 1 hour, how far will it travel in 3 hours?
def solve() -> int: rate = 60/1 time = 3 distance = rate*time result = distance return result
Alex has 30 1-dollar bills, 20 5-dollar bills, and 10 10-dollar bills. What is the total amount of money he has?
def solve() -> int: dollars_1 = 30 dollars_5 = 20 * 5 dollars_10 = 10 * 10 total_money = dollars_1 + dollars_5 + dollars_10 result = total_money return result
Rachel wants to buy a $200 dress, but she only has $150. She decides to borrow the rest from her friend at 5% interest. How much will she owe her friend if she doesn't pay for 3 months?
def solve() -> int: dress_cost = 200 starting_money = 150 interest_rate = 0.05 months = 3 loan_amount = dress_cost - starting_money total_amount = loan_amount * (1 + interest_rate * months) result = f'<<<{total_amount}>>>' result = total_amount return result
A rectangle has a diagonal length of 17 inches and a width of 8 inches. What is the length of the rectangle?
def solve() -> int: L = (17**2 - 8**2)**(1/2) result = L return result
Rebecca is training for a marathon and wants to run a total of 26 miles before the race. She runs 4 miles every day. How many days will it take for Rebecca to reach her goal?
def solve() -> int: total_miles = 26 miles_per_day = 4 days = total_miles / miles_per_day result = days return result
What is the circumference of a circle with a radius of 7cm?
def solve() -> int: pi = 3.14 radius = 7 circumference = 2 * pi * radius result = circumference return result
Student: John bought a book that was discounted by 20%. If the new price was $32, what was the original price?
def solve() -> int: discount = 20 new_price = 32 original_price = new_price / (1 - discount/100) result = original_price return result
A library has 350 books and they want to divide them equally among 14 shelves. How many books will each shelf have?
def solve() -> int: num_books = 350 num_shelves = 14 books_per_shelf = num_books / num_shelves result = books_per_shelf return result
A baker charges $30 an hour to make a cake. He works 3 hours a day for 5 days on one cake. The baker also used $200 worth of ingredients and decorations. How much did the cake's buyer have to pay?
def solve() -> int: hourly_rate = 30 hours_per_day = 3 days_worked = 5 ingredient_cost = 200 labor_cost = hourly_rate * hours_per_day * days_worked total_cost = labor_cost + ingredient_cost result = total_cost return result
Student: John spends 2 minutes every day brushing his teeth and 3 minutes every day showering. How much time does he spend on personal hygiene each week?
def solve() -> int: daily_brushing_time = 2 daily_showering_time = 3 weekly_brushing_time = daily_brushing_time * 7 weekly_showering_time = daily_showering_time * 7 result = weekly_brushing_time + weekly_showering_time return result
A person puts $4000 in a bank for one year. He earns interest of 7% of the original amount deposited. How much will this person have in the bank after one year?
def solve() -> int: deposit = 4000 rate = 0.07 year = 1 amount = deposit * (1 + rate)**year result = amount return result
A bike travels at a speed of 8 km/h for 2 hours and then at a speed of 12 km/h for 4 hours. What is the average speed for the entire journey?
def solve() -> int: distance1 = 8 * 2 distance2 = 12 * 4 total_distance = distance1 + distance2 total_time = 2 + 4 average_speed = total_distance / total_time result = average_speed return result
A rectangular garden's length is three times its width, and its perimeter is 40 meters. Calculate the area of the garden in square meters.
def solve() -> int: width = 40 / 8 length = 3 * width area = length * width result = area return result
There are 50 chocolates in a box. If 10 are dark chocolate, 20 are milk chocolate, and 15 are white chocolate. How many chocolates are left in the box?
def solve() -> int: total_chocolates = 50 dark_chocolates = 10 milk_chocolates = 20 white_chocolates = 15 chocolates_eaten = dark_chocolates + milk_chocolates + white_chocolates remaining_chocolates = total_chocolates - chocolates_eaten result = remaining_chocolates return result
Student: 9. If 12 workers can pay for $720 of supplies in two hours, how much can they pay in 6 hours?
def solve() -> int: workers = 12 supplies = 720 hours1 = 2 hours2 = 6 rate = supplies / (workers * hours1) payment = rate * workers * hours2 result = payment return result
Rachel bought 9 postcards that cost $20 each and 7 pens that cost $5 each. How much did she spend in total?
def solve() -> int: num_postcards = 9 postcard_cost = 20 num_pens = 7 pen_cost = 5 total_cost = (num_postcards * postcard_cost) + (num_pens * pen_cost) result = total_cost return result
Student: 1. How many camels did Corey see on his safari in Zambia's South Luangwa National Park? He saw 5 camels on Wednesday, 3 on Thursday, and 7 on Friday.
def solve() -> int: wednesday_camels = 5 thursday_camels = 3 friday_camels = 7 total_camels = wednesday_camels + thursday_camels + friday_camels result = total_camels return result
Maria hikes up 3 hills. Each hill is 500 meters. If each stride is 1 meter, how many strides does she take?
def solve() -> int: hill_distance = 500 total_hills = 3 stride_length = 1 total_distance = hill_distance * total_hills total_strides = total_distance / stride_length result = total_strides return result
Leo has a bunch of jars of buttons. He has jars of brown buttons, yellow buttons, blue buttons, and green buttons. He has twice as many green buttons as he does yellow buttons. He has three times as many blue buttons as he does yellow buttons. He has 100 yellow buttons. How many buttons does Leo have in total?
def solve() -> int: yellow_buttons = 100 green_buttons = 2 * yellow_buttons blue_buttons = 3 * yellow_buttons brown_buttons = 0 total_buttons = yellow_buttons + green_buttons + blue_buttons + brown_buttons result = total_buttons return result
Student: If Sam invested $500 at a 4% annual compound interest, how much money will he have after 5 years?
def solve() -> int: principal = 500 interest_rate = 0.04 years = 5 compound_interest = principal * (1 + interest_rate) ** years compound_interest = round(compound_interest, 2) result = compound_interest return result
Amy has 9 more than a sixth of what Bill has. Amy then gives $3 to Bill and receives $2 from Bill as a thank you. If Bill has $30, how much money does Amy have?
def solve() -> int: amy = (30 / 6) + 9 amy = amy - 3 amy = amy + 2 result = amy return result
A photographer is taking photos. For every 15 photos she takes, she can sell one for $100. It costs $5 to take one photo. If she wants to make a profit of $2000, how many photos does she need to take? Jane worked 6 hours a day every day from the 7th to the 12th, including the 7th and not including the 12th. How many ho...
def solve() -> int: photos_per_100 = 15 photo_price = 5 profit_goal = 2000 sold_photo_price = 100 photos_needed = profit_goal / sold_photo_price * photos_per_100 total_cost = photos_needed * photo_price days_worked = 12 - 7 hours_worked = days_worked * ...
A restaurant wants to make a salad with 7 types of vegetables. They need to use 4 tomatoes, 3 cucumbers, and 1 avocado. How many more types of vegetables do they need to add to complete the salad?
def solve() -> int: tomatoes = 4 cucumbers = 3 avocado = 1 total_vegetables = tomatoes + cucumbers + avocado types_of_vegetables_needed = 7 types_of_vegetables_to_add = types_of_vegetables_needed - total_vegetables result = types_of_vegetables_to_add return result
A book has 250 pages. If Tom reads 30 pages every day, how many days will it take him to finish the book?
def solve() -> int: total_pages = 250 pages_per_day = 30 total_days = total_pages/pages_per_day result = total_days return result
If a half of a student's study time is spent reading and the student studies 4 hours a day, how many hours are spent on reading each day?
def solve() -> int: total_study_time = 4 reading_time = total_study_time / 2 result = reading_time return result
At a pet store, there are a total of 80 pets. The number of dogs is 4 times the number of cats, and there are 7 more fish than cats. How many cats are there?
def solve() -> int: total_pets = 80 dogs = total_pets / (4 + 1 + 1 + 7/4) cats = dogs / 4 fish = cats + 7 result = cats return result
David works as a carpenter for $10 per hour. If he wants to earn $80 in 4 hours, how many hours does he need to work?
def solve() -> int: hourly_rate = 10 desired_earning = 80 desired_hours = 4 hours_worked = desired_earning / hourly_rate result = hours_worked return result
A marathon runner can run 7 miles in 30 minutes. If there are 4 fewer than 35 miles run in 2 hours, how many runners are running the marathon?
def solve() -> int: distance_per_30_minutes = 7 distance_per_hour = distance_per_30_minutes * 2 total_distance = 35 - 4 distance_in_2_hours = total_distance * 2 num_runners = distance_in_2_hours // distance_per_hour result = num_runners return result
In a classroom, there are 25 students. Half of these students are girls, and the remaining number is split evenly between boys and other genders. If each girl has 10 pens, each boy has 8 pens, and each other gender has 5 pens, how many pens are in the classroom?
def solve() -> int: num_students = 25 num_girls = num_students / 2 num_boys_and_others = num_students - num_girls num_girl_pens = num_girls * 10 num_boy_pens = (num_boys_and_others / 2) * 8 num_other_pens = (num_boys_and_others / 2) * 5 total_pens = num_girl_pens + num_boy_pens + n...
A store is having a 30% off sale. If the original price of an item was $50, what is the discounted price?
def solve() -> int: original_price = 50 discount_perc = 0.3 discount_amt = original_price * discount_perc discounted_price = original_price - discount_amt result = discounted_price return result
Daniel went to the library and looked at three books. The first had 256 pages, the second had 482 pages and the third had 320 pages. Calculate how many pages Daniel saw in total.
def solve() -> int: total_pages = 256 + 482 + 320 result = total_pages return result
Olivia wants to go on a weekend trip that costs $550. Her sister gave her $100 toward the trip and she must earn the rest by babysitting. She charges $12 per hour for babysitting. How many hours does Olivia need to babysit to earn the money for the trip?
def solve() -> int: trip_cost = 550 sister_contribution = 100 remaining_cost = trip_cost - sister_contribution hourly_rate = 12 hours_needed = remaining_cost / hourly_rate result = hours_needed return result
A snail is climbing a wall that is 10 feet high. It moves up 1 foot every hour, but slides down 0.2 feet every time it rests for 15 minutes. How many feet has it climbed after 7 hours and 45 minutes?
def solve() -> int: height = 0 hours = 7 minutes = 45 cycles = (hours * 60 + minutes) // 75 for i in range(cycles): height = height + 1 - 0.2 remainder = (hours * 60 + minutes) % 75 if remainder >= 60: height = height + 1 elif remainder > 0: heigh...
The dance competition has three categories: ballet, hip-hop, and Latin dance. There are 20 dancers in the ballet category, 15 dancers in the hip-hop category, and 10 dancers in theKaren celebrated her 40th birthday 3 years ago. 11 years ago, Mike's age was twice the age of Karen's younger sister. What is Mike's current...
def solve() -> int: ballet_dancers = 20 hip_hop_dancers = 15 latin_dancers = 10 total_dancers = ballet_dancers + hip_hop_dancers + latin_dancers result = total_dancers karen_current_age = 40 + 3 mike_current_age = karen_current_age - 3 + 11 result return resu...
A shop sells strawberries at $3.50 per pound. If John bought 6 pounds of strawberries, how much did he spend?
def solve() -> int: price_per_pound = 3.50 num_pounds = 6 total_cost = price_per_pound*num_pounds result = total_cost return result
Anthony has 3 times as many nickels as he does dimes and 50 more pennies than he does nickels. If he has 6 dimes, how many total coins does he have?
def solve() -> int: num_dimes = 6 num_nickels = 3*num_dimes num_pennies = num_nickels + 50 total_coins = num_dimes + num_nickels + num_pennies result = total_coins return result
The monthly salary of an employee is $5000. If they contribute 20% of their salary to their savings account, in a year, how much will they save in total?
def solve() -> int: monthly_salary = 5000 saving_percentage = 0.2 annual_salary = monthly_salary * 12 saving_per_year = annual_salary * saving_percentage result = f'The employee will save ${saving_per_year} in a year.' result = saving_per_year return result
Joe has $500 in his savings account. If he withdraws $250, what percentage of his savings did he withdraw?
def solve() -> int: savings = 500 withdrawal = 250 percentage = (withdrawal / savings) * 100 result = percentage return result
Rachel traveled to Canada and exchanged 500 Canadian dollars. Normally, 1 Canadian dollar is worth 0.80 US dollars, but the airport money exchange only gave Rachel 50% of the official exchange rate. How much money did Rachel receive in US dollars?
def solve() -> int: cad = 500 official_rate = 0.80 exchange_rate = 0.50 usd_received = cad * official_rate * exchange_rate result = usd_received return result
The Smith family has 600 apples. They gave away 50 apples to their friends, 20 apples to their neighbors, and 50 apples to a food bank. What percentage of their original apples did they give away?
def solve() -> int: original_apples = 600 fruit_given_away = 120 percentage = (fruit_given_away/original_apples) * 100 result = percentage return result
Amelia takes the subway to work every day for 5 days. A single journey costs $3 each time she takes the subway. How much did she spend on the subway in total?
def solve() -> int: number_days = 5 price_journey = 3 total_price = number_days * price_journey result = total_price return result
A pizza has 8 slices each. There are 6 pizzas in a party. How many slices of pizza are there in total?
def solve() -> int: slices_per_pizza = 8 number_of_pizzas = 6 total_slices = slices_per_pizza * number_of_pizzas result = total_slices return result
If a book is discounted by 25% and now costs $15, what was the original price?
def solve() -> int: discounted_price = 15 original_price = discounted_price / 0.75 result = original_price return result
Student: Gloria and Harry went to the flower shop together. Gloria bought 18 roses. Harry bought twice as many roses as Gloria. Harry then threw away 6 of them and sold 1/3 of them to a customer. How many roses does Harry have left?
def solve() -> int: gloria_roses = 18 harry_roses = 2 * gloria_roses harry_roses -= 6 harry_roses -= harry_roses // 3 result = harry_roses return result
The sum of 5 numbers is 225. The average of the first two numbers is 35, and the last two numbers is 45. What is the third number?
def solve() -> int: sum_of_5numbers = 225 average1 = 35 average2 = 45 sum_of_firsttwo = 2*average1 sum_of_lasttwo = 2*average2 third_number = sum_of_5numbers - sum_of_firsttwo - sum_of_lasttwo result = third_number return result
A company needs to hire new employees. They have 3 levels of qualifications from Level 1 to Level 3. They need to hire a total of 20 employees with at least 5 on each level. If a Level 1 employee salary is $20, a Level 2 employee salary is $30, and a Level 3 employee salary is $40, what's the minimum amount of money th...
def solve() -> int: num_levels = 3 min_employees_per_level = 5 total_employees = 20 level1_salary = 20 level2_salary = 30 level3_salary = 40 employees_per_level = total_employees // num_levels level1_salary = employees_per_level - min_employees_per_level + 5 level2_salary = employees...
If 75 caterpillars turn into butterflies after 10 days, how many butterflies can be expected after 20 days?
def solve() -> int: number_of_caterpillars = 75 days_passed = 20 number_of_butterflies = number_of_caterpillars * (days_passed/10) result = number_of_butterflies return result
A table is being sold for $250, which is 25% off its original price. What was the original price of the table?
def solve() -> int: discounted_price = 250 discount_rate = 0.25 original_price = discounted_price / (1 - discount_rate) result = original_price return result
A cylinder has a radius of 4 centimeters and a height of 9 centimeters. What is the volume of the cylinder in cubic centimeters?
def solve() -> int: radius = 4 height = 9 volume = 3.14 * radius * radius * height result = volume return result
Emily buys 3 boxes of chocolates, where each box contains 12 chocolates and costs $15.50. What is the total amount she paid?
def solve() -> int: num_boxes = 3 chocolates_per_box = 12 cost_per_box = 15.50 total_cost = num_boxes * chocolates_per_box * cost_per_box result = total_cost return result
Possible new questions and programs are: Emily sells candles that normally cost $5 each. She makes a profit of $2 per candle. She decides to have a sale and reduce the price to $4 each. How many candles does she need to sell at the sale price to make the same profit as selling 10 candles at the normal price?
def solve() -> int: normal_profit = 10 * 2 sale_profit = 4 - 5 + 2 candles = normal_profit / sale_profit result = int(candles) return result
The Dolphins played 96 games and they won one-third of their games. They tied 24 games. How many games did they lose?
def solve() -> int: games_played = 96 games_won = games_played / 3 games_tied = 24 games_lost = games_played - games_won - games_tied result = games_lost return result
A single flight ticket is costing $300. A travel agency is giving a 10% discount on ticket prices. If a group of 6 people want to buy tickets for the same flight, how much money will they save?
def solve() -> int: ticket_price = 300 discount_percentage = 0.10 number_of_tickets = 6 total_before_discount = ticket_price * number_of_tickets total_discount = total_before_discount * discount_percentage total_saved = total_discount result = f'<<<{total_saved}>>>' result = total_saved ...
Jill wants to make 3 dozen cookies. Each recipe makes 2 dozen cookies. How many recipes does Jill need?
def solve() -> int: recipes_needed = 3 - 2 result = f'Jill needs {recipes_needed} recipe to make 3 dozen cookies.' result = recipes_needed return result
Abby is preparing for a long bike ride. She packs 8 pounds of water, 10 pounds of food, and 30 pounds of gear. During her ride, she drinks 1.5 pounds of water per hour and eats 1/6th pound of food per hour. After 8 hours, how much weight is she carrying?
def solve() -> int: water_weight = 8 food_weight = 10 gear_weight = 30 water_consumed = 1.5 * 8 food_consumed = (1/6) * 8 total_weight = water_weight + food_weight + gear_weight - water_consumed - food_consumed result = total_weight return result
A store is selling hats for $15 each and sunglasses for $10 each. If they sell 7 hats and 10 sunglasses, how much money did they make?
def solve() -> int: hat_price = 15 sunglass_price = 10 hats_sold = 7 sunglasses_sold = 10 total_sales = (hat_price*hats_sold) + (sunglass_price*sunglasses_sold) result = total_sales return result
arah wants to buy a new book. The book costs $20, but she only has $17. She decides to withdraw money from her savings account to buy the book. If she has $30 in her savings account, how much money will Sarah have left after buying the book?
def solve() -> int: book_cost = 20 balance = 17 savings_account = 30 balance += savings_account balance -= book_cost result = balance return result
A movie ticket costs $8. Ms. Wong bought 18 tickets and received a 20% discount for every ticket bought that exceeds 15. How much did Ms. Wong pay in all?
def solve() -> int: ticket_price = 8 ticket_number = 18 discount_rate = 0.2 discount_number = ticket_number - 15 total_price = ticket_price * ticket_number discount_amount = ticket_price * discount_rate * discount_number final_price = total_price - discount_amount result = final_pric...
The music department is organizing a concert and they need at least an average score of 90% for all the performers to get a bonus. There are 12 performers, and their current average score is 88%. What score must the absent performer get to reach the target average?
def solve() -> int: performers = 12 current_average = 88 target_average = 90 total_score = current_average * performers target_score = target_average * (performers + 1) absent_performer_score = target_score - total_score result = absent_performer_score return result
After 2 years, Sarah and Steve will be celebrating their 10th anniversary. How many months ago did they celebrate their 5th anniversary?
def solve() -> int: years_passed = 2 anniversary_number = 10 months_in_a_year = 12 months_passed = (anniversary_number - 5) * months_in_a_year - years_passed * months_in_a_year result = months_passed return result
In a study on dessert preferences, 70% of people prefer cake and ice cream while 20% prefer cake and pie. If 500 people were surveyed, how many people preferred pie over ice cream?
def solve() -> int: cake_icecream = 0.7 * 500 cake_pie = 0.2 * 500 pie = (1 - 0.7 - 0.2) * 500 pie_over_icecream = cake_pie - (cake_icecream * 0.2/0.7) result = pie_over_icecream return result
The Statue of Liberty weighs 4000 more pounds than the Sydney Opera House. Together they weigh a total of 25,000 pounds. How much does the Statue of Liberty weigh?
def solve() -> int: sydney_opera_house_weight = (25000 - 4000) / 2 statue_of_liberty_weight = sydney_opera_house_weight + 4000 result = statue_of_liberty_weight return result
A store sells a shirt for $40, which is a 60% markup from the cost. What is the cost of the shirt?
def solve() -> int: cost = 40 / 1.6 result = cost return result
Emily created a care package to send to her friend, who was away on vacation. Emily placed a box on the scale and then she added enough cookies to bring the weight to 1 pound. Then, she added enough chocolates to cause the weight to double. Next, she added another 2 pounds of cookies and finally, she added enough candi...
def solve() -> int: box_weight = 0 cookies_weight = 0 chocolates_weight = 0 candies_weight = 0 cookies_weight = 1 - box_weight box_weight += cookies_weight chocolates_weight = box_weight box_weight *= 2 cookies_weight = 2 box_weight += cookies_weight candi...
A pizza restaurant sells a small pizza for $12 and a large pizza for $18. If you order 2 small pizzas and 1 large pizza, how much will the total cost be?
def solve() -> int: num_small_pizzas = 2 small_pizza_price = 12 num_large_pizzas = 1 large_pizza_price = 18 total_cost = (num_small_pizzas * small_pizza_price) + (num_large_pizzas * large_pizza_price) result = total_cost return result
Lily played a video game with 3 different levels. Each level had 8 challenges with an average of 5 tasks in each challenge. How many tasks did Lily complete in total?
def solve() -> int: levels = 3 challenges_per_level = 8 tasks_per_challenge = 5 total_tasks = levels * challenges_per_level * tasks_per_challenge result = total_tasks return result
Student: Jade got 8 giftcards, each have a value of $15. How much money is on the giftcards?
def solve() -> int: giftcards = 8 value = 15 total_value = giftcards * value result = total_value return result
A store is offering a discount of 25% on an item whose original price is $80. What is the discounted price of the item?
def solve() -> int: original_price = 80 discount = 0.25 discounted_price = original_price - (original_price * discount) result = discounted_price return result
``` A rectangle has a length of 18 cm and a width of 12 cm. What is the area of the rectangle and how many square meters is it?
def solve() -> int: rectangle_length = 18 rectangle_width = 12 rectangle_area_cm = rectangle_length * rectangle_width rectangle_area_m = rectangle_area_cm / 10000 result = rectangle_area_m return result
Tyler walks to school and back home every day. The distance from his house to school is 1.25 kilometers each way. How many total kilometers does Tyler walk to and from school in 1 week if he attends school for 5 days?
def solve() -> int: distance_per_day = 1.25 days_per_week = 5 total_distance = distance_per_day * 2 * days_per_week result = total_distance return result
Zoe bought 5 boxes of tea that cost $6 each, 4 packs of biscuits that cost $7 each, and also 7 bags of popcorn for $3 each. How much did she pay in total?
def solve() -> int: tea = 5 biscuits = 4 popcorn = 7 tea_cost = 6 biscuits_cost = 7 popcorn_cost = 3 total_cost = tea*tea_cost + biscuits*biscuits_cost + popcorn*popcorn_cost result = total_cost return result
The length of a rectangle is 8 cm and its perimeter is 26 cm. What is the width of the rectangle?
def solve() -> int: length = 8 perimeter = 26 width = (perimeter - 2*length)/2 result = width return result
Tom has been working on a big project and only slept for 4 hours on three days this week. On the other days, he was only able to get 75% of the recommended 9 hours of sleep. How much sleep did he get this week?
def solve() -> int: days_in_week = 7 recommended_sleep = 9 sleep_on_three_days = 4 * 3 sleep_on_other_days = (recommended_sleep * days_in_week - sleep_on_three_days) * 0.75 total_sleep = sleep_on_three_days + sleep_on_other_days result = total_sleep return resul...
James has been exercising for about 45 minutes each day during the week and skips exercise on the weekend. He would ideally like to exercise for 1 hour each day. How many hours of exercise is he behind on from his goal for the past week?
def solve() -> int: minutes_per_day = 45 ideal_minutes_per_day = 60 days_in_week = 7 weekend_days = 2 total_minutes = minutes_per_day * (days_in_week - weekend_days) ideal_total_minutes = ideal_minutes_per_day * (days_in_week - weekend_days) minutes_behind = ideal_total_minutes - t...
A company's profits have increased from $100,000 to $120,000. What was the percentage increase in profits?
def solve() -> int: increase = 120000-100000 percent_increase = increase/100000 * 100 result = percent_increase return result
A mother bird lays 90 eggs every seven days. On the first day she lays 10% of the eggs, the second day she lays 3 fewer eggs than the first, the third day she lays 5 fewer eggs than the second, and the fourth day she lays 4 fewer eggs than the third. How many eggs does the mother bird lay on the fifth day?
def solve() -> int: firstDay = 0.1 * 90 secondDay = firstDay - 3 thirdDay = secondDay - 5 fourthDay = thirdDay - 4 fifthDay = fourthDay - 0 result = fifthDay return result
Mia has a rectangle garden with width of 5ft and length of 10ft. What is the area of the garden?
def solve() -> int: width = 5 length = 10 area = width * length result = area return result
A car travels 45 miles per hour. How far can it travel in 2 hours and 20 minutes?
def solve() -> int: speed = 45 time = 2 + 20/60 distance = speed * time result = distance return result
Jill needs to distribute 48 pieces of candy equally into 6 bags. How many pieces of candy will be in each bag?
def solve() -> int: total_candy = 48 num_bags = 6 candy_per_bag = total_candy / num_bags result = candy_per_bag return result
If a scientist spends six times as long conducting experiments as analyzing data, and the total time spent on both today was 640 minutes, how much time did the scientist spend analyzing data?
def solve() -> int: x = 640/7 result = x return result
Possible questions and python programs: A craft store sells one spool of ribbon at $3 each and one pack of buttons at $5 each. Kim buys four spools of ribbon and three packs of buttons. How much does she spend in all?
def solve() -> int: ribbon_price = 3 button_price = 5 ribbon_cost = ribbon_price * 4 button_cost = button_price * 3 total_cost = ribbon_cost + button_cost result = total_cost return result
Student: A rectangular garden is 10 yards long and 5 yards wide. What is the area of the garden in square yards?
def solve() -> int: length = 10 width = 5 area = length * width result = area return result
Student: Mary has $56. If the price of apples is $4.3 per pound, what is the maximum amount of pounds of apples she can buy?
def solve() -> int: money = 56 price_per_pound = 4.3 max_pounds = money // price_per_pound result = max_pounds return result
Megan measures the distance travelled by her car. In the first hour, the car travels 70km. For the second and third hour, it travels 40km per hour. What is the average distance travelled per hour?
def solve() -> int: first_hour_distance = 70 second_hour_distance = 40 * 1 third_hour_distance = 40 * 1 total_distance = first_hour_distance + second_hour_distance + third_hour_distance average_distance = total_distance / 3 result = average_distance return result
A math test had 50 questions. If a student got 80% of the questions correctly, how many questions did the student get right?
def solve() -> int: total_questions = 50 percent_correct = 80 num_correct = (percent_correct/100)*total_questions result = num_correct return result
John has $500 and spends $50 every week on groceries. How much money will he have after 6 weeks?
def solve() -> int: initial_money = 500 spent_on_groceries = 50 * 6 remaining_money = initial_money - spent_on_groceries result = remaining_money return result
A vase originally cost $35, but is now on sale for 20% off. What is the sale price of the vase?
def solve() -> int: original_price = 35 percent_off = 20 discount = original_price * (percent_off/100) sale_price = original_price - discount result = sale_price return result
Student: - Nina is a freelance tutor who teaches math and science to different students. She has 10 students who book a session with her every day and she teaches 7 of them each day. How many students will she have left to teach after 4 days.
def solve() -> int: n = 10 k = 7 d = 4 t = k * d l = n - t result = l return result
If you take the total number of toys in a gift box and double it, subtract 5 from that and then double it again, you get 140. How many toys are there in the gift box?
def solve() -> int: total_toys = (140/2)+5 gift_box_toys = total_toys/2 result = gift_box_toys return result
If a biker goes biking for 15 km in 2.5 hours, what is his average speed in km/h?
def solve() -> int: distance = 15 time = 2.5 speed_per_hour = (distance / time) result = speed_per_hour return result
A bakery sold 500 cakes last month with a profit of $15 per cake. This month, they decided to increase the price by 20% but sold 100 less cakes than last month with the same profit. What is the bakery's profit this month?
def solve() -> int: last_month_cakes = 500 this_month_cakes = last_month_cakes - 100 profit_per_cake = 15 this_month_price_increase_percentage = 20 this_month_price = (this_month_price_increase_percentage/100 + 1) * profit_per_cake this_month_profit = this_month_cakes * this_month_price re...
A supermarket sells coffee for $5.25 per pound. If Tom bought 2.5 pounds, how much does it cost him?
def solve() -> int: pounds = 2.5 price_per_pound = 5.25 total_price = pounds * price_per_pound result = total_price return result
Alice has a jar of candy that contains 4 types of candy: chocolate, caramel, gummy, and hard candy. She knows that there are 120 candies in total and that 25% of them are chocolate, 20% are caramel, 15% are gummy, and the rest are hard candy. She wants to share the candy equally with her 3 friends. How many candies of ...
def solve() -> int: chocolate = 120 * 0.25 caramel = 120 * 0.2 gummy = 120 * 0.15 hard = 120 - chocolate - caramel - gummy people = 4 chocolate_per_person = chocolate // people caramel_per_person = caramel // people gummy_per_person = gummy // people hard_per_person = hard // people ...
Daniel has a total of 150 toys but wants to donate some to charity. He gave 10 to an animal shelter and triple that amount to a children's hospital. If he decides to keep 45 toys for himself, how many toys did he donate in total?
def solve() -> int: total_toys = 150 toys_given_to_animal_shelter = 10 toys_given_to_children_hospital = toys_given_to_animal_shelter * 3 toys_kept_for_himself = 45 toys_donated = toys_given_to_animal_shelter + toys_given_to_children_hospital result = toys_donated return result