question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Laura and Kevin are collecting coins for charity. On Monday, Laura collects 10 quarters and 15 dimes, while Kevin collects 8 quarters and 20 dimes. On Tuesday, Laura collects 12 quarters and 18 dimes, while Kevin collects 10 quarters and 16 dimes. On Wednesday, both of them collect 9 quarters and 12 dimes each. How man...
def solve() -> int: laura_monday = 10 * 25 + 15 * 10 kevin_monday = 8 * 25 + 20 * 10 laura_tuesday = 12 * 25 + 18 * 10 kevin_tuesday = 10 * 25 + 16 * 10 wednesday = 9 * 25 + 12 * 10 laura_total = laura_monday + laura_tuesday + wednesday kevin_total = kevin_...
A book has 500 pages. If you read 40 pages each day, how many days will it take to finish the book?
def solve() -> int: pages_in_book = 500 pages_read_per_day = 40 days_to_finish = pages_in_book / pages_read_per_day result = days_to_finish return result
Fred has four times the number of balloons that Tim has. Together they have 60 balloons. How many balloons does each of them have?
def solve() -> int: a = 60 b = a/4 c = b*4 result = c return result
If A can do a job in 15 days and B can do the same job in 10 days, how long will it take to complete the job if they work together?
def solve() -> int: A_days = 15 B_days = 10 time_taken = (A_days * B_days) / (A_days + B_days) result = time_taken return result
In 6 years, Harper will be three times as old as Lily. If Lily is currently 4 years old, how old is Harper?
def solve() -> int: lily_age = 4 harper_age = 0 harper_age_in_6_years = lily_age * 3 harper_age = harper_age_in_6_years - 6 result = harper_age return result
A bookstore gives a 10% discount on all books. If a book costs $20, what is the sale price after discount?
def solve() -> int: cost = 20 discount = cost * 0.10 sale_price = cost - discount result = sale_price return result
Emma had 20 candies. She ate 4 candies and then decided to share the rest equally with her 4 friends. How many candies did each person get?
def solve() -> int: emma = 20 ate = 4 friends = 4 left = emma - ate per_person = left / friends result = per_person return result
Here are some possible questions and programs: A rectangular garden has a length of 12 meters and a width of 8 meters. Joe wants to plant roses along the perimeter of the garden, leaving a gap of 1 meter at each corner. How many roses can he plant if each rose needs 0.5 meters of space?
def solve() -> int: perimeter = 2 * (12 + 8) gaps = 4 * 1 space = 0.5 roses = (perimeter - gaps) // space result = roses return result
The ratio of boys to girls in a class is 2:3. If there are 30 students in the class, how many boys are there?
def solve() -> int: total_students = 30 ratio_boys_girls = 2 / 3 num_boys = int(total_students * ratio_boys_girls * 2) result = num_boys return result
A restaurant has 12 tables, with 4 seats each. Only 20% of the tables are occupied at one time. How many customers can be seated at once?
def solve() -> int: tables = 12 seats_per_table = 4 occupancy_percentage = 20 occupied_tables = tables * occupancy_percentage / 100 customers_seated = occupied_tables * seats_per_table result = customers_seated return result
Possible questions and programs: Tony cultivates 3 plots of land every month for his vegetable business. Each plot has an area of 500 square meters and can produce 80 kilograms of vegetables. He sells the vegetables for $2 per kilogram and pays $100 for each plot as rent. How much profit does he make every month?
def solve() -> int: plots = 3 area = 500 production = 80 price = 2 rent = 100 income = plots * production * price cost = plots * rent profit = income - cost result = profit return result
Possible additional questions and programs are: Andy has 7 red pens and 5 blue pens. He wants to give away some of his pens to his friends so that he has the same number of red and blue pens left. How many pens will he give away in total?
def solve() -> int: from sympy import solve, Symbol x = Symbol('x') x = solve(7 - x - 5 + 7 - x)[0] result = x + 7 - x return result
A news article stated that a company's revenue is $720,000 for the fiscal year. If the average monthly revenue is the same every month, how much revenue does the company make per month?
def solve() -> int: annual_revenue = 720000 months = 12 monthly_revenue = annual_revenue/months result = monthly_revenue return result
If there are 128 pencils in a shop, and they want to evenly divide them between 8 kids, how many pencils will each kid get?
def solve() -> int: numberOfPencils = 0 numberOfPencils = 128 // 8 result = numberOfPencils return result
Sophie bought 4 boxes of 300g chocolates for a party, but she later found out that she already had 2 boxes at home. If 1 guest eats 50g of chocolate, and she invited 20 people to the party, how many grams of chocolate will be left after the party?
def solve() -> int: num_boxes_bought = 4 weight_per_box = 300 num_boxes_at_home = 2 num_guests = 20 chocolate_per_guest = 50 total_weight = (num_boxes_bought - num_boxes_at_home) * weight_per_box consumed_weight = num_guests * chocolate_per_guest remaining_weight = total_w...
On a wildlife safari, the ranger noted that the number of zebras was twice the number of giraffes. If there were 25 giraffes, calculate the total number of animals on the safari.
def solve() -> int: giraffes = 25 zebras = giraffes * 2 total_animals = giraffes + zebras result = total_animals return result
ome possible questions are: Ms. Lee surveyed her Grade 6 class about their favorite pizza toppings. She found out that 25% of them liked cheese only, 35% of them liked pepperoni, and the rest liked other toppings. How many students liked other toppings if there are 40 students in her class?
def solve() -> int: cheese_only = 0.25 * 40 pepperoni = 0.35 * 40 other_toppings = 40 - (cheese_only + pepperoni) result = other_toppings return result
Ben has a roll of paper that he wants to use for wrapping presents. The roll is 10 meters long and 50 cm wide. Each present is a rectangular box that has a length of 30 cm, a width of 20 cm, and a height of 15 cm. He wraps each box with a 5 cm overlap on each side. How many presents can he wrap with the roll of paper?
def solve() -> int: roll_area = 10 * 50 side_area = 30 * 20 top_area = 30 * 15 front_area = 20 * 15 box_area = (2 * side_area) + (2 * top_area) + (2 * front_area) perimeter = (2 * 30) + (2 * 20) overlap_area = 5 * perimeter paper_area = box_area - overlap_ar...
Student: Joseph bought 10 packs of popcorn for the movie theater he runs. Each pack costs $2.5. How much money did Joseph spend?
def solve() -> int: packs = 10 cost_per_pack = 2.5 total_cost = packs * cost_per_pack result = total_cost return result
David wants to collect rare coins. He spends a year researching before starting his 4-year-long search for his first coin. The second coin takes 4 times as long for research and discovery. How long did he spend finding both?
def solve() -> int: research_time_first_coin = 1 search_time_first_coin = 4 research_time_second_coin = 4 * research_time_first_coin search_time_second_coin = 4 * search_time_first_coin total_time = research_time_first_coin + search_time_first_coin + research_time_second_coin + search_time_seco...
Student: A box contains 1000 jelly beans. 35% of them are black and 20% of the non-black jelly beans are red. How many red jelly beans are there?
def solve() -> int: total_jelly_beans = 1000 percent_black = 0.35 percent_red = 0.20 black_jelly_beans = total_jelly_beans * percent_black non_black_jelly_beans = total_jelly_beans - black_jelly_beans red_jelly_beans = non_black_jelly_beans * percent_red result = red_jelly_beans return ...
A car travels at a speed of 60 km/h. How long will it take to travel 180 km?
def solve() -> int: distance = 180 speed = 60 time = distance/speed result = time return result
Adam went to the store and bought 4 towels worth $12 each, 7 pillows worth $10 each and 6 blankets worth $14 each. He was given a 15% discount. How much money did he save?
def solve() -> int: price_without_discount = (4 * 12) + (7 * 10) + (6 * 14) discount = price_without_discount * 0.15 result = discount return result
John has a collection of 68 CDs. He gave his friend 12 CDs. Then he bought 16 more CDs. How many CDs does John have now?
def solve() -> int: cd_collection = 68 gave_to_friend = 12 bought = 16 total_cds = cd_collection - gave_to_friend + bought result = total_cds return result
Student: Emma was walking for 15 minutes on Monday, 20 minutes on Tuesday, and the number of minutes she walked on Wednesday was 50% higher than the minutes she walked on Tuesday. How many minutes did Emma walk in total for Monday, Tuesday and Wednesday?
def solve() -> int: monday_minutes = 15 tuesday_minutes = 20 wednesday_minutes = tuesday_minutes * 1.5 total_minutes = monday_minutes + tuesday_minutes + wednesday_minutes result = total_minutes return result
-Possible Emma has 50 coins in her piggy bank. She has 20 pennies, 15 nickels, 10 dimes, and 5 quarters. How much money does she have in total? How many more quarters does she need to have $10?
def solve() -> int: pennies = 20 nickels = 15 dimes = 10 quarters = 5 value_penny = 0.01 value_nickel = 0.05 value_dime = 0.1 value_quarter = 0.25 goal = 10 value_total = pennies * value_penny + nickels * value_nickel + dimes * value_dime + quarters * value_quarter ...
If a car travels 60 miles in 2 hours, what is the average speed of the car in miles per hour?
def solve() -> int: distance = 60 time = 2 speed = distance / time result = speed return result
Alex is twice as old as Billy and 5 years older than Cindy. If Cindy is 20, what is the difference between the ages of Alex and Billy?
def solve() -> int: cindy = 20 alex = cindy + 5 billy = alex / 2 difference = alex - billy result = difference return result
A pizza has 14 slices and 5 people want to share it evenly. How many slices should each person get?
def solve() -> int: slices = 14 people = 5 per_person = slices/people result = per_person return result
Peter bought a pack of 50 stickers and a pack of 80 cards. He wants to make invitations for his birthday party by sticking one sticker on each card. He also wants to give some stickers to his friends as gifts. He has 12 friends and he wants to give each of them 2 stickers. How many stickers will he have left after maki...
def solve() -> int: total_stickers = 50 invitations = 80 stickers_for_invitations = invitations * 1 friends = 12 stickers_per_friend = 2 stickers_for_gifts = friends * stickers_per_friend stickers_left = total_stickers - stickers_for_invitations - stickers_for_gifts result = stickers_lef...
A plane travels 600 km in 3 hours. How far would it travel in 8 hours at the same speed?
def solve() -> int: distance = 600 * (8/3) result = distance return result
A group of roommates opened a shared savings account. John contributes $75 every week and Jane contributes $250 every month. After saving for 3 months, they want to use one-fifth of their savings to buy stocks. Each share of stocks costs $70. How many shares of stocks can they buy?
def solve() -> int: john_weekly = 75 jane_monthly = 250 num_weeks = 3 * 4 total_savings = (john_weekly * num_weeks) + (jane_monthly * 3) one_fifth = total_savings / 5 num_shares = one_fifth / 70 result = num_shares return result
A math test consists of 20 questions. It was found that 15 students attempted all the 20 questions, while 5 students could only attempt 15 questions. What was the average number of questions attempted by all the students who took the test?
def solve() -> int: total_questions = 20 students_attempted_all = 15 students_attempted_partial = 5 partial_questions_attempted = 15 average_questions_attempted = (students_attempted_all * total_questions + students_attempted_partial * partial_questions_attempted) / (students_attempted_all + stu...
A school cafeteria sells 2500 meals on 10 school days each month. The price per meal is $5 on 8 regular days and $7 on 2 special days each month. How much does the cafeteria make in a month?
def solve() -> int: num_of_meals = 2500 regular_price = 5 special_price = 7 num_of_regular_days = 8 num_of_special_days = 2 total_regular_meals = num_of_meals * num_of_regular_days / 10 total_special_meals = num_of_meals * num_of_special_days / 10 total_sale = total_regular_meals * regul...
Gracie picked 80 apples on Monday. On Tuesday, she picked 40% more apples than on Monday and on Wednesday, she picked 50% the number of apples she picked on Monday. How many apples did Gracie pick in three days?
def solve() -> int: monday_apples = 80 tuesday_apples = monday_apples + (monday_apples * 0.4) wednesday_apples = monday_apples * 0.5 total_apples = monday_apples + tuesday_apples + wednesday_apples result = total_apples return result
A clothing store sells a certain jacket for $80. They only have a few left in stock, so they decided to give a 25% discount on every two jackets bought by a customer at any one time. How much will a customer pay for 4 jackets?
def solve() -> int: jacket_price = 80 discount = 0.25 quantity = 4 discount_applied = quantity // 2 total_price_before_discount = jacket_price * quantity total_discount_amount = jacket_price * discount * discount_applied total_price_after_discount = total_price_before_dis...
A group of friends shared a meal that cost $80. If they each pay an equal amount and leave a 20% tip, what is the total amount that they pay?
def solve() -> int: num_people = 4 total_cost = 80 * 1.2 cost_per_person = total_cost / num_people result = cost_per_person return result
The Titanic movie cost 50 million to make and earned 1 billion at the box office. If its profit was double what Jaws made and Jaws cost 15 million to make, what was the profit of Jaws?
def solve() -> int: titanic_cost = 50_000_000 titanic_earnings = 1_000_000_000 jaws_cost = 15_000_000 titanic_profit = titanic_earnings - titanic_cost jaws_profit = titanic_profit / 2 jaws_profit = jaws_profit - jaws_cost result = jaws_profit return result
Student: Jack has a total of 15kg of apples and oranges combined. If he has 6kg of apples, how many kilograms of oranges does he have?
def solve() -> int: total_weight = 15 apple_weight = 6 orange_weight = total_weight - apple_weight result = orange_weight return result
A park has 60 ducks and 40 geese. If 20 ducks flew away, how many birds are left in the park?
def solve() -> int: ducks = 60 geese = 40 ducks -= 20 total_birds = ducks + geese result = total_birds return result
Lisa bought three books for 12 dollars each and paid with a 50 dollar bill. She also received a 10% discount on her purchase. How much change did she get?
def solve() -> int: total_cost = 3 * 12 discount = total_cost * 0.1 final_cost = total_cost - discount change = 50 - final_cost result = change return result
A square has a perimeter of 32 cm. Find the length of one side.
def solve() -> int: perimeter = 32 side_length = perimeter/4 result = side_length return result
A store has a sale where all items are 30% off the sale price. If the original price of an item is $50 and it is on sale for 20% off the original price, what is the final sale price?
def solve() -> int: original_price = 50 sale_percent = 0.2 discounted_price = original_price * (1 - sale_percent) final_discount_percent = 0.3 final_sale_price = discounted_price * (1 - final_discount_percent) result = final_sale_price return result
A cylindrical tank has a diameter of 10 feet and a height of 20 feet. What is the volume of the tank?
def solve() -> int: diameter = 10.0 radius = diameter / 2.0 height = 20.0 pi = 3.14159265359 volume = pi * radius ** 2 * height result = volume return result
If a shirt costs $25 and the tax is 8%, what is the final price including tax that Mark has to pay?
def solve() -> int: shirt_cost = 25 tax_rate = 0.08 tax_amount = shirt_cost * tax_rate final_price = shirt_cost + tax_amount result = final_price return result
Tom is planning a party for his friends. He needs to buy snacks, drinks, and decorations. The snacks cost $30, drinks cost $50, and decorations cost $20. If he invites 10 people, how much will each person contribute towards the party expenses?
def solve() -> int: snacks_cost = 30 drinks_cost = 50 decorations_cost = 20 number_of_people = 10 total_cost = snacks_cost + drinks_cost + decorations_cost cost_per_person = total_cost / number_of_people result = cost_per_person return result
Student: A car traveled 240 miles in 4 hours. What was its average speed in miles per hour?
def solve() -> int: distance = 240 time = 4 average_speed = distance / time result = average_speed return result
A bookshelf has 5 shelves, each with a capacity of 20 books. How many books can the bookshelf hold in total?
def solve() -> int: shelves = 5 capacity = 20 total_books = shelves * capacity result = total_books return result
Alex has two cars - one that runs on gas and one that runs on electricity. For every five miles he drives the gas car, he drives the electric car for seven miles. If he drives the electric car for 35 miles, how many miles has he driven both cars combined?
def solve() -> int: gas_car_miles = 5 electric_car_miles = 7 electric_car_total_miles = 35 gas_car_total_miles = (electric_car_total_miles / electric_car_miles) * gas_car_miles total_miles = gas_car_total_miles + electric_car_total_miles result = total_miles return result
Student: Carol bakes a cake for 40 minutes, cools it for 10 minutes less than baking, and decorates it for three times as long as cooling. How much time does she spend on her cake in total?
def solve() -> int: baking_time = 40 cooling_time = baking_time - 10 decorating_time = 3 * cooling_time total_time = baking_time + cooling_time + decorating_time result = total_time return result
Student: Patricia needs to split 4 times as many apples as oranges into 8 equal size boxes. If she has 32 oranges, how many apples should she put in each box?
def solve() -> int: oranges = 32 apples = oranges * 4 apples = oranges * 4 apples_per_box = apples / 8 result = apples_per_box return result
Sophie wants to make bracelets to sell at a crafts fair. She has small beads and large beads. Most of the beads are small and the remaining 30 beads are large. It takes 5 small beads and 1 large bead to make each bracelet. If Sophie needs 150 beads to make all of her bracelets, how many large beads did she use?
def solve() -> int: small_beads = 150 - 30 * 5 large_beads = 30 result = large_beads return result
Alex saves 25% of his $800 weekly salary. How much money does he save in 4 weeks?
def solve() -> int: salary = 800 percentage = 0.25 savings = salary*percentage total_savings = savings*4 result = total_savings return result
Jack wants to paint his bedroom wall. The wall is 11m long and 5m high. A liter of paint can cover 10 square meters. How many liters of paint should he buy in total (rounded up to the nearest liter)?
def solve() -> int: wall_length = 11 wall_height = 5 wall_area = wall_length * wall_height coverage = 10 required_paint = wall_area / coverage required_paint_rounded = round(required_paint + 0.5) result = required_paint_rounded return result
A shop sells two types of pens, fountain pens for $20 each and ballpoint pens for $5 each. If the shop sold five fountain pens and fifteen ballpoint pens, what was the total revenue?
def solve() -> int: fountain_pen_price = 20 ballpoint_pen_price = 5 fountain_pen_sold = 5 ballpoint_pen_sold = 15 total_revenue = (fountain_pen_price * fountain_pen_sold) + (ballpoint_pen_price * ballpoint_pen_sold) result = total_revenue return result
Michael works 6 hours on Monday and 9 hours on Tuesday on his lawn care job. He still has to work 21 hours in the week. How much money does Michael make if he is paid $20 per hour?
def solve() -> int: hours_worked = 6 + 9 + 21 money_made = hours_worked * 20 result = money_made return result
Eric has a delivery service with 15 drivers. Each driver delivers 10 packages a day, and each package weighs 5 pounds. Eric has a truck that can carry 2000 pounds. How many trips will Eric's truck need to make in a week?
def solve() -> int: drivers = 15 packages_per_day = 10 weight_per_package = 5 truck_capacity = 2000 days_per_week = 7 total_packages_per_week = drivers * packages_per_day * days_per_week total_weight_per_week = total_packages_per_week * weight_per_package trips_needed = total_w...
h wanted to buy a new camera online. The price was listed at $700 and the store had a special offer with 12% off and free shipping. How much did Seth save with the store discount?
def solve() -> int: price = 700 discount = 0.12 shipping = 0 savings = price * discount total_saved = price - savings + shipping result = total_saved return result
Noah went to a toy store to buy trucks for his cousins. He spent $35 in total and bought 7 trucks in total. If each truck costs the same amount, how much did each truck cost?
def solve() -> int: total_spent = 35 total_trucks = 7 cost_per_truck = total_spent / total_trucks result = cost_per_truck return result
A rectangle has a length of 15 cm and a width of 8 cm. What is the area of the rectangle?
def solve() -> int: length = 15 width = 8 area = length * width result = area return result
A pet store has 50 rabbits. The owner gets a call that 30 rabbits from another store need to be added to their inventory. After a week, 10 rabbits are sold, and 15 more are sold after a month. How many rabbits are left in the inventory after the last sale?
def solve() -> int: rabbits_initial = 50 rabbits_added = 30 rabbits_sold_week1 = 10 rabbits_sold_month1 = 15 rabbits_total = rabbits_initial + rabbits_added rabbits_total -= rabbits_sold_week1 rabbits_total -= rabbits_sold_month1 result = rabbits_total return result
-Each question should be completely different. If you need to write down any variables, write them down after the question. Some possible questions are: Kim baked a cake for her friend's birthday and cut it into 12 equal pieces. She gave three pieces to her friend and four pieces to her family. If each piece of cake ha...
def solve() -> int: pieces_left = 12 - (3 + 4) calories_per_piece = 250 calories_kim = pieces_left * calories_per_piece result = calories_kim return result
A recipe for lemonade requires 6 lemons, 1 cup of sugar, and 8 cups of water to make 12 servings. Nina wants to make 18 servings of lemonade for her friends, but she only has 10 lemons and 2 cups of sugar. How much water, in cups, does she need to use to make the lemonade with the ingredients she has?
def solve() -> int: lemons_per_serving = 6 / 12 sugar_per_serving = 1 / 12 water_per_serving = 8 / 12 servings_needed = 18 lemons_available = 10 sugar_available = 2 servings_with_lemons = lemons_available / lemons_per_serving servings_with_sugar = sugar_available / sugar_per_serving ...
Yesterday, Hannah ran for 45 minutes and covered a distance of 6 kilometers. If she ran at a constant speed, what was her speed in kilometers per hour?
def solve() -> int: time_in_minutes = 45 distance_in_kilometers = 6 time_in_hours = time_in_minutes / 60 speed_in_kph = distance_in_kilometers / time_in_hours result = speed_in_kph return result
A business owner is currently three times as old as his youngest employee. If the youngest employee is 20 years old, how old is the business owner?
def solve() -> int: employee_age = 20 business_owner_age = employee_age * 3 result = business_owner_age return result
Leila and her classmates are planting trees for a school project. There are 20 students in the class. On the first day, they planted 4 trees each in the school yard. On the second day, they planted 5 more trees each in a nearby park. On the third day, they planted 6 more trees each in another park, but 4 of the trees d...
def solve() -> int: students = 20 trees_1 = 4 trees_2 = 5 trees_3 = 6 dead_trees = 4 total_1 = students * trees_1 total_2 = students * trees_2 total_3 = students * trees_3 total = total_1 + total_2 + total_3 - dead_trees result = total return result
Student: There are four dragons in the Fiery Mountain. Each dragon can breathe fire that melts one ton of ice in one minute. The four dragons are going to melt a giant ice castle that weighs 96 tons. If they work together and breathe fire at the same rate, how long does it take them to melt the ice castle completely?
def solve() -> int: num_dragons = 4 tons_melted_per_minute = 1 total_tons = 96 total_minutes = total_tons / (num_dragons * tons_melted_per_minute) result = total_minutes return result
*** Some possible questions and programs are: Omar bought 16 apples from the market and gave half of them to his sister. He then ate two apples and gave one more to his friend. How many apples did Omar have left?
def solve() -> int: apples_sister = 16 // 2 apples_left = 16 - apples_sister - 2 - 1 result = apples_left return result
Mia bought 5 candies for $0.50 each and 2 chocolates for $1.25 each. She also bought a balloon for $0.75. She paid the cashier with a $10 bill. How much change did she receive?
def solve() -> int: total_cost = 5 * 0.50 + 2 * 1.25 + 0.75 change = 10 - total_cost result = change return result
Olivia bought 15 packs of pencils, each having 12 pencils. She plans to distribute them equally among her 10 classmates. How many pencils will each classmate receive and how many will be left?
def solve() -> int: packs = 15 pencils_per_pack = 12 total_pencils = packs * pencils_per_pack classmates = 10 pencils_per_classmate = total_pencils // classmates pencils_left = total_pencils % classmates result = f'Each classmate will receive {pencils_per_classm...
Bob wants to buy a new laptop that costs $1200. He has a coupon that can be used either as a 10% discount or as a $100 discount. Which coupon would save him more money?
def solve() -> int: original_price = 1200 discount1 = 0.1 discount2 = 100 savings1 = original_price * discount1 savings2 = min(original_price, discount2) if savings1 > savings2: result = discount1 * original_price else: result = discount2 return result
Cindy had 3 jars of marbles. The first jar had 12 marbles, the second jar had 8 marbles, and the third jar had 15 marbles. She gave 6 marbles to her friend Emily, and then she received 4 marbles from her friend Frank. How many marbles did Cindy have in total after these exchanges?
def solve() -> int: jar1 = 12 jar2 = 8 jar3 = 15 cindy = jar1 + jar2 + jar3 emily = 6 frank = 4 cindy = cindy - emily + frank result = cindy return result
Student: Eli and Linda rented a car for a weekend getaway. The base cost of renting the car was $200. They also paid $30 for extra insurance and $2 for insurance fees. How much did they pay in total?
def solve() -> int: base_cost = 200 extra_insurance = 30 insurance_fees = 2 total_cost = base_cost + extra_insurance + insurance_fees result = total_cost return result
Find the average of the following set of numbers 23, 45, 56, 78, 90 and 100.
def solve() -> int: numbers = [23, 45, 56, 78, 90, 100] average = sum(numbers)/len(numbers) result = average return result
Lisa and Mark each bought a watch for $50 each, two t-shirts for $10 each and three pairs of socks for $5 each. What is the total cost?
def solve() -> int: watch_cost = 2*50 tshirt_cost = 2*10 socks_cost = 3*5 total_cost = watch_cost + tshirt_cost + socks_cost result = total_cost return result
Susan has $150 to spend and is considering a jacket that costs $75 and a pair of shoes that cost $55. How much money will she have left if she buys both items?
def solve() -> int: total_cost = 75 + 55 money_left = 150 - total_cost result = money_left return result
Sara has been saving up for a new bike. She saved $200 every month for 10 months. If the bike costs $1800, how much money does she have left after buying the bike?
def solve() -> int: savings = 200 months = 10 bike_cost = 1800 total_savings = savings * months money_left = total_savings - bike_cost result = money_left return result
Grace has four times as many stickers as Harry, and Harry has six fewer stickers than Ivy. How many stickers do Grace, Harry, and Ivy have combined if Ivy has 18 stickers?
def solve() -> int: harry_stickers = 18 - 6 grace_stickers = 4 * harry_stickers total_stickers = grace_stickers + harry_stickers + 18 result = total_stickers return result
A water tank can hold 500 liters of water. It is filled at a rate of 20 liters per minute by a tap, and emptied at a rate of 15 liters per minute by a drain. How long does it take to fill the tank completely, in minutes?
def solve() -> int: capacity = 500 fill_rate = 20 drain_rate = 15 net_rate = fill_rate - drain_rate time = capacity / net_rate result = time return result
100 people are waiting for a bus. 40% of them are men. If the number of men and women waiting for the bus is equal, how many women are waiting for the bus?
def solve() -> int: total_people = 100 men_percentage = 40 women_percentage = 100 - men_percentage men_count = (men_percentage / 100) * total_people women_count = men_count result = women_count return result
Maya paints landscapes and portraits. A landscape painting takes 3 hours to finish and sells for $200. A portrait painting takes 4 hours to finish and sells for $300. If Maya has 24 hours to paint, how much more money will she make by painting only portraits instead of only landscapes?
def solve() -> int: landscape_paintings = 24 // 3 portrait_paintings = 24 // 4 landscape_money = landscape_paintings * 200 portrait_money = portrait_paintings * 300 result = portrait_money - landscape_money return result
Amy bought a pack of 24 pencils for $2.40 and a pack of 12 pens for $3.60. She then sold each pencil for $0.15 and each pen for $0.40. How much profit did Amy make from selling all the pencils and pens?
def solve() -> int: cost = 2.40 + 3.60 revenue = 24 * 0.15 + 12 * 0.40 profit = revenue - cost result = profit return result
A rectangle has a length of 5 and a width of 3. If the length is doubled and the width is halved, what is the area of the new rectangle?
def solve() -> int: new_length = 5 * 2 new_width = 3 / 2 new_area = new_length * new_width result = new_area return result
The average salary of 8 employees is $8000. If the salary of one employee is recorded wrongly as $9000 instead of $6000, what is the new average salary?
def solve() -> int: employees = 8 old_average = 8000 wrong_salary = 9000 correct_salary = 6000 new_average = ((employees*old_average)-wrong_salary+correct_salary)/employees result = new_average return result
Student: Apples cost $3 per kg at the store. If Zoe bought 5 kg apples, how much did she spend?
def solve() -> int: apple_price = 3 apple_weight = 5 apple_cost = apple_price * apple_weight result = apple_cost return result
Here are some possible new questions and programs: A baker makes 24 loaves of bread every day. He sells each loaf for $3 and spends $40 on ingredients and utilities. If his profit margin increases by 10% every day, what is his total profit after a week?
def solve() -> int: loaves = 24 price = 3 cost = 40 margin = 0.1 profit = 0 for day in range(1, 8): revenue = loaves * price profit += revenue - cost price += price * margin cost += cost * margin result = profit return result
Mrs. Smith has a garden with 600 plants. 80% of them are flowers and the rest are vegetables. If 10% of her vegetables are ripe, how many ripe vegetables does she have?
def solve() -> int: plants = 600 flowers = plants * 0.8 vegetables = plants - flowers ripe_vegetables = vegetables * 0.1 result = ripe_vegetables return result
Emma got 14 presents for her birthday. 1/3 of them were in small boxes, 1/4 were in medium boxes, and the rest were in large boxes. How many presents did Emma get in large boxes?
def solve() -> int: presents = 14 small_boxes = presents * (1/3) medium_boxes = presents * (1/4) large_boxes = presents - small_boxes - medium_boxes result = large_boxes return result
Anna likes to read books and keeps track of how many pages she reads each day. She read 32 pages on Monday, 48 pages on Tuesday, and 64 pages on Wednesday. She noticed that the number of pages she read each day was 16 more than the previous day. If this pattern continues, how many pages will she read on Friday?
def solve() -> int: monday = 32 tuesday = 48 wednesday = 64 difference = tuesday - monday thursday = wednesday + difference friday = thursday + difference result = friday return result
Student: The sum of two numbers is 25, and the difference between them is 7, what is the first number?
def solve() -> int: sum = 25 difference = 7 first_number = (sum + difference) / 2 result = first_number return result
Emily works as a personal trainer and also sells fitness equipment on her website. She charges $80/session for personal training and earns $25 profit for each equipment sale. If Emily trains clients for 15 sessions and sells 12 pieces of equipment, how much money does she make?
def solve() -> int: session_price = 80 equipment_profit = 25 num_sessions = 15 num_equipment = 12 session_earnings = session_price * num_sessions equipment_earnings = equipment_profit * num_equipment total_earnings = session_earnings + equipment_earnings result = total_earnings...
Student: Michael has a poultry farm. Each chicken lays 6 eggs per day, and he has 800 chickens. Half of the eggs are full-size eggs with 60 calories each, and the other half are extra-large eggs with 85 calories each. How many calories are in the eggs that Michael's chickens lay in total?
def solve() -> int: chickens = 800 eggs_per_day = 6 full_size_calories = 60 extra_large_calories = 85 total_eggs_per_day = chickens * eggs_per_day total_full_size_calories = total_eggs_per_day * full_size_calories / 2 total_extra_large_calories = total_eggs_per_day * extra_large_calories / 2...
Student: At a party, there were 30 people and twice as many dogs. Each person had 1 drink, and each dog had half a drink. How many drinks were consumed in total?
def solve() -> int: people = 30 dogs = people * 2 drinks_per_person = 1 drinks_per_dog = 0.5 total_drinks = people * drinks_per_person + dogs * drinks_per_dog result = total_drinks return result
A recipe calls for 1/2 a cup of butter, but Susan only has 1/4 cup of butter. How much more butter does Susan need?
def solve() -> int: needed_butter = 1/2 current_butter = 1/4 additional_butter = needed_butter - current_butter result = additional_butter return result
If a boat can travel at a speed of 25 knots while a ferry can travel at a speed of 50 knots and they need to cross a river that is 500 nautical miles wide, how many hours ahead will the ferry arrive at the destination compared to the boat?
def solve() -> int: boat_speed = 25 ferry_speed = 50 distance = 500 boat_time = distance / boat_speed ferry_time = distance / ferry_speed time_difference = ferry_time - boat_time result = time_difference return result
A classroom of 25 students needs 50 notebooks. If notebooks come in packs of 5 and cost $2 per pack, how much money will the class need to spend on notebooks?
def solve() -> int: students = 25 notebooks_needed = 50 notebooks_per_pack = 5 cost_per_pack = 2 packs_needed = notebooks_needed / notebooks_per_pack total_cost = packs_needed * cost_per_pack result = total_cost return result
In 10 years, Alice will be three times as old as her sister, Olivia. If Olivia is currently 5 years old, how old is Alice?
def solve() -> int: olivia_age = 5 alice_age = olivia_age + 10 result = alice_age return result
Cory is planting a tree that will grow 6 feet per year. If the tree is currently 17 feet tall, how many years would it need to reach 33 feet tall?
def solve() -> int: height = 17 increment = 6 final_height = 33 years = (final_height - height) / increment result = years return result
A pizza shop is offering a deal of $5 off on any pizza. If the original price of a pizza is $19.99, what is the final price after discount?
def solve() -> int: original_price = 19.99 discount = 5 final_price = original_price - discount result = final_price return result
A student answered 35 out of 40 questions correctly on a test. What percentage of the questions did the student answer correctly?
def solve() -> int: total_questions = 40 correct_answers = 35 percent_correct = (correct_answers / total_questions) * 100 result = percent_correct return result