question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Liam's brother is 20 years old. Liam's sister is half the age of his brother. Liam is five times as old as his sister. What is the total age of Liam's family?
def solve() -> int: brother_age = 20 sister_age = brother_age / 2 liam_age = 5 * sister_age total_age = brother_age + sister_age + liam_age result = total_age return result
A store has 300 books. If they sell 1/4 of the books and then restock with 150 additional books, how many books does the store have now?
def solve() -> int: store_books = 300 books_sold = store_books / 4 remaining_books = store_books - books_sold restocked_books = remaining_books + 150 result = restocked_books return result
Among the career assists leaders for NBA, John Stockton has 323 more than twice the number that Jason Kidd has. John Stockton had 15806 assists. How many assists did Jason Kidd have in his career?
def solve() -> int: stockton = 15806 kidd = 0 kidd = (stockton - 323) / 2 result = kidd return result
A square piece of cardboard measures 12 inches on each side. If four 2-inch squares are cut out of the corners, what is the area of the remaining cardboard?
def solve() -> int: cardboard_side = 12 cut_out = 2 new_side = cardboard_side - (cut_out * 2) cardboard_area = cardboard_side ** 2 new_area = new_side ** 2 remaining_area = cardboard_area - new_area result = remaining_area return result
A store sells 400 jackets per month. Every month, they decrease their inventory by 10% and order 60 new jackets. How many jackets will be left after 8 months?
def solve() -> int: num_jackets = 400 for i in range(8): num_jackets = round(num_jackets * 0.9) + 60 result = num_jackets return result
A farmer had 18 baskets of strawberries. He sold 13 baskets at the market before noon. If the farmer harvested 4 more baskets, how many baskets of strawberries does he have to sell in the afternoon?
def solve() -> int: baskets_total = 18 baskets_sold = 13 baskets_harvested = 4 baskets_remaining = baskets_total - baskets_sold + baskets_harvested result = baskets_remaining return result
A rectangular prism has a length of 10 cm, a width of 8 cm, and a height of 6 cm. What is its volume?
def solve() -> int: length = 10 width = 8 height = 6 volume = length * width * height result = volume return result
Sophia has 40 pink notebooks and 20 purple notebooks. She gives her friend Sarah 1/3 of her pink notebooks and 2/5 of her purple notebooks. If Sarah had 14 pink notebooks and 8 purple notebooks, what is the total number of notebooks she has?
def solve() -> int: pink_notebooks = 40 purple_notebooks = 20 pink_notebooks_given = pink_notebooks * (1/3) purple_notebooks_given = purple_notebooks * (2/5) pink_notebooks_remaining = pink_notebooks - pink_notebooks_given purple_notebooks_remaining = purple_notebooks - purple_notebook...
Possible questions are: Kayla, Leo and Mia are collecting seashells on the beach. Kayla finds 3 more seashells than Leo, who finds 4 times the number of seashells Mia finds. If Mia finds 5 seashells, how many seashells do they have in total?
def solve() -> int: mia = 5 leo = 4 * mia kayla = leo + 3 total = mia + leo + kayla result = total return result
The temperature outside is currently -5°C. If it drops 7°C by nightfall, what will the temperature be then?
def solve() -> int: temp_night = -5 - 7 result = temp_night return result
Maya and Jake were collecting coins in a jar. Maya put in 15 quarters and 20 dimes, and Jake put in 10 quarters and 25 nickels. How much money did they have in the jar in total?
def solve() -> int: quarters_value = (15 + 10) * 25 dimes_value = 20 * 10 nickels_value = 25 * 5 jar_value = quarters_value + dimes_value + nickels_value jar_dollars = jar_value / 100 result = jar_dollars return result
Mike and Rick split a sum of money in the ratio 3:8. If Mike got $32 (which is the smaller share), how much did they share?
def solve() -> int: total_share = 3+8 rick_share = 8/total_share total_amount = 32/rick_share result = total_amount return result
A farmer has 420 ducks and 630 chickens. If the farmer sells 1/4 of the ducks and 1/3 of the chickens, how many birds does the farmer have left?
def solve() -> int: ducks_left = 420 - (420/4) chickens_left = 630 - (630/3) total_birds = ducks_left + chickens_left result = total_birds return result
Student: A school cafeteria worker takes 30 extra minutes to serve lunch to all of the students one day. If the regular lunch time is 45 minutes, how much longer is the lunch time?
def solve() -> int: regular_lunch_time = 45 extra_time = 30 total_lunch_time = regular_lunch_time + extra_time difference = total_lunch_time - regular_lunch_time result = difference return result
Cory works at a pet store for 9 hours a day and 5 days a week, earning $6 hourly. If he doesn't work one day, how much does he earn in a week?
def solve() -> int: hours_per_day = 9 days_per_week = 5 hourly_rate = 6 total_hours_worked = hours_per_day * days_per_week total_earnings = total_hours_worked * hourly_rate result = total_earnings return result
Quinn has five more than one-fifth as many cards as Ryan has. If Ryan has 15 cards of each of the four suits (hearts, diamonds, clubs, and spades), how many cards does Quinn have?
def solve() -> int: ryan_cards = 15 * 4 quinn_cards = (ryan_cards / 5) + 5 result = quinn_cards return result
The area of a rectangle is 25 cm². If one side of the rectangle is 5 cm, calculate the perimeter of the rectangle.
def solve() -> int: side_length = 5 rectangle_area = 25 rectangle_perimeter = (2 * side_length) + (2 * (rectangle_area/side_length)) result = rectangle_perimeter return result
If there are 500 students in a school and one-fifth of them are sick, how many students are not sick?
def solve() -> int: sick_students = 500/5 healthy_students = 500 - sick_students result = healthy_students return result
Mr. and Mrs. Patel own a bakery and each day they bake a batch of 60 muffins. They split the muffins equally between themselves and their two children, but their son always takes out all the blueberry muffins and eats them himself. If their son eats 8 blueberry muffins in a day, how many blueberry muffins were in the b...
def solve() -> int: batch_size = 60 num_people = 4 num_blueberry_eaten = 8 num_muffins_per_person = batch_size / num_people num_blueberry = num_blueberry_eaten / (1/num_people - 1/3) result = num_blueberry return result
Student: A school has 500 students. 10% of them are absent on Monday and another 5% are absent on Tuesday. How many students were absent for these two days?
def solve() -> int: absent_monday = 500 * 0.1 absent_tuesday = 500 * 0.05 result = absent_monday + absent_tuesday return result
A basket contains apples, bananas, and oranges in the ratio of 4:3:5 respectively. If there are 48 oranges, how many fruits are there in total?
def solve() -> int: total_fruits = (4+3+5)*(48/5) result = total_fruits return result
In a school of 500 students, 40% are in the science club and the rest are not. Out of the students in the science club, 60% are in 11th grade. If there are 120 students in 11th grade, how many students are in the science club in total?
def solve() -> int: total_students = 500 num_science_club = total_students * 0.4 num_11th_grade_science_club = num_science_club * 0.6 num_11th_graders = 120 num_science_club_total = num_11th_graders / 0.6 result = num_science_club_total return result
A square has a side length of 6 cm. Find the perimeter and area of the square.
def solve() -> int: side_length = 6 perimeter = 4 * side_length area = side_length**2 result = (perimeter, area) return result
Student: Bob is planning a road trip and needs to calculate the total distance of the trip. He will drive a distance of 60 miles at 30 miles per hour and another distance of 80 miles at 40 miles per hour. What is the total distance of his trip?
def solve() -> int: distance1 = 60 speed1 = 30 distance2 = 80 speed2 = 40 time1 = distance1 / speed1 time2 = distance2 / speed2 total_time = time1 + time2 total_distance = distance1 + distance2 result = total_distance return result
Walkers Limited earned $10,000 in the first quarter and twice as much in the last quarter. How much did they earn in total in the two quarters?
def solve() -> int: first_quarter_earnings = 10000 last_quarter_earnings = 2 * first_quarter_earnings total_earnings = first_quarter_earnings + last_quarter_earnings result = total_earnings return result
Tom caught 25 fish on his fishing trip. He kept a third of them for himself and sold the rest at the market. Later, he caught three more fish. How many fish does Tom have now?
def solve() -> int: fish_caught = 25 kept_fish = fish_caught / 3 sold_fish = fish_caught - kept_fish additional_fish = 3 total_fish = kept_fish + additional_fish result = total_fish return result
A bookstore sells novels for $12 and magazines for $3. A man buys two novels and five magazines. If there were 15 customers after him, and each one bought two magazines, how much revenue did the bookstore generate during the day?
def solve() -> int: novel_price = 12 magazine_price = 3 novels_bought = 2 magazines_bought = 5 total_revenue = (novel_price * novels_bought) + (magazine_price * magazines_bought) customers_after = 15 magazines_bought_per_customer = 2 additional_revenue = customers_aft...
Eric has $20. He earns $5 for doing chores, $10 for babysitting, and $2 for selling lemonade. His sister Ella has $25 and spends $8 on a movie ticket, $6 on popcorn, and $4 on a soda. How much more money does Eric have left than Ella?
def solve() -> int: Eric = 20 Ella = 25 Eric = Eric + 5 + 10 + 2 Ella = Ella - 8 - 6 - 4 difference = Eric - Ella result = difference return result
Student: A park has 3 times as many ducks as geese, and 7 more geese than swans. If the park has 60 ducks, geese, and swans combined, how many swans does it have?
def solve() -> int: ducks = 0 geese = 0 swans = 0 ducks = 60 / 6 geese = ducks / 3 swans = geese - 7 result = swans return result
-Do not describe any real restaurant. Possible questions and programs: Happy Bakery makes delicious bread and pastries. They sell 300 loaves of bread per month for $3 each and 600 pastries per month for $1.5 each. How much money, in dollars, will the bakery earn from bread and pastries sales per month?
def solve() -> int: bread_loaves = 300 bread_price = 3 pastries = 600 pastry_price = 1.5 bread_sales = bread_loaves * bread_price pastry_sales = pastries * pastry_price total_sales = bread_sales + pastry_sales result = total_sales return result
In a classroom of 24 students, 12 students were given red pencils and 8 students were given blue pencils. How many pencils were given out in total?
def solve() -> int: total_pencils = 12 + 8 result = total_pencils return result
Student: There are 18 boys and 14 girls in Ms. Johnson's class. If there are 32 students in the class, how many more girls than boys are there?
def solve() -> int: boys = 18 girls = 14 total_students = 32 difference = girls - boys result = difference return result
A person ran 8 km in 40 minutes. If she continued at the same speed, how far would she run in 2 hours?
def solve() -> int: distance_hr = 8 / (40/60) total_distance = distance_hr * 2 result = total_distance return result
Student: A toy store had 40 cars, 35 dolls and 25 puzzles. It sold 80% of its cars, 70% of its dolls and 50% of its puzzles. How many toys did it sell?
def solve() -> int: cars = 40 dolls = 35 puzzles = 25 cars_sold = cars * 0.8 dolls_sold = dolls * 0.7 puzzles_sold = puzzles * 0.5 toys_sold = cars_sold + dolls_sold + puzzles_sold result = toys_sold return result
On Thursday, there were 30 participants in a race. The number of people who participated in the race on Friday was 25% less than Thursday. How many people participated in the race over the two days?
def solve() -> int: num_thursday = 30 num_friday = num_thursday*0.75 total_participants = num_thursday + num_friday result = total_participants return result
Possible questions and programs: Marcus and Emma were playing a game where Marcus scored 45 points and Emma scored 32 points. If the game had a total of 100 points available, how many points did Marcus and Emma miss out on?
def solve() -> int: total_scored = 45 + 32 total_missed = 100 - total_scored result = total_missed return result
ia is three times as old as her brother, Miguel. If Miguel is currently 7 years old, how old is Sia?
def solve() -> int: Miguel_age = 7 Sia_age = Miguel_age * 3 result = Sia_age return result
A fence is to be built around a rectangular garden. If each fence panel is 6 feet long and there must be at least 1 foot between each panel or the garden edge, how many panels are needed for a garden that is 24 feet long and 18 feet wide?
def solve() -> int: perimeter = 2 * (24 + 18) space = perimeter - 8 panels = (space // 7) + 1 result = panels return result
Student: Charles built a 17 story building. The first 8 stories are each 4 feet tall each. The remaining floors are each 7 feet taller. How tall is the building?
def solve() -> int: total_stories = 17 first_stories = 8 first_height = 4 extra_height = 7 remaining_stories = total_stories - first_stories remaining_height = remaining_stories * (first_height + extra_height) total_height = first_stories * first_height + remaining_height result = to...
John scored 84, 78, and 92 in his last 3 tests. What is his average score?
def solve() -> int: test1_score = 84 test2_score = 78 test3_score = 92 average_score = (test1_score + test2_score + test3_score) / 3 result = average_score return result
arah was given 81 peanuts to share with her 11 neighbors. How much peanuts will each neighbor get?
def solve() -> int: peanuts = 81 neighbors = 11 peanuts_per_neighbor = peanuts / neighbors result = peanuts_per_neighbor return result
Kevin rented a car for a week and paid $200 for the rental fee and $0.2 per mile for the mileage. He drove 250 miles during the week and returned the car with a full tank of gas. The gas cost him $2.5 per gallon and the car had a fuel efficiency of 25 miles per gallon. How much did Kevin spend in total for the car rent...
def solve() -> int: mileage_fee = 250 * 0.2 gas_cost = (250 / 25) * 2.5 total_cost = 200 + mileage_fee + gas_cost result = total_cost return result
At a certain pet store, of the pets available for purchase 8/15 were cats, 5/15 were dogs, and 2/15 were lizards. If there were 45 pets in total, how many lizards were available?
def solve() -> int: total_pets = 45 cats_rate = 8/15 dogs_rate = 5/15 lizard_rate = 2/15 lizards = total_pets * lizard_rate result = lizards return result
Ryan went to the movies and bought two tickets, each ticket costed $10.00. He also had to pay 8% sales tax. How much money did he spend in total?
def solve() -> int: cost_before_tax = 10 * 2 tax = 0.08 * cost_before_tax cost_after_tax = cost_before_tax + tax result = cost_after_tax return result
A pack of pencils that normally costs $1.2 is now sold at $0.9. A pack of erasers that was sold at a discount of $0.15. How much will you spend if you buy 8 packs of pencils and 10 packs of erasers?
def solve() -> int: original_eraser_cost = 0.15 * 10 discounted_pencil_cost = 0.9 * 8 discounted_eraser_cost = (0.15 - 0.15) * 10 discounted_total_cost = discounted_pencil_cost + discounted_eraser_cost result = discounted_total_cost return result
Jack has a quarter of the number of marbles that Kelly has. Kelly has 8 more marbles than Liam. If Liam has 24 marbles, how many marbles do they have in total?
def solve() -> int: kelly_marbles = 24 + 8 jack_marbles = kelly_marbles / 4 total_marbles = jack_marbles + kelly_marbles + 24 result = total_marbles return result
Student: Leo is 16 years old now. His cousin Maya is 8 years older than Leo. In 6 years how old will Maya be?
def solve() -> int: leo_age = 16 maya_age = leo_age + 8 maya_age_in_6_years = maya_age + 6 result = maya_age_in_6_years return result
A coat was on sale for 20% off its original price of $400. Later, the store decided to give an additional discount of 10%. What was the final price of the coat?
def solve() -> int: original_price = 400 discount_percentage_1 = 0.2 discount_percentage_2 = 0.1 discounted_price_1 = original_price - (original_price * discount_percentage_1) discounted_price_2 = discounted_price_1 - (discounted_price_1 * discount_percentage_2) result = int(discounted_price_2) ...
Student: A school has 60 students. If 1/6 of them are absent on Monday, 1/4 are absent on Tuesday, and 1/3 of the remaining students are absent on Wednesday, how many students are present on Wednesday?
def solve() -> int: students = 60 absent_monday = students / 6 absent_tuesday = students / 4 remaining_students = students - absent_monday - absent_tuesday absent_wednesday = remaining_students / 3 present_wednesday = students - absent_monday - absent_tuesday - absent_wednesday result = pres...
A man earns a salary of $2500 per month. He spends $1000 on rent, $500 on transportation and pays his taxes of $1000 per month as well. Calculate the total amount of money the man is left with at the end of the month.
def solve() -> int: salary = 2500 tax = 1000 rent = 1000 transportation = 500 total_expense = tax + rent + transportation result = salary - total_expense return result
Student: Rick works 10 shifts each month and makes $25 per hour. How much does Rick make in one month?
def solve() -> int: shifts = 10 hourly_wage = 25 total_monthly_wage = shifts * hourly_wage result = total_monthly_wage return result
If the ratio of boys to girls in a class is 3:5, and there are 24 boys, how many girls are there?
def solve() -> int: boys = 3 girls = 5 total_students = boys + girls boys_ratio = boys / total_students girls_ratio = girls / total_students girls_total = round(girls_ratio * (boys + girls - 24)) result = girls_total return result
A building has 15 floors. If each floor is 10 feet tall, how many feet tall is the building?
def solve() -> int: floor_height_feet = 10 number_of_floors = 15 building_height_feet = floor_height_feet * number_of_floors result = building_height_feet return result
A company produces 1500 TV sets in a month. Each TV set is sold for $500. If it costs the company $200 to produce each TV set, what is the company's total profit for the month?
def solve() -> int: production_cost = 200 selling_price = 500 profit_per_set = selling_price - production_cost number_of_sets = 1500 total_profit = profit_per_set * number_of_sets result = total_profit return result
Gracie has 78 markers. She gives 3/5 of them to her friend. How many markers does she have left?
def solve() -> int: markers_initial = 78 markers_given = 3/5 * markers_initial result = markers_initial - markers_given return result
A deer needs to gather food for her fawns and herself in preparation for the winter. She needs 150 pounds of food per week. Each fawn needs 25 pounds per week and she has 3 fawns. She collects grass, which provides her with 10 pounds per gathering. If she gathers daily, how many gatherings does she need to complete eac...
def solve() -> int: mother_needs = 150 / 7 fawn_needs = 25 * 3 / 7 total_needs = mother_needs + fawn_needs gatherings_needed = total_needs / 10 result = gatherings_needed result return result
If Bob has 8 marbles and gives away 1/4 of them to his friend, how many marbles does Bob have left?
def solve() -> int: num_marbles = 8 given_away = num_marbles / 4 leftover = num_marbles - given_away result = leftover return result
Q6. The bus can carry 40 people at a time, if 50 people wanted to take the bus, how many times would the bus have to go back and forth to accommodate everyone?
def solve() -> int: capacity = 40 totalPeople = 50 times = totalPeople / capacity result = times return result
Sarah wants to save for a down payment on a house. She saves $500 in the first month, $600 in the second month, and $700 in the third month. If she follows this pattern, how much will she have saved after 10 months?
def solve() -> int: month1 = 500 month2 = 600 month3 = 700 total_savings = month1 + month2 + month3 for i in range(4, 11): next_month = month3 + 100 total_savings += next_month month1 = month2 month2 = month3 month3 = next_month result = tot...
Q7: A tree is shaped like a triangle and has a base of 10 feet and a height of 5 feet. How much area does the tree cover?
def solve() -> int: base = 10 height = 5 area = base * height / 2 result = area return result
Jacob has a collection of marbles. Every month, he acquires 8 marbles. However, every three months, he trades in 3 marbles with his sister. If Jacob begins with 40 marbles, how many months will it take him to have a total of 100 marbles?
def solve() -> int: marbles = 40 months = 0 while marbles < 100: months += 1 marbles += 8 if months % 3 == 0: marbles -= 3 result = months return result
A car travels 300 miles on a full tank of gas. If it only has 1/4 of a tank left, how many miles can it travel before it runs out of gas?
def solve() -> int: total_miles = 300 gas_left = 1/4 miles_left = gas_left * total_miles result = miles_left return result
Teddy buys a bike for $240, which is 20% off the original price. What was the original price of the bike?
def solve() -> int: discounted_price = 240 discount_percentage = 20 original_price = discounted_price / (1 - discount_percentage / 100) result = original_price return result
Student: A candy store produced 250 chocolates at $2.50 per chocolate and sold them for $3.50 each. How much money did the store make?
def solve() -> int: cost_per_chocolate = 2.50 price_per_chocolate = 3.50 number_of_chocolates = 250 total_cost = cost_per_chocolate * number_of_chocolates total_price = price_per_chocolate * number_of_chocolates profit = total_price - total_cost result = profit return result
Emma has saved $90 a month for 6 years. Her best friend, Olivia, has been saving 1/3 less than Emma per month. What is the total amount of money they have saved together?
def solve() -> int: emma_savings_per_month = 90 olivia_savings_per_month = emma_savings_per_month * (2/3) total_savings = (emma_savings_per_month + olivia_savings_per_month) * 12 * 6 result = total_savings return result
Ed has 20 pencils which he gives to his friends. If he gives every friend 2 pencils, he remains with 4 pencils. How many friends did Ed give his pencils to?
def solve() -> int: pencils = 20 pencils_remain = 4 pencils_per_friend = 2 friends = (pencils - pencils_remain) // pencils_per_friend result = friends return result
A company has 960 employees, of which 25% work in sales, 35% in administration and the rest in production. How many employees work in production?
def solve() -> int: sales_employees = 960 * 0.25 admin_employees = 960 * 0.35 prod_employees = 960 - sales_employees - admin_employees result = f"{prod_employees} employees work in production" result = prod_employees return result
Josh and Jessie are planning a camping trip with their family. Josh brought 6 camping chairs, 9 sleeping bags and 4 tents. Jessie brought 5 camping chairs, 3 sleeping bags and 10 tents. Each camping chair cost $16 while each sleeping bag cost $22 and each tent cost $54. How much money did they spend in total?
def solve() -> int: total_josh = 0 total_jessie = 0 total_josh = 6 * 16 + 9 * 22 + 4 * 54 total_jessie = 5 * 16 + 3 * 22 + 10 * 54 result = total_josh + total_jessie return result
A student has an average grade of 92 in a class. If their grade on the final exam is worth 20% of their grade, what grade do they need on the exam to earn an A (93 or higher)?
def solve() -> int: current_grade = 92 final_exam_weight = 0.2 desired_grade = 93 grade_needed = (desired_grade - (1 - final_exam_weight) * current_grade) / final_exam_weight result = grade_needed return result
Jenna and Ryan each have a basket of fruits, with three different types. Jenna has 50 apples, 30 oranges, and 10 bananas. Ryan has four times as many apples as Jenna, but only a quarter as many oranges and half as many bananas. How many more fruits does Ryan have than Jenna?
def solve() -> int: jenna_apples = 50 jenna_oranges = 30 jenna_bananas = 10 ryan_apples = 4 * jenna_apples ryan_oranges = 1/4 * jenna_oranges ryan_bananas = 1/2 * jenna_bananas ryan_total_fruits = ryan_apples + ryan_oranges + ryan_bananas jenna_total_fruits = jenna_apples + jen...
A baker needs 330 eggs for a cake. If she has four crates of fifty eggs each, how many crates of eggs does the baker still need?
def solve() -> int: total_eggs = 330 eggs_in_crate = 50 crates_have = 4 total_crates_needed = total_eggs // eggs_in_crate crates_still_needed = total_crates_needed - crates_have result = crates_still_needed return result
Andrew and Ally brought 3 packs of cards, each containing 52 cards. What is the total number of cards they have?
def solve() -> int: packs_of_cards = 3 cards_per_pack = 52 total_cards = packs_of_cards * cards_per_pack result = total_cards return result
A store sells 20 bikes a day. If each bike costs $100, how much money does the store make in a week?
def solve() -> int: bikes_day = 20 bikes_week = bikes_day*7 money = bikes_week*100 result = f'<<<{money}>>>' result = money return result
Tom has 200 books and wants to give half of them away to his friends and donate the remaining to a library. What percentage of the total books does he donate to the library?
def solve() -> int: total_books = 200 books_away = 200 / 2 books_library = total_books - books_away percent_library = books_library / total_books * 100 result = percent_library return result
Bob buys a pack of 12 pencils for 3 dollars. He uses one pencil every week for his homework. He also gives away 3 pencils to his friends. How many weeks can he use the pack of pencils for?
def solve() -> int: pencils_left = 12 - 3 weeks = pencils_left / 1 result = int(weeks) return result
Student: If Liam has 50 marbles and he gives away 5 to his friend, then he gets 15 more from his other friend, how many marbles does he have now?
def solve() -> int: marbles = 50 marbles = marbles - 5 marbles = marbles + 15 result = marbles return result
A restaurant is giving out free desserts with meals. A pizza costs $20 and comes with one free dessert. A fish and chips meal costs $30 and comes with two free desserts. Which option gives more value for the money?
def solve() -> int: cost_per_dessert1 = 20/1 cost_per_dessert2 = 30/2 if cost_per_dessert1 > cost_per_dessert2: result = "The fish and chips meal gives more value for the money." else: result = "The pizza gives more value for the money." return result
James went to a restaurant and ordered a burger for $5, fries for $2, and a drink for $3. Write a program to calculate how much James spent.
def solve() -> int: burger_price = 5 fries_price = 2 drink_price = 3 total_spent = burger_price + fries_price + drink_price result = total_spent return result
Emily wants to build an outdoor gazebo. She knows it will cost $25 per square foot of space she needs. She needs a 350-square-foot area. She also needs to purchase some supplies, including a ceiling fan that costs $70, lights that cost $An airline has 800 cans of soda. 120 cans were used for first class passengers and ...
def solve() -> int: total_area = 350 cost_per_square_foot = 25 total_cost = total_area * cost_per_square_foot ceiling_fan_cost = 70 light_cost = 45 total_cost += ceiling_fan_cost + light_cost remaining_cans = 800 - 120 - 60 total_sales = remaining_cans * 2 selling...
Samantha found a deal on a new office chair but found a lot of paper in the drawers. She found 2 rolls of colored paper, 4 packs of white paper, and 3 stacks of scrap paper. If each roll holds 100 sheets of paper, each pack holds 200 sheets of paper, and each stack holds 50 sheets of paper, how many sheets of paper did...
def solve() -> int: rolls_of_colored_paper = 2 packs_of_white_paper = 4 stacks_of_scrap_paper = 3 sheets_per_roll = 100 sheets_per_pack = 200 sheets_per_stack = 50 total_sheets = (rolls_of_colored_paper * sheets_per_roll) + (packs_of_white_paper * sheets_per_pack) + (stacks_of_scra...
A car travels 300 miles in 5 hours. How long will it take the car to travel 240 miles at the same rate?
def solve() -> int: speed = 300 / 5 distance = 240 time = distance / speed result = time return result
Alex earned $36 selling lemonade. He spent a third of it on a new video game and put half of the rest in his rainy day fund. He then lost $6 on his way to the market. How much money did Alex have left?
def solve() -> int: earnings = 36 video_game_cost = earnings / 3 remaining_money = earnings - video_game_cost rainy_day_fund = remaining_money / 2 money_lost = 6 remaining_money -= money_lost result = remaining_money return result
There are 500 guests at a party. Each guest eats 3 pieces of cake. If each cake has 20 pieces, how many cakes are needed?
def solve() -> int: guests = 500 pieces_by_guest = 3 pieces_by_cake = 20 pieces_needed = guests*pieces_by_guest cakes = pieces_needed/pieces_by_cake result = cakes return result
A 3200 cm rope is split into 320 sections. 310 of the sections are the same length, and the remaining sections are 60mm long. How long is each section with equal lengths in millimeters?
def solve() -> int: rope_length_cm = 3200 num_sections = 320 short_sections_mm = 60 total_length_mm = rope_length_cm * 10 total_length_mm -= short_sections_mm * (num_sections - 310) equal_sections_mm = total_length_mm / 310 result = equal_sections_mm return result
A grocery store bought 5 crates of berries, with each crate weighing 10 kg. They then sold the berries for $5/kg, but after a while the price dropped to $4/kg so they sold the other 2 crates at the reduced price. If the store's profit per kg of berries is $2, calculate the store's total profit.
def solve() -> int: total_weight = 5*10 + 2*10 total_revenue = 5*(5*10) + 4*(2*10) total_cost = 5*(3*10) + 2*(3*10) total_profit = total_revenue - total_cost result = total_profit return result
Student: You buy an ice cream that cost $2.5 and a pack of chips that cost $4. How much do you spend in total?
def solve() -> int: ice_cream_cost = 2.5 chips_cost = 4 total_cost = ice_cream_cost + chips_cost result = total_cost return result
Student: A baker has a recipe that requires 1 3/4 cups of flour and makes 12 muffins. If the baker wants to make 30 muffins, how many cups of flour are required?
def solve() -> int: flour_per_muffin = 1.75/12 muffins_needed = 30 flour_needed = muffins_needed * flour_per_muffin result = flour_needed return result
arah has 100 marbles in total. If 25% of them are green and the rest are blue, how many blue marbles does she have?
def solve() -> int: total_marbles = 100 green_marbles = total_marbles * 0.25 blue_marbles = total_marbles - green_marbles result = blue_marbles return result
Anna has 72 stickers and she wants to share them equally with her two sisters. Each sister gets 1/3 of the stickers Anna has. How many stickers does each sister get?
def solve() -> int: stickers_total = 72 sisters = 2 fraction = 1/3 stickers_each = stickers_total * fraction result = stickers_each return result
A person bikes 30 miles to a destination at 15 MPH. The person then discovers that they forgot their phone and goes back to get it, also biking at 15 MPH. After biking for 10 miles on the way back, they realized their phone wasn't actually left at the destination and decide to turn around and bike to a neighbor's house...
def solve() -> int: distance1 = 30 distance2 = 10 distance3 = 20 distance4 = 10 time1 = distance1/15 time2 = distance2/15 time3 = distance3/12 time4 = distance4/10 total_distance = distance1 + distance2 + distance3 + distance4 total_time = time1 + time2 + time3 + time4 ...
A tank is filled with 200 gallons of water. If the water evaporates by 20% each day, how much water will be left after 3 days?
def solve() -> int: remaining_gallons_10 = 200*(0.8**3) result = remaining_gallons_10 return result
Mia has 8 hairpins. On Tuesday, she lost 3 hairpins and her mother gave her 2 more. On Wednesday, all of Mia's old and new hairpins were missing, so her mother bought her 4 more hairpins. If Mia found all the lost hairpins, including the new hairpins, how many hairpins would she have now? Kevin has only eaten 5 kinds o...
def solve() -> int: hairpins_on_tuesday = 8 - 3 + 2 hairpins_on_wednesday = hairpins_on_tuesday + 4 total_hairpins = hairpins_on_wednesday + 8 result = total_hairpins kevin_fruits = 5 sarah_fruits = kevin_fruits * 10 michelle_fruits = sarah_fruits + 20 days_to_eat = (michelle_fruits...
In a baking contest, Ella baked 6 times as many muffins as Liam. Noah baked 3 less than one-fourth the number of muffins that Liam baked, and Olivia baked 10 more than 4 times the number of muffins that Noah baked. If Ella baked 24 muffins, how many muffins did Olivia bake?
def solve() -> int: ella = 24 liam = None noah = None olivia = None liam = ella / 6 noah = liam / 4 - 3 olivia = noah * 4 + 10 result = olivia return result
Emily purchases 30 pieces of furniture for $50,000. It costs 35% more than that to finish them. Each piece sells for $1,500. How much profit did she make?
def solve() -> int: furniture_cost = 50000 additional_cost = furniture_cost * 0.35 total_cost = furniture_cost + additional_cost selling_price = 1500 total_revenue = selling_price * 30 profit = total_revenue - total_cost result = profit return result
A company has 150 employees. 20% of the employees are part-time and earn $10 per hour. The rest are full-time and earn $20 per hour. If the company pays each employee for 40 hours of work in a week, how much does the company pay in total?
def solve() -> int: employees = 150 part_time_ratio = 0.2 part_time_employees = employees * part_time_ratio full_time_employees = employees - part_time_employees part_time_salary = 10 full_time_salary = 20 hours = 40 part_time_pay = part_time_employees * hours * part_time_salary full...
Mark is on a lunch break and he needs to get to the store to buy some new supplies. He drives 130 miles at an average speed of 55 mph and he also drove for 30 minutes at an average speed of 45 mph. How long did it take him to get to the store?
def solve() -> int: average_speed = 55 total_miles = 130 time1 = total_miles / average_speed time2 = 0.5 total_time = time1 + time2 result = total_time return result
David is a grocer and needs to pack a bag of potatoes for every customer who comes into the store. There are 50 customers in line and each bag of potatoes typically contains 2 kg of potatoes. How many kilograms of potatoes will David need in total?
def solve() -> int: customers = 50 potatoes_per_bag = 2 total_potatoes = customers * potatoes_per_bag result = total_potatoes return result
Student: A car can travel 300 miles on a full tank of gas. If the car has already traveled 180 miles, what percent of the gas tank has been used?
def solve() -> int: total_distance = 300 distance_traveled = 180 percent_used = (distance_traveled / total_distance) * 100 result = percent_used return result
On a certain day, the temperature down in the morning and went up in the evening by 6 degrees. Starting temperature is 7 degrees Celsius. What is the temperature at the end of the day?
def solve() -> int: start_temp = 7 change = 6 result = start_temp + change return result
John went to the store and bought 4 shirts and 3 pairs of trousers. Each shirt cost 25$ and each pair of trousers cost 45$. How much did John spend?
def solve() -> int: total_cost = 0 shirts = 4 cost_shirt = 25 trousers = 3 cost_trousers = 45 total_cost = (shirts * cost_shirt) + (trousers * cost_trousers) result = total_cost return result