question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Max planned on practicing guitar for nine hours to prepare for a gig. If he ends up spending only two-fifths of this time practicing, and he plays a song every twenty minutes, how many songs did he play in this time?
def solve() -> int: hours_practiced = 9 hours_actual = hours_practiced * 2/5 minutes_practiced = hours_actual * 60 songs_played = minutes_practiced / 20 result = songs_played return result
Mr. Anderson drove to work today at an average speed of 50 miles per hour. It took him 45 minutes to reach his workplace. How many miles is Mr. Anderson's workplace from his house?
def solve() -> int: average_speed = 50 time_in_hours = 45/60 distance = average_speed * time_in_hours result = distance return result
A teacher has 42 students in their class. If the class has 15 boys and 27 girls, what percentage of the class is male?
def solve() -> int: boys = 15 girls = 27 total_students = boys + girls percentage_male = (boys / total_students) * 100 result = percentage_male return result
Tina ran 2.8 kilometers during her morning run, and 4 kilometers in the evening. How much farther did Tina run than during the morning run?
def solve() -> int: morning_run = 2.8 evening_run = 4 diff_distance = evening_run - morning_run result = diff_distance return result
Student: A bakery sells pies for $8 each, but offers a 10% discount if you buy 3 or more pies. A customer buys 5 pies and pays with a $50 bill. How much change does the customer receive?
def solve() -> int: price_per_pie = 8 num_pies = 5 discount_rate = 0.1 payment = 50 total_cost = num_pies * price_per_pie discounted_cost = total_cost * (1 - discount_rate) change = payment - discounted_cost result = change return result
If the number of books is 3 times the number of pencils in a certain library, and now there are 120 pencils in the library. How many books are in the library now?
def solve() -> int: pencils = 120 books = pencils * 3 result = books return result
Jacob has a piggy bank with 100 coins in it. He found out that 60% of them are quarters. What's the total amount of money Jacob has in his piggy bank?
def solve() -> int: coins = 100 quarters = coins * 0.6 total_amount = quarters * 0.25 result = total_amount return result
A parking lot charges $2 per hour of parking. A car parked there for 3 and a half hours. How much does the car owner have to pay?
def solve() -> int: parking_time = 3.5 parking_cost_per_hour = 2 total_cost = parking_time * parking_cost_per_hour result = total_cost return result
A bag of 50 golf balls costs $75. How much does each golf ball cost if they are sold in bags of 10?
def solve() -> int: num_golf_balls = 50 total_cost = 75 num_balls_per_pack = 10 num_packs = num_golf_balls // num_balls_per_pack cost_per_ball = total_cost / num_balls_per_pack / num_packs result = cost_per_ball return result
ally bought 3 packs of pencils for $1.50 each and 2 notebooks for $3.00 each. How much did she spend in total?
def solve() -> int: pencil_price = 1.5 notebook_price = 3 num_packs_of_pencils = 3 num_notebooks = 2 total_spent_on_pencils = pencil_price * num_packs_of_pencils total_spent_on_notebooks = notebook_price * num_notebooks total_spent = total_spent_on_pencils + total_spent_on_notebooks resu...
A farmer has eight cows and twelve chickens on his farm. Each cow needs three liters of water and each chicken needs half a liter of water per day. How much water does the farmer need to supply for his animals in a week?
def solve() -> int: water_per_cow = 3 water_per_chicken = 0.5 water_per_day = water_per_cow * 8 + water_per_chicken * 12 water_per_week = water_per_day * 7 result = water_per_week return result
arah is ordering office supplies online. The website charges $3.00 flat rate shipping for orders under $20. For orders $20 or above, they charge 10% of the purchase price for shipping. Sarah orders 3 packs of pens for $5.00 each, 2 boxes of envelopes for $7.50 each, and a box of paperclips for $4.00. What is her total ...
def solve() -> int: total_price = 3*5.00 + 2*7.50 + 4.00 if total_price < 20: shipping_cost = 3.00 else: shipping_cost = 0.10 * total_price total_bill = total_price + shipping_cost result = total_bill return result
Student: There were 144 books in the library. If 1 student borrowed 12 books from the library, how many books were left?
def solve() -> int: total_books = 144 borrowed_books = 12 books_left = total_books - borrowed_books result = books_left return result
Student: A 16 story building has 8 apartments on each floor. If each floor houses four people, how many people does the building house?
def solve() -> int: num_floors = 16 num_apartments = 8 num_people_per_apartment = 4 total_people = num_floors * num_apartments * num_people_per_apartment result = total_people return result
A pizza restaurant gives customers a 20% discount if they order at least 3 pizzas. The Johnson family made an order of 5 pizzas and got a free garlic bread. If one pizza costs $24, how much did the Johnson family pay in all?
def solve() -> int: pizza_price = 24 num_pizzas = 5 discount = 0.2 min_pizzas_for_discount = 3 garlic_bread_price = 0 total_cost = pizza_price * num_pizzas if num_pizzas >= min_pizzas_for_discount: total_cost *= (1 - discount) total_cost += garlic_bread_price ...
James has 5 more pencils than Tom, who has 8 pencils. If they combined their pencils, what is the total number of pencils?
def solve() -> int: james_p = 8 + 5 total_p = james_p + 8 result = total_p return result
If a garden bed is 6 meters long and 4 meters wide, and each flower takes up 0.1 square meters, how many flowers can be planted in the bed?
def solve() -> int: length = 6 width = 4 area = length * width flower_area = 0.1 flowers = area / flower_area result = flowers return result
A company has 25 employees, and each employee can manufacture 5 units in an hour. If the company operates for 6 hours a day, calculate the total number of units it can produce in a week.
def solve() -> int: num_employees = 25 units_per_hour = 5 hours_per_day = 6 days_per_week = 7 total_units = num_employees * units_per_hour * hours_per_day * days_per_week result = total_units return result
If there are 16 students in a class and 4 drop out, there will be half as many left as if 6 new students join the class. How many students were initially in the class?
def solve() -> int: initial_students = 0 dropouts = 4 new_students = 6 students_left = initial_students - dropouts students_after_joining = students_left + new_students initial_students = students_after_joining * 2 result = initial_students return result
Leah had 20 crayons in her box. She gave 7 crayons to her sister and used 4 crayons to color her drawing. If the box can hold up to 25 crayons, how many crayons does Leah need to fill the box? Jason bought a new laptop for $1500. He also bought a warranty plan that costs $300/year, a mouse that costs 10% of the cost of...
def solve() -> int: crayons_in_box = 20 crayons_given_away = 7 crayons_used_for_drawing = 4 crayons_left_in_box = crayons_in_box - crayons_given_away - crayons_used_for_drawing crayons_needed_to_fill_box = 25 - crayons_left_in_box laptop_cost = 1500 warranty_cost = 300 mouse_cost = ...
Tom needs 144 donuts for his coffee shop. He already has made 36 glazed donuts and 48 chocolate donuts. He wants an equal number of jelly and powdered sugar donuts to complete the order. How many of each should he make?
def solve() -> int: total_donuts = 36 + 48 donuts_left = 144 - total_donuts jelly_donuts = donuts_left / 2 powdered_sugar_donuts = donuts_left / 2 result = f'Tom needs to make {jelly_donuts} jelly donuts and {powdered_sugar_donuts} powdered sugar donuts.' return result
At the end of last year, Paul had €25,800 in his savings account. If the interest rate for the year is 10%, what will the balance be at the end of the year?
def solve() -> int: savings = 25800 interest_rate = 10/100 interest = savings * interest_rate result = savings + interest return result
If a shirt costs $25 and the sales tax is 7%, what is the total cost of the shirt including tax?
def solve() -> int: price = 25 sales_tax = 0.07 total_cost = (1+sales_tax) * price result = total_cost return result
Andrew has a collection of 23 paint brushes. He loses 8 of them but he still has four more than his brother John. How many paint brushes do Andrew and John have altogether? A conference has 250 attendees. The number of attendees who registered online is twice the number of those who registered on-site. The rest of the ...
def solve() -> int: andrew_paint_brushes = 23 lost_paint_brushes = 8 john_paint_brushes = andrew_paint_brushes - lost_paint_brushes - 4 total_paint_brushes = andrew_paint_brushes + john_paint_brushes conference_attendees = 250 onsite_registrations = 50 online_registrations = (conference...
Patrick Mahomes hits a golf ball 100 yards when the temperature is 55 degrees Fahrenheit, but the ball moves 2 times as far when the temperature is 85 degrees Fahrenheit. Yesterday, the temperature was 55 degrees Fahrenheit, and he hit the golf ball 15 times. Today, the temperature rose to 85 degrees Fahrenheit, and he...
def solve() -> int: temp_yesterday = 55 temp_today = 85 distance_yesterday = 100 distance_today = distance_yesterday * 2 hits_yesterday = 15 hits_today = 30 total_yards_yesterday = distance_yesterday * hits_yesterday total_yards_today = distance_today * hits_today total_yards = ...
If Mercedes has 2 cups of sugar and 16 cups of flour, what is the ratio of sugar to flour?
def solve() -> int: cups_of_sugar = 2 cups_of_flour = 16 ratio_sugar_to_flour = cups_of_sugar / cups_of_flour result = ratio_sugar_to_flour return result
A lake can contain up to 450000 aquatic organisms. If the lake starts to lose 13000 per day, how many weeks will it take to reach a third of its initial number?
def solve() -> int: a = 450000 d = 13000 result = (a // 3) // (d * 7) result = 11 return result
Student: Anna has 4 jars of jam and wants to make 12 sandwiches. Each sandwich needs 0.25 jars of jam. How many jars of jam will Anna have left after making the sandwiches?
def solve() -> int: jars_of_jam = 4 sandwiches = 12 jars_per_sandwich = 0.25 total_jars_needed = sandwiches * jars_per_sandwich jars_left = jars_of_jam - total_jars_needed result = jars_left return result
Fred wants to buy a new car and needs to raise $32,000. He has saved $20,000 so far, and can borrow money from the bank at 8% annual interest rate. If Fred wants to pay off the loan in 5 years, how much money will he need to borrow from the bank?
def solve() -> int: principal_amount = 32000 down_payment = 20000 annual_interest_rate = 0.08 num_years = 5 monthly_interest_rate = annual_interest_rate / 12 num_payments = num_years * 12 monthly_payment = (principal_amount - down_payment) * (monthly_interest_rate / (1 - (1 + month...
A car travels 200 km in 4 hours. What is the average speed of the car?
def solve() -> int: distance = 200 time = 4 speed = distance / time result = speed return result
A factory has 60 machines which need a oil change. The manufacturer has already serviced 20 machines. How many more machines need an oil change?
def solve() -> int: total_machines = 60 serviced_machines = 20 remaining_machines = total_machines - serviced_machines result = remaining_machines return result
Student: In 4 years, Luisa will be 4 times as old as Tina. If Tina is currently 17 years old, how old is Luisa?
def solve() -> int: tina_age = 17 luisa_age = 0 luisa_age = tina_age * 4 result = luisa_age return result
Grace is cutting ribbon. She has 15 meters of ribbon in total. She needs to cut 3 pieces of ribbon that are 1.5 meters each, 5 pieces of ribbon that are 0.5 meters each, and 2 pieces of ribbon that are 2 meters each. How much ribbon will she have left after cutting?
def solve() -> int: ribbon = 15 piece1 = 1.5 piece2 = 0.5 piece3 = 2 num1 = 3 num2 = 5 num3 = 2 total_pieces = piece1 * num1 + piece2 * num2 + piece3 * num3 remaining_ribbon = ribbon - total_pieces result = remaining_ribbon return result
If there are 7 bears and each needs 3 pounds of fish twice a day and 2 berries once a day, how many pounds of fish and berries are needed to feed the bears for a week?
def solve() -> int: bears = 7 fish_per_bear_per_day = 3 * 2 berries_per_bear_per_day = 2 days_in_week = 7 total_fish_needed = bears * fish_per_bear_per_day * days_in_week total_berries_needed = bears * berries_per_bear_per_day * days_in_week result = f'{total_fish_needed} pounds of...
Student: Stacy has $3000 and deposits $5000 into an 8% interest account. If she does not withdraw any of the money for 5 years, how much money will she have in the account after 5 years?
def solve() -> int: principal = 3000 deposit = 5000 interest_rate = 0.08 time = 5 total_amount = principal + deposit interest = total_amount * interest_rate * time result = total_amount + interest return result
7 years ago, a teacher was four times as old as her student. If the teacher is 35 years old now, how old will the student be in 2 years?
def solve() -> int: teacher_age_7_years_ago = 35 - 7 student_age_7_years_ago = teacher_age_7_years_ago / 4 student_age_in_2_years = student_age_7_years_ago + 9 result = student_age_in_2_years return result
Michael can wash a car in 15 minutes and mow a lawn in 30 minutes. How long will it take him to wash 3 cars and mow 4 lawns?
def solve() -> int: wash_time = 15 mow_time = 30 num_cars = 3 num_lawns = 4 total_wash_time = wash_time * num_cars total_mow_time = mow_time * num_lawns total_time = total_wash_time + total_mow_time result = total_time return result
Halle saved $40 per month from January to March, and saved $60 per month from April to October. How much should she save in November so she will have a total savings of $620 in the year?
def solve() -> int: savings_Jan_to_Mar = 40 * 3 savings_Apr_to_Oct = 60 * 7 total_savings = 620 savings_Nov = (total_savings - savings_Jan_to_Mar - savings_Apr_to_Oct) / 1 result = f'Halle should save ${savings_Nov} in November.' result = savings_Nov return result
10. Sue went to the store and bought 6 baseball caps and 4 gardening gloves at $7 each. How much did she spend?
def solve() -> int: caps = 6 gloves = 4 price_each = 7 total_caps = caps * price_each total_gloves = gloves * price_each total = total_caps + total_gloves result = total return result
The music store sold 100 CDs for $10 each and 80 vinyl records for $20 each. Then the money from their sales was used to buy 3 guitars that cost $200 each. The rest of the money was used to buy 20 music sheets. How much does a music sheet cost?
def solve() -> int: cds_sold = 100 cds_price = 10 vinyl_records_sold = 80 vinyl_records_price = 20 guitars_bought = 3 guitars_price = 200 music_sheets_bought = 20 total_money = (cds_sold * cds_price) + (vinyl_records_sold * vinyl_records_price) total_money_left = total_money - (guita...
A train travels from A to B at a speed of 120 km/h, and from B to A at a speed of 80 km/h. If the distance between A and B is 600 km, what is the average speed of the train for the entire journey?
def solve() -> int: distance = 600 speed_1 = 120 speed_2 = 80 time_1 = distance/speed_1 time_2 = distance/speed_2 total_time = time_1 + time_2 avg_speed = 2*distance/total_time result = avg_speed return result
In 2009, Jim and his brother Ted each had 100 coins. Every year, Jim receives 10 more coins than Ted. How many coins does Ted have in 2011?
def solve() -> int: value1 = 100 value2 = 10 result = value1 - 3*value2 return result
Mary has 50 coins in her wallet, consisting of quarters and dimes. If the total value of the coins is $8.90, how many quarters does Mary have?
def solve() -> int: num_coins = 50 total_value = 8.9 for num_quarters in range(num_coins+1): num_dimes = num_coins - num_quarters value = 0.25*num_quarters + 0.10*num_dimes if value == total_value: break result = num_quarters return result
Nina made 36 cupcakes. She sold 12 cupcakes for $2 each and the rest for $3 each. How much money did she make in total?
def solve() -> int: cupcakes_3 = 36 - 12 money_2 = 12 * 2 money_3 = cupcakes_3 * 3 money_total = money_2 + money_3 result = money_total return result
Student: Shirley’s family has 4 family members and their dinner bill totals $72. How much should each family member pay for their dinner?
def solve() -> int: family_members = 4 total_bill = 72 amount_per_person = total_bill / family_members result = amount_per_person return result
Student: The price of a sweater is $50. It is on sale for 20% off. What is the sale price of the sweater?
def solve() -> int: original_price = 50 discount_rate = 0.2 sale_price = original_price * (1 - discount_rate) result = sale_price return result
A triangle has a base of length 5cm and a height of 8cm. What is the area of the triangle?
def solve() -> int: b = 5 h = 8 area = 0.5 * b * h result = area return result
A classroom has a total of 30 chairs and tables combined. There are 7 tables in the classroom. How many chairs are there?
def solve() -> int: total_items = 30 total_tables = 7 total_chairs = total_items - total_tables result = total_chairs return result
A company sold 98 toys at $12 each and 214 books at $8 each. The company gave a discount of 15% on the total sale. What was the final amount paid by the customers after the discount?
def solve() -> int: toy_price = 12 toy_num = 98 book_price = 8 book_num = 214 total_sale = (toy_price * toy_num) + (book_price * book_num) discounted_sale = total_sale * 0.85 result = discounted_sale return result
Student: Olivia had $20, then she spent $6 on lunch and $8 on a movie ticket. She then found $5 on the ground. How much money does Olivia have now?
def solve() -> int: initial_amount = 20 lunch_cost = 6 movie_ticket_cost = 8 found_money = 5 result = initial_amount - lunch_cost - movie_ticket_cost + found_money return result
Possible questions and programs: Mrs. Lee baked 8 pies for a school fundraiser. Each pie can be cut into 6 slices. She sold 5 pies and gave away 12 slices to the volunteers. How many slices of pie did she have left?
def solve() -> int: total_slices = 8 * 6 sold_slices = 5 * 6 given_slices = 12 left_slices = total_slices - sold_slices - given_slices result = left_slices return result
Possible new questions and python programs are: The Sydney Opera House has 9 fewer shells than the Louvre Pyramid. Together they have a total of 21 shells. How many shells does the Sydney Opera House have?
def solve() -> int: opera = 0 pyramid = 0 total = 21 pyramid = (total + 9) / 2 opera = pyramid - 9 opera = pyramid - 9 result = opera return result
Ben has 7 books, which are in total worth $35. If we know that one book is worth $8, and all the other books have the same value, how much does one of the other books cost?
def solve() -> int: value_of_one_book = 8 * 1 value_of_other_books = 35 - value_of_one_book number_of_other_books = 7 - 1 value_of_one_of_other_books = value_of_other_books / number_of_other_books result = value_of_one_of_other_books return result
At a restaurant, a lasagna dish costs $18. If the lasagna is cut into 8 equal slices, how much does each slice cost?
def solve() -> int: cost_lasagna = 18 number_slices = 8 cost_slice = cost_lasagna/number_slices result = cost_slice return result
Student: If each pizza slice cost 75 cents, how much money will Jack need to spend to buy 6 pizza slices?
def solve() -> int: num_slices = 6 cost_per_slice = 0.75 total_cost = num_slices * cost_per_slice result = total_cost return result
Olivia is a train conductor deciding how much fuel to put in her train. The train needs 50 gallons of fuel per mile. Each passenger on board increases this amount by 15 gallons per mile, and each cargo container increases it by 20 gallons per mile. If there are 100 passengers on board and 20 cargo containers for a 1000...
def solve() -> int: passenger_fuel = 15 * 100 cargo_fuel = 20 * 20 total_fuel = 50 + passenger_fuel + cargo_fuel total_fuel *= 1000 result = total_fuel return result
Yara has a recipe for lemonade that requires six lemons, half a cup of sugar, and four cups of water for every pitcher. She wants to make enough lemonade for her party, where she expects 24 guests. Each guest drinks about two cups of lemonade on average. How many lemons and cups of sugar does she need to buy?
def solve() -> int: cups = 24 * 2 pitchers = cups // 4 remainder = cups % 4 if remainder > 0: pitchers = pitchers + 1 lemons = pitchers * 6 sugar = pitchers * 0.5 result = (lemons, sugar) return result
If there are 300 pets in a shelter, and 1/4 of them are dogs, while the rest of them are cats. Find the number of cats in the shelter.
def solve() -> int: pets_in_shelter = 300 dogs = pets_in_shelter / 4 cats = pets_in_shelter - dogs result = cats return result
A farmer plants 5 rows of tomatoes. There are 17 tomato plants per row. How many tomato plants does he have in total?
def solve() -> int: number_of_rows = 5 number_of_plants_per_row = 17 total_number_of_plants = number_of_rows*number_of_plants_per_row result = total_number_of_plants return result
A recipe calls for 2 eggs for every 3 cups of flour. If you want to use 6 eggs, how much flour do you need?
def solve() -> int: eggs_needed = 2 flour_per_eggs = 3 / eggs_needed eggs_used = 6 flour_needed = flour_per_eggs * eggs_used result = flour_needed return result
The length of a rectangle is twice the width. If the width is 5 units, what is the perimeter of the rectangle?
def solve() -> int: width = 5 length = 10 perimeter = 2 * (length + width) result = perimeter return result
Jacob saved $350 in his account that earns 4% simple interest per annum. Lily has $50 more in her account than Jacob and her account earns 5% simple interest per annum. After how many years will their savings be equal?
def solve() -> int: jacob_savings = 350 jacob_interest_rate = 0.04 lily_savings = jacob_savings + 50 lily_interest_rate = 0.05 years = 0 while jacob_savings < lily_savings: jacob_savings += jacob_savings * jacob_interest_rate lily_savings += lily_savings * lily_interest_rate...
In a zoo, there are 50 monkeys. One eighth of them are baboons, and half of the baboons can walk on two legs. If there are 3 baboons who can walk on two legs, how many baboons are there in the zoo?
def solve() -> int: monkeys = 50 baboons = monkeys / 8 baboons_two_legs = 3 baboons_total = baboons_two_legs * 2 / 0.5 result = baboons_total return result
Mina and Lesley have finished making origami stars, and each has made 17 stars. How many origami stars did they make together?
def solve() -> int: stars_mina = 17 stars_lesley = 17 total_stars = 17 + 17 result = total_stars return result
heryl baked 18 muffins and then put them in a box. She then decided to share 3 of them with her neighbor, and gave away 4 more to her family. How many muffins does she have left?
def solve() -> int: num_muffins_start = 18 num_muffins_neighbor = 3 num_muffins_family = 4 num_muffins_left = num_muffins_start - num_muffins_neighbor - num_muffins_family result = num_muffins_left return result
Student: Ms. Miller had 15 toy cars. She gave away 3/7 of the cars to her niece. She then gave away ¼ of what remained. How many toy cars did her niece receive?
def solve() -> int: cars = 15 niece_cars = 3/7 * cars left_cars = cars - niece_cars second_cars = 1/4 * left_cars total_cars = niece_cars + second_cars result = total_cars return result
Maria has five hamsters. Each one eats 2 teaspoons of seeds, five times a day, and 1 teaspoon of carrots once a day. How many teaspoons of food does she need to feed her hamsters for 3 days?
def solve() -> int: hamsters = 5 seeds_per_hamster_per_day = 2 * 5 carrots_per_hamster_per_day = 1 total_food_per_hamster_per_day = seeds_per_hamster_per_day + carrots_per_hamster_per_day total_food_per_day = total_food_per_hamster_per_day * hamsters total_food_for_3_days = total_food_per_day * ...
Sylvia is an artist, and she collaborates with a group of other artists to plan art exhibitions. Over the past few months, she collaborated with 12 groups of artists, and in one group, she worked with two artists she had already worked with, and in another group, she worked with one artist she had previously worked wit...
def solve() -> int: total_groups = 12 artists_per_group = 2 total_artists = total_groups * artists_per_group artists_worked_with_again = 2 other_artists = total_artists - artists_worked_with_again result = other_artists return result
Student: What is the area of a square with sides 4 cm each?
def solve() -> int: side_length = 4 area = side_length ** 2 result = area return result
A local farmer sells a box of apples for $4.50. Each box contains 12 apples. If Alex bought 180 apples, how much did he spend?
def solve() -> int: num_of_apples = 180 price_for_box = 4.50 num_of_apples_in_box = 12 number_of_boxes = num_of_apples / num_of_apples_in_box total_price_spent = number_of_boxes * price_for_box result = total_price_spent return result
A gym provides a bonus to their trainers based on the number of clients they sign up for a year. If they sign up more than 50 clients, they get a $1,000 bonus, plus an additional $20 for every client above 50. Last year, Cindy signed up 30 clients and earned a $200 bonus. How many more clients does she need to sign up ...
def solve() -> int: bonus_threshold = 1500 bonus_base = 1000 bonus_per_client = 20 current_clients = 30 current_bonus = 200 clients_needed = (bonus_threshold - current_bonus - bonus_base) / bonus_per_client clients_needed = int(clients_needed) + 1 total_clients_needed = cu...
A factory produces 600 widgets every hour. How long will it take to produce 10,000 widgets?
def solve() -> int: widgets_per_hr = 600 widgets_needed = 10000 time_needed = widgets_needed/widgets_per_hr result = time_needed return result
A pizza restaurant offers a small pizza for $10 and a large pizza for $15. If a customer orders 2 small pizzas and 1 large pizza, what is the total cost of the order?
def solve() -> int: small_pizza = 10 large_pizza = 15 total_cost = (2 * small_pizza) + large_pizza result = total_cost return result
George is finishing his dissertation and needs to print it out. He only has two sides of blank paper. If his dissertation is 400 pages, how many reams of paper does he need?
def solve() -> int: pages = 400 sides = 2 total_sides = pages * sides reams = total_sides/500 result = round(reams) return result
In nine years, Max will be 35 years old. Max's sister is currently half as old as Max is today. In five years, Max's father will be the same age as Max's sister is today. Currently, how old is Max's father?
def solve() -> int: max_age_in_nine_years = 35 max_age_today = max_age_in_nine_years - 9 sister_age_today = max_age_today / 2 father_age_in_five_years = sister_age_today + 5 father_age_today = father_age_in_five_years - 5 result = father_age_today return result
John has twice as many balloons as Alex, while Anna has 30 more balloons than John. If Alex has 15 balloons, determine the total number of balloons.
def solve() -> int: alex_balloons = 15 john_balloons = 2 * alex_balloons anna_balloons = john_balloons + 30 total_balloons = alex_balloons + john_balloons + anna_balloons result = total_balloons return result
Student: Lisa spent $20 on a meal. She wants to leave a 15% tip for the waiter. What is the total amount she spent?
def solve() -> int: meal_cost = 20 tip_percentage = 0.15 tip = meal_cost * tip_percentage total_amount = meal_cost + tip result = total_amount return result
A soccer coach needs to hand out 32 team t-shirts. There are 8 players on the team. If 5 players wear a size small and 3 wear a size medium, how many t-shirts will each of those sizes receive?
def solve() -> int: players = 8 small_players = 5 medium_players = 3 total_tshirts = 32 small_tshirts = (small_players / players) * total_tshirts medium_tshirts = (medium_players / players) * total_tshirts result = small_tshirts result = medium_tshirts return result
Luna is buying 12 bottles of Skele-Gro that cost 21 bronze each, eight packets of crumple-horned snorkacks that cost 85 silver each, and a nargle trapping net worth 110 gold. If there are 1000 bronze in a silver, how much will Luna pay in total, in silver?
def solve() -> int: bottles_of_skele_gro = 12 cost_of_skele_gro = 21 packets_of_snorkacks = 8 cost_of_snorkacks = 85 cost_of_nargle_net = 110 total_cost_in_bronze = (bottles_of_skele_gro * cost_of_skele_gro) + (packets_of_snorkacks * cost_of_snorkacks) + cost_of_nargle_net total_cost_in...
Student: If a rectangle has an area of 60 m² and a length of 12 m, what is the width of the rectangle?
def solve() -> int: length = 12 area = 60 width = area / length result = width return result
Student: Anna has 10 one dollar bills in her wallet. She spends 3 dollars at the store and then receives 2 five dollar bills as change. How much money, in dollars, does Anna have now?
def solve() -> int: initial_money = 10 spent_money = 3 change_money = 2 * 5 remaining_money = initial_money - spent_money + change_money result = remaining_money return result
If a pizza has 8 slices and Jack ate 2 slices, Jill ate 3 slices, and Joe ate one slice. How many slices of pizza are left?
def solve() -> int: total_slices = 8 jack_slices_eaten = 2 jill_slices_eaten = 3 joe_slices_eaten = 1 remaining_slices = total_slices - (jack_slices_eaten + jill_slices_eaten + joe_slices_eaten) result = remaining_slices return result
Rachel has been working at a coffee shop for 2 years and makes $1500 per month. She gets a job at a new coffee shop and starts making 10% more. If she worked at the new coffee shop for 9 months, how much total money does she make?
def solve() -> int: current_salary = 1500 new_salary = current_salary * 1.1 total_earnings = new_salary * 9 result = total_earnings return result
In a certain farm, there are 10 goats and 12 sheeps. 5 goats and 4 sheeps left the farm, how many animals are left in the farm?
def solve() -> int: goats = 10 sheeps = 12 goats_left = 5 sheeps_left = 4 total_animals = goats + sheeps - goats_left - sheeps_left result = total_animals return result
Possible questions and programs: A pizza place is offering a special deal of one large pizza and two drinks for $15. The regular price of a large pizza is $12 and a drink is $2. A group of friends orders three large pizzas and six drinks. How much money do they save by using the special deal?
def solve() -> int: regular_price = 3 * 12 + 6 * 2 deals = (3 + 6) // 3 extra_pizzas = 3 % 3 extra_drinks = 6 % 3 special_price = deals * 15 + extra_pizzas * 12 + extra_drinks * 2 difference = regular_price - special_price result = difference return result
Kelly has a jar of coins. She has 20 quarters, 15 dimes, 10 nickels, and 5 pennies. She wants to buy a book that costs $12. How much more money does she need to buy the book?
def solve() -> int: quarters = 20 * 0.25 dimes = 15 * 0.10 nickels = 10 * 0.05 pennies = 5 * 0.01 coins = quarters + dimes + nickels + pennies need = 12 - coins result = need return result
Michael has a fast bike and a slow bike. He has to pedal the slow bike six times for every one time he pedals the fast bike. If he pedals the fast bike 18 times, how many times does he pedal both bikes combined?
def solve() -> int: fast_bike_pedals = 18 slow_bike_pedals = 6 * fast_bike_pedals total_pedals = fast_bike_pedals + slow_bike_pedals result = total_pedals return result
A bakery sells cupcakes for $1 each. If they sell 500 cupcakes in a day, how much money do they make in total?
def solve() -> int: cupcakes_sold = 500 price_per_cupcake = 1 total_money = cupcakes_sold * price_per_cupcake result = total_money return result
A man sold 1/4 of his land at a gain of 20%. He sells another 1/5 of the remaining at a gain of 25%. He then donates 10% of the remaining land to a charity. If he is left with another 600 hectares, find the original quantity of land he owned.
def solve() -> int: final_land = 600 donation = 0.1 gain1 = 20 gain2 = 25 remaining_after1 = (1 - 1/4) remaining_after2 = (1 - 1/4) * (1 - 1/5) land_left_after_donation = (1 - donation) * remaining_after2 * remaining_after1 * 100 * final_land / 100 result = int(land_left_after_don...
A class of 25 students needs to purchase notebooks for the school year. Each student needs 3 notebooks, and notebooks are sold in packs of 12. How many packs of notebooks should the class buy in total?
def solve() -> int: num_students = 25 num_notebooks_per_student = 3 num_notebooks_per_pack = 12 total_notebooks_needed = num_students * num_notebooks_per_student total_packs_needed = total_notebooks_needed // num_notebooks_per_pack + (total_notebooks_needed % num_notebooks_per_pack > 0) result =...
Tom had 30 pieces of fabric for his project. He used 18 pieces of fabric to complete the project. How many pieces of fabric does Tom have left?
def solve() -> int: fabric_total = 30 fabric_used = 18 result = fabric_total - fabric_used return result
A cinema has 200 seats. If 25% of the seats are already sold, how many seats are left?
def solve() -> int: num_seats = 200 percentage_sold = 0.25 num_sold = int(num_seats * percentage_sold) num_left = num_seats - num_sold result = num_left return result
10. Elaine needed to paint a fence that was 32 feet long. If she can paint 4 feet of fence in 1 minute, how long did it take her to paint the whole fence?
def solve() -> int: Length_of_Fence = 32 Feet_Painted_Per_Minute = 4 Total_Minutes = Length_of_Fence / Feet_Painted_Per_Minute result = Total_Minutes return result
If John ran three times as many miles as Kate did last week, and this week he runs three times that number while Kate runs only 20% more, how many miles did John run across both weeks if Kate ran 45 miles this week?
def solve() -> int: kate_miles_this_week = 45 john_miles_this_week = 3 * kate_miles_this_week kate_miles_last_week = kate_miles_this_week / 1.2 john_miles_last_week = 3 * kate_miles_last_week total_miles = john_miles_this_week + john_miles_last_week result = total_miles return...
Andrew wants to start cycling regularly. He cycles 6 miles on Monday, Wednesday, and Friday, and doubles the mileage every Tuesday, Thursday, and Saturday. On Sunday, he rest. He needs to pay $100 for a monthly membership and $. 1 for every mile he cycles. How much does he spend in total for the first quarter of the ye...
def solve() -> int: weekly_miles = (6 * 3) + (12 * 3) monthly_miles = weekly_miles * 4 total_miles = monthly_miles * 3 payment = (total_miles * 0.1) + (100 * 3) result = payment return result
A car travels 40 miles at a speed of 30mph and then travels another 60 miles at a speed of 50mph. What is the average speed of the car for the whole journey?
def solve() -> int: time1 = 40/30 time2 = 60/50 distance = 40 + 60 time = time1 + time2 speed = distance/time result = speed return result
You draw a square that has an area of 25 square centimeters. What is the length of each side?
def solve() -> int: area = 25 side_length = area**(1/2) result = side_length return result
ome possible questions and programs are: Oscar sold 2000 copies of his book on Amazon on the first week. The sales increased by 20% each week for the next three weeks. How many copies of his book did Oscar sell in total after four weeks?
def solve() -> int: copies = 2000 for week in range(2,5): copies = copies * 1.2 result = copies return result
A car travels 60 miles per hour. How far will it travel in 3 hours?
def solve() -> int: speed = 60 time = 3 distance = speed*time result = distance return result
If Joanna has $3.20 and spends all of it buying 0.75 pounds of strawberries and 0.45 pounds of blueberries, how much money does she have left?
def solve() -> int: cost_straw = 3.20/0.75 cost_blue = 3.20/0.45 remained = 3.20 - cost_straw - cost_blue result = remained return result