question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Student: A recipe calls for 3/4 cup of flour for 8 servings. How many cups of flour are needed for 16 servings?
def solve() -> int: servings = 16 flour_per_serving = 3/4 total_flour = servings * flour_per_serving result = total_flour return result
Student: Tom can mow a lawn in 2 hours. If John can mow the same lawn in 3 hours, how long will it take them to mow the lawn if they work together?
def solve() -> int: tom_rate = 1 / 2 john_rate = 1 / 3 together_rate = tom_rate + john_rate together_time = 1 / together_rate result = together_time return result
David earns $5 per hour and works for 8 hours every day. If he works for 5 days, how much money will he earn?
def solve() -> int: hourly_wage = 5 hours_per_day = 8 days_worked = 5 total_money = hourly_wage * hours_per_day * days_worked result = total_money return result
Student: A carpenter has 5 planks of wood, each is 8 feet long. How many feet of wood does the carpenter have in total?
def solve() -> int: num_planks = 5 length_plank = 8 total_length = num_planks * length_plank result = total_length return result
In a painting competition, Mia got 6 times more than the lowest score. If the highest score is 80 and the range of scores is 45, what was Mia's score?
def solve() -> int: lowest_score = 80 - 45 mia_score = lowest_score * 6 result = mia_score return result
In a troop, 66% of the scouts are boys, 52 of them are carrying a bag. What is the total number of scouts in the troop?
def solve() -> int: boyScout = 52 / (66 / 100) result = boyScout return result
A box contains 190 erasers and weighs 2.5 kilograms. What is the weight of each eraser?
def solve() -> int: weight_per_eraser = 2.5 / 190 result = 0.013157894736842105 return result
ve can do a certain task in 4.5 hours, while Hilary can do it in 6 hours. How much longer will it take if they worked together?
def solve() -> int: timeSteve = 4.5 timeHilary = 6 totalTime = 0 totalTime = (timeSteve * timeHilary) / (timeSteve + timeHilary) print ('It will take', totalTime, 'hours for both Steve and Hilary to complete the task.') result = totalTime return result
Student: Gary sold 48 items in total. He sold 34 of the items at a price of $22 and 14 of the items at a price of $12. How much money did Gary make in total?
def solve() -> int: items_sold = 48 price_22 = 22 price_12 = 12 total_22 = items_sold * price_22 total_12 = items_sold * price_12 result = total_22 + total_12 return result
If you add 3 to twice a number, multiply the sum by another number, and then subtract the product from the second number, you get 13. If the second number is 5, what is the first number?
def solve() -> int: num = (13 + 10)/(2 * 5) - 3 result = num return result
A man can row a boat at a speed of 10 km/h in still water. He rows 12 km upstream and then 12 km downstream in a river with a current of 2 km/h. How long does the whole trip take?
def solve() -> int: result = 1.5 + 1 return result
A pizza restaurant has a diameter of 20 inches. What is the circumference of the pizza in inches?
def solve() -> int: diameter = 20 pi = 3.14 circumference = pi * diameter result = circumference return result
A tank can hold 100 gallons of water. If it is currently 3/5 full, how many gallons of water are in the tank?
def solve() -> int: tank_capacity = 100 filling = 3/5 gallons_of_water = tank_capacity * filling result = gallons_of_water return result
A recipe for cake mix calls for 2 cups of sugar for every 3 cups of flour. If you only have 4 cups of flour, how much sugar should you use?
def solve() -> int: flour = 4 sugar = (2/3) * flour result = sugar return result
A recipe calls for 3 1/2 cups of flour. If you want to make 1/2 of the recipe, how many cups of flour will you need?
def solve() -> int: full_recipe = 3.5 fraction_of_recipe = 1/2 half_recipe = full_recipe * fraction_of_recipe result = half_recipe return result
A grocer is stocking 16 cans of vegetables, each with a net weight of 8oz, how much total weight of vegetables does the grocer have?
def solve() -> int: total_weight = 0 number_of_cans = 16 net_weight = 8 total_weight = number_of_cans * net_weight result = total_weight return result
A company needs to ship 100 packages. Each package weighs 2.5 pounds. If the truck can carry a maximum of 300 pounds, how many trips will the truck need to make?
def solve() -> int: packages = 100 package_weight = 2.5 max_weight = 300 total_weight = packages * package_weight trips = total_weight // max_weight + 1 result = trips return result
Student: At a farm, the chickens lay 2 eggs per day, and the ducks lay 3 eggs per day. Bob has 5 chickens and 4 ducks. He collects all the eggs every day for a week. How many eggs, in total, did Bob collect in a week?
def solve() -> int: chickens = 5 ducks = 4 eggs_per_chicken = 2 eggs_per_duck = 3 days = 7 total_eggs = (chickens * eggs_per_chicken) + (ducks * eggs_per_duck) total_eggs_in_week = total_eggs * days result = total_eggs_in_week return result
If a pizza with a circumference of 40cm is cut into 8 equal slices, what is the length of one slice?
def solve() -> int: length = 40/8 result = length return result
Emma is constructing a swimming pool in her backyard. Each of the four sides of her pool is 30 feet long, 6 feet high, and 3 feet thick. How many tiles does Emma need to complete the pool?
def solve() -> int: length_of_side = 30 height_of_side = 6 thickness_of_side = 3 area_of_side = length_of_side * height_of_side area_of_tile = 1 number_of_tiles = area_of_side / area_of_tile result = number_of_tiles return result
A toy store marks up a doll 15% above the cost. During a summer sale, they offer a 12% discount. If the doll costs $10, what is the percent profit?
def solve() -> int: doll_cost = 10 markup_percent = 15 discount_percent = 12 doll_price = doll_cost * (1 + markup_percent/100) doll_price_after_discount = doll_price * (1 - discount_percent/100) profit = (doll_price_after_discount - doll_cost) / doll_cost * 100 result = profit...
Maria bought a bag of 50 marbles to play with her brother. They played with 20% of the marbles and then Maria gave 10 marbles to her cousin. How many marbles does Maria have left to play with?
def solve() -> int: marbles = 50 played_marbles = marbles * 0.2 marbles_left = marbles - played_marbles marbles_left -= 10 result = marbles_left return result
A park has 3 separate trails. Each trail is 7 kilometers long. How many kilometers are there in total?
def solve() -> int: trail_length = 7 num_trails = 3 result = trail_length*num_trails return result
Student: Jake is running a marathon of 42 kilometres. After 30 kilometres, how much more does Jake have to run before he reaches the finish line?
def solve() -> int: distance = 42 distance_run = 30 distance_left = distance - distance_run result = distance_left return result
A babysitter has 24 toys to keep 6 children entertained. There are 2 children who prefer dolls and the rest prefer balls. If each of the doll-loving children gets 3 dolls, how many toys will each of the remaining children get?
def solve() -> int: toys = 24 children = 6 doll_lovers = 2 dolls_per_child = 3 total_dolls = doll_lovers * dolls_per_child remaining_toys = toys - total_dolls ball_lovers = children - doll_lovers toys_per_child = remaining_toys // ball_lovers r...
In a factory, each machine can produce 4 barrels of soda in 4 minutes. What is the total amount of minutes needed to produce 32 barrels of soda in the factory?
def solve() -> int: initial_barrel = 32 single_machine_time = 4 total_machine_time = initial_barrel / single_machine_time result = total_machine_time return result
If John can complete a task in 8 hours, and Jane can complete the same task in 6 hours, how long will it take if they work together to complete the task?
def solve() -> int: hours_per_task_for_John = 8 hours_per_task_for_Jane = 6 tasks_to_be_completed = 1 work_rate_for_John = tasks_to_be_completed / hours_per_task_for_John work_rate_for_Jane = tasks_to_be_completed / hours_per_task_for_Jane combined_work_rate = work_rate_for_John + work_rate_for_...
Dan has 20 stickers. He trades 40% of them with his sister for 5 cards. Then he loses 2 cards and 3 stickers. How many stickers and cards does he have now?
def solve() -> int: stickers_traded = 0.4 * 20 stickers_left = 20 - stickers_traded cards_traded = 5 cards_total = cards_traded cards_lost = 2 stickers_lost = 3 stickers_final = stickers_left - stickers_lost cards_final = cards_total - cards_lost result = (stickers_final, cards_fina...
Jane bikes to work every day. She bikes 5 miles in 20 minutes. If she wants to bike for 45 minutes, how many miles will she have biked?
def solve() -> int: distance_per_minute = 5/20 total_time = 45 total_distance = distance_per_minute*total_time result = total_distance return result
Jane had 11 fewer apples than 4 times as many pears. If she had a total of 41 apples and pears combined, how many pears did Jane have?
def solve() -> int: numPears = 41/5 numApples = (41-11)-(4*numPears) result = numPears return result
Student: A pizza restaurant charges a base price of $10 for a medium-sized pizza. If extra cheese costs $2 and mushrooms cost $1.50, what is the total cost for a pizza with extra cheese and mushrooms?
def solve() -> int: base_price = 10 cheese_cost = 2 mushroom_cost = 1.50 total_cost = base_price + cheese_cost + mushroom_cost result = total_cost return result
A farmer has 1000 chickens and wants to divide them into 10 coops equally. How many chickens will be in each coop?
def solve() -> int: total_chickens = 1000 num_of_coops = 10 chickens_in_each_coop = total_chickens // num_of_coops result = chickens_in_each_coop return result
Jane went to the supermarket and bought 2 pounds of apples at $1.50/pound and 3 pounds of oranges at $0.80/pound. How much did she spend in total?
def solve() -> int: apples_price = 1.50 oranges_price = 0.80 apples_weight = 2 oranges_weight = 3 total_cost = apples_price * apples_weight + oranges_price * oranges_weight result = total_cost return result
Out of 600 students at a university, 20% are part of a sports team and 90% own a laptop. What is the probability of selecting a student who is part of a sports team and owns a tablet?
def solve() -> int: total_students = 600 sports_team_students = total_students * 0.2 laptop_owners = total_students * 0.9 both_conditions = total_students * 0.2 * 0.9 probability = both_conditions / total_students result = probability return result
If a box of cookies costs $6 and is five times the price of a single cookie, how much does a single cookie cost?
def solve() -> int: box_price = 6 num_cookies_in_box = 5 single_cookie_price = box_price / num_cookies_in_box result = single_cookie_price return result
ameera has 16 marbles, which is twice as many as Huda. Huda has 4 more marbles than Ahmed. How many marbles does Ahmed have?
def solve() -> int: huda = 16 / 2 ahmed = huda - 4 result = ahmed return result
Mia wants to paint her room. She needs to buy paint and brushes. Paint costs $40 per gallon and she needs 2 gallons. Brushes cost $15 each and she needs 3. How much will the paint and brushes cost her?
def solve() -> int: num_gallons = 2 paint_price = 40 num_brushes = 3 brush_price = 15 total_cost = (num_gallons*paint_price) + (num_brushes*brush_price) result = total_cost return result
Student: Daenerys can fly her dragon at a speed of 100 miles per hour, while Cersei can fly her dragon at a speed of 130 miles per hour. If they are both flying to a fortress which is 520 miles away, how many hours ahead will Cersei be ahead of Daenerys?
def solve() -> int: distance = 520 daenerys_speed = 100 cersei_speed = 130 daenerys_time = distance / daenerys_speed cersei_time = distance / cersei_speed time_difference = cersei_time - daenerys_time result = time_difference / 1 return result
Amanda collects books and magazines to donate to her local library. Each book weighs 12 ounces and each magazine weighs 6 ounces. Amanda can carry a total of 180 ounces. She collects 10 magazines and as many books as she can carry. How many books can Amanda carry?
def solve() -> int: total_weight_capacity = 180 book_weight = 12 magazine_weight = 6 num_magazines = 10 magazines_total_weight = num_magazines * magazine_weight books_weight_left = total_weight_capacity - magazines_total_weight remaining_books = books_weight_left // book_weight ...
A small business received $563 on Monday, $732 on Tuesday, and $645 on Wednesday. What is the total amount of money received in three days?
def solve() -> int: monday_income = 563 tuesday_income = 732 wednesday_income = 645 total_income = monday_income + tuesday_income + wednesday_income result = total_income return result
Emily has two papers to write, one with 10 essay questions that should be finished in 1 hour, and another with 20 essay questions that should be completed in 2 hours. If she spends an equal amount of time on each essay question, how many more minutes does she have to answer each essay question on the second paper than ...
def solve() -> int: paper1_questions = 10 paper1_time = 60 paper2_questions = 20 paper2_time = 120 time_per_question1 = paper1_time / paper1_questions time_per_question2 = paper2_time / paper2_questions time_difference = time_per_question2 - time_per_question1 time_diffe...
If a pizza has 8 slices and 3 people each eat 2 slices, how many slices are left?
def solve() -> int: total_slices = 8 num_people = 3 slices_eaten = num_people * 2 slices_left = total_slices - slices_eaten result = slices_left return result
``` Ethan found $30 on the street. He spent $5 on candy, $8 on a toy, and $9 on a new book. How much money does Ethan have left?
def solve() -> int: found_money = 30 price_candy = 5 price_toy = 8 price_book = 9 total_spent = price_candy + price_toy + price_book money_left = found_money - total_spent result = money_left return result
Lisa buys a bicycle for $200. The bicycle loses 20% of its value every year. How much is the bike worth after 3 years?
def solve() -> int: price = 200 for i in range(3): price *= 0.8 result = price return result
ven years ago, the difference between Tom's age and his brother's age was three times his sister's age. How old is Tom today if his brother is 25 years old and his sister is 10 years old?
def solve() -> int: brotherAge = 25 sisterAge = 10 tomAgeSevenYearsAgo = brotherAge - 3 * sisterAge tomAgeToday = tomAgeSevenYearsAgo + 7 result = tomAgeToday return result
Student: If a room is 12 feet long and 10 feet wide, what is the area of the ceiling in square feet?
def solve() -> int: length = 12 width = 10 area = length * width result = area return result
Kim buys a toy for $93.75. As she doesn't have enough money to buy the console, she has to take a loan from a bank. She repays the loan in two equal monthly installments. The loan has an interest rate of 10%. How much does she need to pay each installment?
def solve() -> int: toy_price = 93.75 interest_rate = 10 loan_amount = (toy_price / 100) * (100 + interest_rate) monthly_installment = loan_amount / 2 result = monthly_installment return result
In 2 years, Dean will be three times as old as Lina. If Dean is currently 10 years old, what is the sum of their ages now?
def solve() -> int: age1 = 10 age2 = age1/3 result = age1 + age2 return result
Possible questions and programs are: Mary collects stickers. She has 120 animal stickers and 80 flower stickers. She gives away 25% of her animal stickers and 10% of her flower stickers to her friends. How many stickers does she have left?
def solve() -> int: animal = 120 flower = 80 animal_give = animal * 0.25 flower_give = flower * 0.10 animal_left = animal - animal_give flower_left = flower - flower_give total_left = animal_left + flower_left result = total_left return result
Maxwell went to the store and bought 2 boxes of cereal, 5 bars of chocolate, and 8 cans of soda. If each box of cereal cost $5, each bar of chocolate cost $2, and each can of soda cost $3, how much was the total amount he paid?
def solve() -> int: cereal_price = 5 chocolate_price = 2 soda_price = 3 num_cereal = 2 num_chocolate = 5 num_soda = 8 cereal_total = cereal_price * num_cereal chocolate_total = chocolate_price * num_chocolate soda_total = soda_price * num_soda total_amount = cereal...
A teacher is planning a math competition for her students. If each student needs 4 pencils and there are 24 students, how many packs of 12 pencils should the teacher buy?
def solve() -> int: students = 24 pencils_per_student = 4 pencils_per_pack = 12 total_pencils_needed = students * pencils_per_student packs_needed = total_pencils_needed // pencils_per_pack result = packs_needed return result
Student: A cinema has 200 seats and one ticket cost is $5. If the cinema sells 160 tickets at a reduced price of $3 each and sells the remaining tickets at full price, how much money does the cinema make?
def solve() -> int: total_seats = 200 full_price = 5 reduced_tickets = 160 reduced_price = 3 full_tickets = total_seats - reduced_tickets reduced_revenue = reduced_tickets * reduced_price full_revenue = full_tickets * full_price total_revenue = reduced_revenue + full_revenue result =...
During a workout class with her trainer Jamie, Samantha noticed 7 other participants join in. If there were also 20 people in the gym, how many people were in the class?
def solve() -> int: participants_joined = 7 total_people = 20 class_size = total_people - participants_joined result = class_size return result
A pizza costs $20 and has 8 slices. How much will one slice cost?
def solve() -> int: cost_per_slice = 20/8 result = cost_per_slice return result
If it takes Sarah 45 minutes to complete a puzzle but she takes a 3-minute break every 15 minutes, how much time will she need to complete 3 similar puzzles?
def solve() -> int: puzzle_time = 45 break_time = 3 break_interval = 15 num_puzzles = 3 total_breaks = (num_puzzles - 1) * (puzzle_time // break_interval) total_time = (num_puzzles * puzzle_time) + (total_breaks * break_time) result = total_time return result
Jack has 50 books. One-fifth of them are hardcover and the rest are paperback. Of the hardcover books, a third are fiction and the rest are non-fiction. How many non-fiction hardcover books does Jack have?
def solve() -> int: books = 50 hardcover_books = books / 5 fiction_hardcover_books = hardcover_books / 3 nonfiction_hardcover_books = hardcover_books - fiction_hardcover_books result = nonfiction_hardcover_books return result
At Vegetable Valley, carrots cost $2 per pound with a 25-pound minimum. If Emily spent $50 on carrots, how many pounds over the minimum did she purchase?
def solve() -> int: price_per_pound = 2 minimum_purchase = 25 total_spent = 50 minimum_purchase_amount = price_per_pound * minimum_purchase amount_over_minimum = total_spent - minimum_purchase_amount pounds_over_minimum = amount_over_minimum / price_per_pound result = pou...
A rectangular garden is 15 meters long and 10 meters wide. If you want to walk along the border of the garden, how many meters do you need to walk?
def solve() -> int: perimeter_of_garden = 2*(15+10) result = perimeter_of_garden return result
Lily is going to the zoo. It takes her 1 hour to get there and back. She spends 4 times as long at the zoo as she spends driving altogether. How long does the trip take in total?
def solve() -> int: driving_time = 1 zoo_time = 4 * driving_time total_time = driving_time * 2 + zoo_time result = total_time return result
Cal was given 10 apples. If he gives 7 apples away, how many apples does he have left?
def solve() -> int: apple_num = 0 apple_num += 10 apple_num -= 7 result = apple_num return result
The sum of two numbers is 27 and their difference is 3. What are the two numbers?
def solve() -> int: sum_of_numbers = 27 difference_of_numbers = 3 number_1 = (sum_of_numbers + difference_of_numbers)/2 number_2 = (sum_of_numbers - difference_of_numbers)/2 result = (number_1, number_2) return result
Jenny has 1000 candies and wants to split them into 10 bags evenly. How many candies are in each bag?
def solve() -> int: total_candies = 1000 num_bags = 10 candies_per_bag = total_candies / num_bags result = candies_per_bag return result
Two cars are driving at a speed of 60 mph and 80 mph respectively. The faster car is 400 yards ahead of the slower car. How much time would it take for the faster car to catch up to the slower one?
def solve() -> int: d1 = 400 v2 = 80 v1 = 60 t1 = (d1/v2)*3600 result = t1/3600 return result
A bag costs $20 each. A seller offers a 5% discount for every two bags. If you buy 6 bags, how much would you pay for all of them?
def solve() -> int: bag_cost = 20 discount = 0.05 num_bags = 6 total_cost = (num_bags//2)*(2*bag_cost*(1-discount)) + (num_bags%2)*bag_cost result = f'<<<{total_cost}>>>' result = total_cost return result
Regan has $90. She spends $5 on candy and then spends one-half of her remaining money. How much money does Regan have left, in dollars?
def solve() -> int: result = 90 - 5 - ((90-5)/2) print (result) return result
In a recipe, there are 4 cups of milk for every 5 cups of flour. How many cups of milk are required for 15 cups of flour?
def solve() -> int: flour = 15 milks = (4/5) * flour result = milks return result
A retail store has a sale for 20% off on all items. If a customer buys an item that costs $50, how much will they pay after the sale?
def solve() -> int: original_price = 50 discount_percentage = 20 final_price = original_price - ((discount_percentage/100)*original_price) result = final_price return result
The 3rd grade class has 40 students. How many notebooks do they need if each student needs 3 notebooks?
def solve() -> int: number_of_students = 40 num_of_notebooks = 3 total_notebooks = number_of_students * num_of_notebooks result = total_notebooks return result
Mia is making a smoothie. She uses a cup of milk, a banana, and a tablespoon of honey. A cup of milk has 120 calories, a banana has 105 calories, and a tablespoon of honey has 60 calories. How many calories are in the smoothie?
def solve() -> int: milk_calories = 120 banana_calories = 105 honey_calories = 60 total_calories = milk_calories + banana_calories + honey_calories result = total_calories return result
A restaurant bill is $87.50. If 15% tip is added, what is the total bill?
def solve() -> int: bill = 87.5 tip_percentage = 0.15 total = bill * (1 + tip_percentage) result = total return result
If Sarah has 25 red balls and 10 blue balls, and Alex has 5 times as many red balls as Sarah but only 1/4 as many blue balls, how many more balls does Alex have in total?
def solve() -> int: sarah_red_balls = 25 sarah_blue_balls = 10 alex_red_balls = 5 * sarah_red_balls alex_blue_balls = sarah_blue_balls / 4 alex_total_balls = alex_red_balls + alex_blue_balls result = alex_total_balls - (sarah_red_balls + sarah_blue_balls) return result
A machine can produce 15 widgets per minute. If the machine runs for 3 hours, how many widgets will it produce?
def solve() -> int: widgets_per_minute = 15 minutes_per_hour = 60 hours = 3 total_minutes = minutes_per_hour * hours total_widgets = widgets_per_minute * total_minutes result = total_widgets return result
In mid-June the river flowing through Moreland rises by 10 feet. By the end of July the river is 25% higher than it was at mid-June. How many feet does the river rise at the end of July?
def solve() -> int: mid_June_level = 10 change = mid_June_level * 0.25 july_level = mid_June_level + change result = july_level return result
arah ran a marathon in 3 hours and 31 minutes. What is the time difference between Sarah and the second place runner, who completed the marathon in 4 hours and 15 minutes?
def solve() -> int: sarah_time = 211 second_place_time = 255 time_difference = second_place_time - sarah_time result = time_difference return result
A group of ten students had a math test. The first six students completed the test in 2 hours while the last four took an additional hour. What's the total time the ten students took to complete the math test?
def solve() -> int: num_students = 10 first_group = 6 second_group = 4 first_time = 2 second_time = 3 total_time_first = first_group * first_time total_time_second = second_group * second_time total_time = total_time_first + total_time_second result = total_time ...
A basket of oranges has 9 large ones, 6 more medium ones, and twice as many small ones as medium ones. How many oranges are there in the basket?
def solve() -> int: large = 9 medium = large + 6 small = medium * 2 total = large + medium + small result = total return result
Student: Tony bought a new bike. He used it to ride 12 blocks to his school. He spent 10 minutes at his school and then came back home the same way. How many minutes did Tony spend biking all together?
def solve() -> int: blocks = 12 time_at_school = 10 time_biking = blocks * 2 result = time_biking + time_at_school return result
sie has 67 paperclips and she wants to divide them into boxes of 10 and 7. How many boxes of 10 and 7 can she make?
def solve() -> int: paperclips = 67 box_10 = paperclips // 10 remaining = paperclips % 10 box_7 = remaining // 7 remaining = remaining % 7 result = box_10 + box_7 return result
Student: Q8: Lisa travels 300 km in 6 hours. What is her speed?
def solve() -> int: distance = 300 time = 6 speed = distance / time result = speed return result
Jake went to the gym to work out. After that, he went to the restaurant to have dinner. If having dinner cost $60 which was five times the amount he spent at the gym, how much has he spent altogether?
def solve() -> int: gym_cost = 12 dinner_cost = 60 total_cost = gym_cost + dinner_cost result = total_cost return result
A rectangular box has a length of 10 cm, a width of 5 cm, and a height of 4 cm. What is the volume of the box?
def solve() -> int: length = 10 width = 5 height = 4 volume = length * width * height result = volume return result
A coffee shop sells coffee for $3 per cup. Each cup of coffee uses up 2 tablespoons of coffee grinds, and one container of coffee grinds can make 50 cups of coffee. Each container of coffee grinds costs $10. How much profit does the coffee shop make per cup of coffee?
def solve() -> int: coffee_price = 3 coffee_grinds = 2 cups_per_container = 50 cost_per_container = 10 containers_per_cup = 1 / cups_per_container cost_per_cup = containers_per_cup * cost_per_container profit_per_cup = coffee_price - cost_per_cup - coffee_grinds result = profit_per_cup ...
A company has 150 employees. Every year, 20% of the employees retire. How many employees will be left after 7 years?
def solve() -> int: employees = 150 retire_rate = 0.2 years = 7 for i in range(years): employees = employees - (employees * retire_rate) result = employees return result
The sum of four consecutive odd numbers is 76. What is the largest of those four numbers?
def solve() -> int: n = 76/4 largest = n + 6 result = largest return result
A rectangle has a length of 10 cm and a width of 5 cm. What is the perimeter of the rectangle in centimeters?
def solve() -> int: length = 10 width = 5 perimeter = 2 * length + 2 * width result = perimeter return result
Henry runs on a treadmill with two different speeds. With a speed of 8 miles per hour, he runs for 10 minutes, whereas with a speed of 12 miles per hour, he runs for 5 minutes. If he runs with a speed of 12 miles per hour for the first 15 minutes and then with a speed of 8 miles per hour for the next 20 minutes, how fa...
def solve() -> int: speed1 = 12 time1 = 15 speed2 = 8 time2 = 20 distance1 = (speed1 / 60) * time1 distance2 = (speed2 / 60) * time2 total_distance = distance1 + distance2 result = total_distance return result
Olivia and Owen invested some amount of money to start a new restaurant. Olivia contributed $10,000, while Owen contributed 1/5 more money than Olivia. If they made $5000 in profits and decided to share it equally, calculate the amount of money each person got.
def solve() -> int: olivia_contribution = 10000 owen_contribution = olivia_contribution * 6/5 total_contribution = olivia_contribution + owen_contribution profit = 5000 each_person_profit = profit / 2 olivia_profit = each_person_profit owen_profit = each_person_profit olivia_profit ...
Tom needs to bring breakfast for himself and 4 colleagues twice a week for 10 weeks. Each meal costs $8. How much money will Tom spend on breakfast?
def solve() -> int: colleagues = 4 meals_per_week = colleagues + 1 weeks = 10 meals = meals_per_week * weeks * 2 cost_per_meal = 8 total_cost = meals * cost_per_meal result = total_cost return result
Student: Sarah went to the grocery store and bought 5 cartons of milk, each containing 4 bottles. How many bottles did she buy in total?
def solve() -> int: cartons = 5 bottles_per_carton = 4 total_bottles = cartons * bottles_per_carton result = total_bottles return result
Grace has been a lawyer for 20 years. 6 years ago, Nick had four times as much experience as Grace. If Tom started practicing law when Nick had 25 years of experience, what is the combined experience of Grace, Nick, and Tom?
def solve() -> int: grace_experience = 20 nick_experience = (grace_experience - 6) / 4 tom_experience = nick_experience + 25 combined_experience = grace_experience + nick_experience + tom_experience result = combined_experience return result
In a zoo, there are 60 lions, 40 tigers, and 30 bears. If John feeds 10 lions and 5 tigers, and Mike feeds twice as many bears as the number of tigers that John fed, then how many animals are left in the zoo?
def solve() -> int: lions = 60 tigers = 40 bears = 30 john_lions_fed = 10 john_tigers_fed = 5 mike_bears_fed = john_tigers_fed * 2 remaining_lions = lions - john_lions_fed remaining_tigers = tigers - john_tigers_fed remaining_bears = bears - mike_bears_fed total_re...
Possible additional questions and programs are: Chelsea baked 15 cupcakes and sold 10 of them at a bake sale. She then decided to give away 2 cupcakes to her friends and keep the rest for herself. How many cupcakes did Chelsea have left?
def solve() -> int: cupcakes_left = 15 - 10 cupcakes_left = cupcakes_left - 2 result = cupcakes_left return result
A school supplies store has 18 pencils, 14 binders, 10 folders, 6 rulers, and a stack of loose leaf paper. Each pencil costs $0.25, each binder costs $3, each folder costs $2, each ruler costs $1, and the stack of loose leaf paper is worth $5. How much does everything in the store cost?
def solve() -> int: pencil_cost = 0.25 binder_cost = 3 folder_cost = 2 ruler_cost = 1 loose_leaf_cost = 5 total_pencil_cost = 18 * pencil_cost total_binder_cost = 14 * binder_cost total_folder_cost = 10 * folder_cost total_ruler_cost = 6 * ruler_cost total_cost = total_...
If males like 40% of the comic books, how many comic books are liked by males?
def solve() -> int: total = 300 percent = 40 males = total * (percent / 100) result = males return result
Mia and Max are playing a card game. The game uses 52 cards. Mia has 15 cards and Max has 12 cards. How many cards are left in the deck?
def solve() -> int: mia = 15 max = 12 total = mia + max left = 52 - total result = left return result
Lily has 60 balloons and is putting them into boxes. Most of the balloons are put into large boxes and the remaining 25 balloons are put into small boxes. The large boxes each contain 10 balloons each. If Lily has a total of 175 balloons, how many large boxes did she use?
def solve() -> int: total_balloons = 175 small_boxes = 1 balloons_per_small_box = 25 balloons_in_large_boxes = total_balloons - balloons_per_small_box large_boxes = balloons_in_large_boxes // 10 result = large_boxes return result
Student: Nine students collected 18 pine cones each for a craft project. Eleven students collected 15 pine cones each. How many more pine cones did the first group of students collect than the second group?
def solve() -> int: students_1 = 9 pine_cones_1 = 18 students_2 = 11 pine_cones_2 = 15 total_1 = students_1 * pine_cones_1 total_2 = students_2 * pine_cones_2 difference = total_1 - total_2 result = difference return result
John has 36 candies in total. He gave 1/3 of his candies to Ann. How many candies does Ann have now?
def solve() -> int: candies = 36 ann_candies = (1/3)*candies result = ann_candies return result
Michael swims for 40 minutes every day. How many hours will he swim after a month (30 days)?
def solve() -> int: days = 30 minutes_per_day = 40 total_minutes = days * minutes_per_day total_hours = total_minutes / 60 result = total_hours return result
A recipe calls for 3 cups of flour and 2 cups of sugar. If John wants to make half the recipe, how much flour and sugar should he use?
def solve() -> int: flour = 3 sugar = 2 half_flour = flour / 2 half_sugar = sugar / 2 result = f'<<<{half_flour} cups of flour and {half_sugar} cups of sugar should be used>>>' return result