question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
The sum of two numbers is 45. One number is 5 less than the other. What is the value of the smaller number?
def solve() -> int: total_sum = 45 smaller_number = (total_sum - 5) / 2 result = smaller_number return result
A TV is sold at a 25% discount and costs $900. What was the original price of the TV?
def solve() -> int: discount = 0.25 final_price = 900 original_price = final_price / (1 - discount) result = original_price return result
A company completed 100 surveys and received favorable reviews on 80% of them. If they plan to complete 30 more surveys, what is the maximum number of unfavorable reviews they can afford and still maintain a 75% success rate? A teacher has 60 math worksheets to pass out to her students. There are 12 students in the cla...
def solve() -> int: total_surveys = 100 favorable_reviews = 0.8 * total_surveys additional_surveys = 30 target_success_rate = 0.75 max_favorable_reviews = target_success_rate * (total_surveys + additional_surveys) max_unfavorable_reviews = max_favorable_reviews - favorable_reviews ...
If you add 3 to a number and then triple the result, then that's 4 less than four times the original number. What's the original number?
def solve() -> int: num = 0 result = (num + 3) * 3 result = 4 * num - 4 result = (result + 4) / 4 result = f'<<<{result}>>>' return result
If Maria can finish a puzzle in 1 hour and Lisa can finish the same puzzle in 30 minutes, how long would it take them to finish 3 puzzles together?
def solve() -> int: maria_time = 1 lisa_time = 0.5 total_puzzles = 3 maria_puzzle_time = maria_time * total_puzzles lisa_puzzle_time = lisa_time * total_puzzles total_time = maria_puzzle_time + lisa_puzzle_time result = total_time return result
Amanda is baking cupcakes. She needs to preheat the oven to 350°F, bake the cupcakes for 15 minutes, and let them cool for 5 minutes. How long does the whole baking process take?
def solve() -> int: time_preheat = 0 time_bake = 15 time_cool = 5 total_time = time_preheat + time_bake + time_cool result = total_time return result
Kevin collects stamps from different countries. He has 120 stamps in total, of which 25% are from Canada, 30% are from France, and the rest are from other countries. He wants to arrange his stamps in a rectangular album with 5 rows and 8 columns. How many stamps from other countries will he have in the last row of his ...
def solve() -> int: canada_stamps = 0.25 * 120 france_stamps = 0.3 * 120 other_stamps = 120 - canada_stamps - france_stamps last_row = other_stamps % 8 result = last_row return result
A train travels 200 miles in 4 hours. If it maintains its speed, how long would it take to travel 250 miles?
def solve() -> int: distance_1 = 200 time_1 = 4 distance_2 = 250 speed = distance_1 / time_1 time_2 = distance_2 / speed result = time_2 return result
If 3 workers can paint a house in 6 days, how many workers are needed to paint the same house in 2 days?
def solve() -> int: workers_1 = 3 days_1 = 6 workers_2 = (workers_1 * days_1) / 2 result = workers_2 return result
Student: John had 640 books. He gave away 3/5 of them to his friends. How many books did John keep in his library?
def solve() -> int: books_total = 640 books_given_away = books_total * 3/5 books_kept = books_total - books_given_away result = books_kept return result
Mary has 8 notebooks and 7 binders in her locker. How many pieces of stationery does she have in total?
def solve() -> int: notebooks = 8 binders = 7 total_stationery = notebooks + binders result = total_stationery return result
A swimming pool is 30 feet wide, 60 feet long, and 8 feet deep. If it takes 7.5 gallons of water to fill 1 cubic foot, how many gallons of water are needed to fill the pool?
def solve() -> int: width = 30 length = 60 depth = 8 gallons_per_cubic_foot = 7.5 pool_volume = width * length * depth gallons_needed = pool_volume * gallons_per_cubic_foot result = gallons_needed return result
Student: A school has 500 students. One-third of the students are girls. If 40% of the girls participate in a science fair, how many girls participate?
def solve() -> int: total_students = 500 girl_ratio = 1/3 science_fair_ratio = 0.4 girls = total_students * girl_ratio science_fair_girls = girls * science_fair_ratio result = science_fair_girls return result
Student: Grace wants to make a cake that requires 2/3 cup of milk. She only has 1/4 cup of milk left. If she doesn't want to go to the store, how many times does she need to multiply the recipe to use all of her milk?
def solve() -> int: milk_required = 2/3 milk_left = 1/4 times_multiplied = milk_left / milk_required result = round(times_multiplied) return result
Student: John has twice as many marbles as Peter. If John has 18 marbles, how many marbles does Peter have?
def solve() -> int: john_marbles = 18 peter_marbles = john_marbles / 2 result = peter_marbles return result
John wants to buy three shirts that cost $25 each, two pairs of jeans that cost $50 each and one pair of shoes that costs $75. If he has a coupon that gives him a 25% discount off his total purchase, how much will he pay for his new clothes?
def solve() -> int: num_shirts = 3 shirt_cost = 25 num_jeans = 2 jeans_cost = 50 shoe_cost = 75 subtotal = (num_shirts * shirt_cost) + (num_jeans * jeans_cost) + shoe_cost discount_percent = 0.25 discount_amount = subtotal * discount_percent total_cost = subtotal - discount_amount ...
Sam wants to buy a new laptop, but he doesn't have enough savings. He takes a loan from the bank. The loan agreement states that he should pay the loan back in 2 years. The principal amount is $800 and the interest rate is 7% per annum. What is the total amount Sam will owe after 2 years?
def solve() -> int: principle = 800 rate =.07 time = 2 interest = principle * rate * time total_amount = interest + principle result = total_amount return result
Zelma has 8 stamps, while her brother, Zachary, has 4 more than Zelma. How many stamps does Zachary have?
def solve() -> int: stamps_zelma = 8 stamps_zachary = stamps_zelma + 4 result = stamps_zachary return result
If 25 trousers cost 2000 pesetas, how much would 60 trousers cost?
def solve() -> int: trousers = 60 price_per_trousers = 2000 / 25 total_price = trousers * price_per_trousers result = total_price return result
A group of friends plan to split a cake evenly. If the cake is divided into 16 equal slices, how many slices does each person get if there are 6 people in the group?
def solve() -> int: cake_slices = 16 num_people = 6 slices_per_person = cake_slices / num_people result = slices_per_person return result
Student: Tom invests $5000 for 3 years in a savings account that pays 3% annual compound interest. What is the total amount of money Tom will have after 3 years?
def solve() -> int: principal = 5000 rate = 0.03 time = 3 result = principal * (1 + rate) ** time return result
A gym offers a $15 discount for every month of membership paid in advance with a minimum of 6 months. If Alex paid $240 for a year of membership, how much did he save with the discount?
def solve() -> int: months = 12 min_months = 6 discount = 15 total_cost = 240 if months >= min_months: saved = (months // min_months) * discount result = saved else: result = 0 return result
A rectangle has a perimeter of 30 meters and an area of 56 square meters. What are the dimensions of the rectangle?
def solve() -> int: a = 1 b = -15 c = 56 w = (-b + (b**2 - 4*a*c)**0.5) / (2*a) l = 15 - w result = (l, w) return result
Alex is trying to buy 5 new textbooks, and each costs $25. If Alex already has $95, how much money does he have left?
def solve() -> int: cost = 5 * 25 balance_left = 95 - cost result = balance_left return result
Student: A garden is 12 feet long and 10 feet wide. What is the area of the garden in square feet?
def solve() -> int: length = 12 width = 10 area = length * width result = area return result
Oliver tosses 6 dimes into the wishing pond. Rachel flips 8 quarters into the pond. Dylan throws in 15 nickels. Leo then drops 40 pennies in. If Rachel dips her hands into the water and pulls out three quarters, how much money did they put into the pond?
def solve() -> int: oliver_dimes = 6 rachel_quarters = 8 dylan_nickels = 15 leo_pennies = 40 rachel_quarters_pulled_out = 3 total_money = (oliver_dimes * 0.1) + (rachel_quarters * 0.25) + (dylan_nickels * 0.05) + (leo_pennies * 0.01) pulled_out_money = rachel_quarters_pulled_out * ...
If 6 pens and 8 pencils cost $100, and 4 pens and 8 pencils cost $80, what is the cost of 2 pens and 1 pencil?
def solve() -> int: pen_cost = (100 - 8*15) / 6 pencil_cost = (100 - 6*pen_cost) / 8 total_cost = 2*pen_cost + 1*pencil_cost result = round(total_cost, 2) return result
Jack has a rectangular box that has a length of 12 inches, a width of 8 inches, and a height of 4 inches. He wants to wrap it with a ribbon that has a width of 1 inch. How many inches of ribbon does he need to cover the box completely?
def solve() -> int: side1_perimeter = 12 + 8 + 12 + 8 side2_perimeter = 12 + 4 + 12 + 4 side3_perimeter = 8 + 4 + 8 + 4 ribbon_length = (side1_perimeter + side2_perimeter + side3_perimeter) * 1 result = ribbon_length return result
Aria makes bracelets. She uses 18 beads for each bracelet, and each bead costs 10 cents. If she makes five less than 20 bracelets, how much money does she spend on beads in dollars?
def solve() -> int: bracelets = 20 - 5 beads_per_bracelet = 18 cost_per_bead = 0.10 total_beads = beads_per_bracelet * bracelets total_cost = cost_per_bead * total_beads result = total_cost return result
``` A rectangle has an area of 128 sq units. One of its sides is 4 units. Find the length of the other side.
def solve() -> int: area = 128 side_1 = 4 side_2 = area / side_1 result = side_2 return result
A small store sold 10 apples and 8 oranges each day for a week. How many fruits did the store sell in total?
def solve() -> int: total_fruits = 0 total_fruits = total_fruits + (10 * 7) total_fruits = total_fruits + (8 * 7) result = total_fruits return result
Ken had a bag with 50 marbles. He added 10 more marbles to the bag. If he then removed 15 marbles from the bag, how many marbles were left in the bag?
def solve() -> int: marble_bag = 50 marble_bag += 10 marble_bag -= 15 result = marble_bag return result
Five years ago, there were 100 books in a bookstore. Last year, 50 more books were added to the store. A week ago, 20 more books were added than had been added the previous week. Yesterday, 5 books were sold. How many books are in the store now?
def solve() -> int: books_five_years_ago = 100 books_last_year = books_five_years_ago + 50 books_last_week = books_last_year + 20 books_yesterday = books_last_week - 5 result = books_yesterday return result
In a class of 25 students, each student has a different number of pencils in their pencil case, ranging from 1 to 25. The teacher asks the students to count the total number of pencils in the class. She gives a hint that the sum of the numbers from 1 to 25 is 325. How many pencils are in the class?
def solve() -> int: total_pencils = 325 result = total_pencils return result
An architect draws a plan on a scale of 1:100. If the length of a building on the plan is 5 cm, then what is the actual length of the building?
def solve() -> int: scale_of_drawing = 100 length_on_plan = 5 actual_length = length_on_plan * scale_of_drawing result = actual_length return result
Question X (solution): The answer is... Some possible math questions and python programs are: Sara has 32 red pencils and 48 green pencils. She decides to keep one out of every four red pencils and one out of every six green pencils for herself, and donate the rest to her school. How many pencils does she donate in tot...
def solve() -> int: red_keep = 32 // 4 green_keep = 48 // 6 red_donate = 32 - red_keep green_donate = 48 - green_keep total_donate = red_donate + green_donate result = total_donate return result
Mark wanted to redesign his website, so he promised his developer $100 for every new feature added and $200 for every bug fixed. If the developer fixes at least two critical bugs, they'll receive a flat $500 for each critical bug fixed (with no extra bonus). If there are 30 features and 10 bugs that need to be addresse...
def solve() -> int: features = 30 bugs = 10 feature_bonus = 100 bug_bonus = 200 critical_bug_bonus = 500 total_feature_bonus = features * feature_bonus total_bug_bonus = bugs * bug_bonus if bugs >= 2: total_critical_bug_bonus = bugs * critical_bug_bonus else: ...
Student: A soccer team played 12 games and only lost 2. What percent of their games did they win?
def solve() -> int: games_played = 12 games_lost = 2 games_won = games_played - games_lost percent_won = games_won / games_played * 100 result = percent_won return result
Tom works as a landscaper for 4 days a week earning $30 per day. If he finishes more than 4 gardens in a day, he gets an extra $20. This week he finished 18 gardens in total. How much did he earn this week?
def solve() -> int: days_per_week = 4 earnings_per_day = 30 extra_earnings_per_garden = 20 total_gardens = 18 base_earnings = days_per_week * earnings_per_day extra_earnings = (total_gardens - days_per_week) * extra_earnings_per_garden total_earnings = base_earnings + extra_earning...
Tyler spends $15 every day on coffee. If he wants to save $100, how many days will he have to go without buying coffee?
def solve() -> int: coffee_cost = 15 savings_goal = 100 days_without_coffee = savings_goal / coffee_cost result = days_without_coffee return result
A gardener planted 50 flowers in his garden. He gave out 35 flowers to his friends as gifts. After that, the gardener planted 20 more flowers. How many flowers are there in the garden now?
def solve() -> int: flowers_in_garden = 50 flowers_given_out = 35 flowers_planted = 20 flowers_in_garden = flowers_in_garden - flowers_given_out flowers_in_garden = flowers_in_garden + flowers_planted result = flowers_in_garden return result
Tom got a bonus of $300. He decides to spend $70 on a new soccer ball and a third of that amount on snacks. What is the amount left with him?
def solve() -> int: bonus = 300 soccer_ball_cost = 70 snacks_cost = soccer_ball_cost / 3 amount_left = bonus - (soccer_ball_cost + snacks_cost) result = amount_left return result
A school has 20 boys and 15 girls in a class. If a committee of 3 students is chosen at random, what is the probability that all 3 students are girls?
def solve() -> int: total_students = 35 girls = 15 girls_probability = girls / total_students all_girls_probability = (girls/total_students)*((girls-1)/(total_students-1))*((girls-2)/(total_students-2)) result = all_girls_probability return result
On a 50-question multiple choice test, each question is worth 2 points. If Lisa received a score of 76%, how many questions did she answer correctly?
def solve() -> int: num_questions =... points_per_question =... percent_score =... num_correct =... result =... return result
David wants to make a vegetable soup and needs to buy 7 pounds of potatoes, 4 pounds of carrots, and 2 pounds of onions. Potatoes cost $0.50 per pound, carrots cost $1.00 per pound, and onions cost $2.00 per pound. What is the total cost of the vegetables for the soup?
def solve() -> int: potatoes = 7 carrots = 4 onions = 2 potatoes_cost = potatoes * 0.5 carrots_cost = carrots * 1.0 onions_cost = onions * 2.0 total_cost = potatoes_cost + carrots_cost + onions_cost result = total_cost return result
Kelly can buy a new camera for $600 and have it last 7 years, or buy a used camera for $250 that lasts 3 years and a new camera for $350 that lasts 4 years. How much money will she save by picking the cheaper option?
def solve() -> int: total_cost_new = 600 total_cost_used = 250 + 350 years_new = 7 years_used = 3 + 4 cost_per_year_new = total_cost_new/years_new cost_per_year_used = total_cost_used/years_used if cost_per_year_new < cost_per_year_used: cost_savings = cost_per_year_used * years_used...
Jill got a 72 on her math test, which is 60% of the total score. What was the total score of the math test?
def solve() -> int: score_percentage = 60 score = 72 total_score = score / (score_percentage / 100) result = total_score return result
Student: Dan planted some flowers in his garden. 2/5 of them are daffodils, and 3/8 are daisies. If there are 60 total flowers, how many tulips are there?
def solve() -> int: daffodils = 0 daisies = 0 tulips = 0 total_flowers = 60 daffodils = total_flowers * 2/5 daisies = total_flowers * 3/8 tulips = total_flowers - daffodils - daisies result = tulips return result
Possible questions and programs are: On carnival day, one third of the kids who came to the park wore masks. Of those kids who wore masks, two fifths wore animal masks. There were twice as many kids wearing clown masks as were wearing animal masks. If 300 kids came to the park that day, how many wore clown masks?
def solve() -> int: mask_kids = 300 / 3 animal_kids = mask_kids * 2 / 5 clown_kids = animal_kids * 2 result = clown_kids return result
A recipe calls for 3/4 cup of sugar to make 12 cookies. If Sarah wants to make 36 cookies, how much sugar does she need?
def solve() -> int: cookies_needed = 36 sugar_needed_per_12 = 3/4 sugar_needed = sugar_needed_per_12/12 * cookies_needed result = sugar_needed return result
Jack has three times as many pencils as there are clubs of the same color in a standard deck of 52 playing cards. If there are 9 clubs in a card, calculate the total cost of the pencils when Jack bought them at $2.25 each.
def solve() -> int: clubs_on_card = 9 cost_per_pencil = 2.25 num_cards = 52 num_clubs = num_cards * clubs_on_card num_pencils = num_clubs * 3 cost = num_pencils * cost_per_pencil result = cost return result
A fruit seller has 80 apples and 20 more bananas than apples. How many bananas does he have?
def solve() -> int: apples = 80 bananas = apples + 20 result = bananas return result
A company sold 3456 products in the last month. Out of them, 45% were phones and the rest were laptops. How many laptops were sold by the company in the last month?
def solve() -> int: total_products = 3456 phones_percentage = 45 phones_sold = (phones_percentage / 100) * total_products laptops_sold = total_products - phones_sold result = laptops_sold return result
A swimming pool has a length of 30 meters and an area of 900 square meters. How many swimming pools of the same area would have a width of 60 meters?
def solve() -> int: length = 30 area = 900 width = 60 pool_area = length * width num_pools = area / pool_area result = num_pools return result
A pack of pencils contains 12 pencils. If a classroom needs 100 pencils, how many packs do they need to buy?
def solve() -> int: packs = 100 / 12 result = int(packs) if packs.is_integer() else int(packs) + 1 return result
A rectangular pool is twice as long as it is wide. If the pool has a perimeter of 24 meters, what are its dimensions?
def solve() -> int: width = 2 length = 2*width perimeter = 2*(length+width) eq = perimeter - 24 w = eq/2 l = 2*w result = (w, l) return result
am can run at a pace of 7 minutes per mile. If he runs for 3 hours straight, how far can he run?
def solve() -> int: pace = 7 time = 180 / pace result = time return result
Nancy has a jar that contains 32 pink candies and 40 purple candies. She eats 1/8 of the pink candies and 1/5 of the purple candies. How many candies in total did Nancy eat?
def solve() -> int: pink_eaten = 32 / 8 purple_eaten = 40 / 5 total_eaten = pink_eaten + purple_eaten result = total_eaten return result
Omar has 30 seashells, but he used to have more. Omar gave his teacher 60 seashells, gave his best friend a fifth of that amount, and gave his neighbor Amy nine times the amount he currently has. How many seashells did Omar start with?
def solve() -> int: seashells_start = 30 seashells_given_teacher = 60 seashells_given_friend = seashells_given_teacher / 5 seashells_given_neighbor = seashells_start - seashells_given_teacher - seashells_given_friend seashells_start = seashells_given_neighbor / 9 result = seashells_start ...
Tom and Louis were playing a game and at the end of the game, they had 35 points each. If Tom had 7 more points than Louis, how many points did Tom have?
def solve() -> int: total_points = 35 points_difference = 7 points_tom = total_points + points_difference result = points_tom return result
John went to a hardware store to buy some tools. He bought 2 hammers for $15.00 each, 3 saws for $25.00 apiece, and some screws for $10.00. The store was offering a 10% discount on all purchases that day. John had a coupon for 15% off that would apply after all other discounts. How much did John spend on his tools and ...
def solve() -> int: hammer_price = 15.00 saw_price = 25.00 screw_price = 10.00 num_hammers = 2 num_saws = 3 total_hammer_cost = hammer_price * num_hammers total_saw_cost = saw_price * num_saws total_screw_cost = screw_price subtotal = total_hammer_cost + total_saw_cost...
David is making lemonade for a party. He has a recipe that uses 8 lemons and 4 cups of sugar to make 2 liters of lemonade. He wants to make 12 liters of lemonade and he has 30 lemons and 15 cups of sugar. How many lemons and cups of sugar will he use and how many will he have left?
def solve() -> int: times = 12 / 2 lemons_needed = 8 * times sugar_needed = 4 * times lemons_left = 30 - lemons_needed sugar_left = 15 - sugar_needed result = (lemons_needed, sugar_needed, lemons_left, sugar_left) return result
James has 24 stickers to share with his friends. He gave 6 stickers to Alice, 4 stickers to Bob, and 8 stickers to Claire. How many stickers does James have left for himself?
def solve() -> int: stickers = 24 alice = 6 bob = 4 claire = 8 stickers_given = alice + bob + claire stickers_left = stickers - stickers_given result = stickers_left return result
John has $300 in his wallet. If he spends $50 a day, how much money will he have left after 1 week?
def solve() -> int: wallet = 300 daily_spending = 50 days_in_a_week = 7 total_spending = daily_spending * days_in_a_week money_left = wallet - total_spending result = money_left return result
Tyler bought 9 cans of food for a total of $63. If 4 of the cans cost the same amount and the remaining 5 cost $7 each, how much did one of the same priced cans cost?
def solve() -> int: total = 63 no_same_items = 4 price_same_items = (total - (no_same_items*7))/no_same_items result = price_same_items return result
A square has a side length of 10 units. What is the area of the square?
def solve() -> int: side_length = 10 square_area = side_length ** 2 result = square_area return result
There are a total of 18 scoops of ice cream in a bowl. How many scoops of ice cream does each guest get if the bowl is divided among 3 guests?
def solve() -> int: total_scoops = 18 number_guests = 3 result = total_scoops / number_guests return result
Bob saved $20 a month for 7 years for his retirement. He has to spend $1000 from his retirement savings to pay his car loan. If he has $2600 left, how much money did he save in total?
def solve() -> int: total_saved = 0 monthly_savings = 20 year = 7 expenses = 1000 left = 2600 total_saved = monthly_savings * 12 * year total_spent = expenses final_total = total_saved - total_spent + left result = final_total return result
Leo paints 6 houses. 2 of the houses take 3 hours each to paint. The other 4 take 20% more time each to paint. He charges $25 per hour for painting. How much money does he make?
def solve() -> int: houses = 6 fast_paint = 2 slow_paint = 4 fast_time = 3 slow_time = fast_time * 1.2 rate = 25 total_time = fast_paint * fast_time + slow_paint * slow_time total_money = total_time * rate result = total_money return result
Student: Emma bought 5 bags of apples, each weighing 2 kg. She then bought 3 more bags of apples, each weighing 3 kg. What is the total weight of the apples she bought?
def solve() -> int: bags_1 = 5 weight_1 = 2 bags_2 = 3 weight_2 = 3 total_weight = bags_1 * weight_1 + bags_2 * weight_2 result = total_weight return result
A pizza is cut into 8 slices. If you eat 3 slices, what fraction of the entire pizza have you eaten?
def solve() -> int: num_slices = 8 slices_eaten = 3 fraction_eaten = slices_eaten / num_slices result = fraction_eaten return result
Olivia, Emma, and Jack collect Pokemon cards. Olivia had 36 cards in her collection, Emma had 21 cards in her collection, and Jack had 42 cards in his collection. Emma gave Olivia a third of her collection in exchange for a Pikachu card, and then Olivia traded Jack four fire type cards for six water type cards. How man...
def solve() -> int: olivia_cards = 36 emma_cards = 21 jack_cards = 42 olivia_cards += emma_cards / 3 emma_cards -= emma_cards / 3 olivia_cards -= 4 jack_cards -= 6 olivia_cards += 4 jack_cards += 6 result = olivia_cards return result
Lila is 5 years old. Her older brother, Max, is 8 years older than her and 7 years younger than their older sibling, Ava. How old will Ava be when Lila reaches Max's current age?
def solve() -> int: lila_age = 5 max_age = lila_age + 8 ava_age = max_age + 7 age_difference = max_age - lila_age ava_age_when_lila_reaches_max = ava_age + age_difference result = ava_age_when_lila_reaches_max return result
A farmer is planting crops in a field. The farmer has planted twelve rows already to make a field. For each row planted, he wants to plant five more rows to finish the field. He knows a farmer that has planted a third of the rows he needs. How many rows will the farmer still need to plant to finish the field?
def solve() -> int: planted_rows = 12 total_rows = (planted_rows + 5) * 3 other_farmer_rows = total_rows / 3 remaining_rows = total_rows - other_farmer_rows - planted_rows result = remaining_rows return result
In a game store, a game costs 20 dollars, but there is a discount that applies every day, decreasing the price of the game by 2 dollars. How many days will it take for the game to cost 10 dollars?
def solve() -> int: game_cost = 20 discount = 2 num_days = (game_cost - 10) // discount result = num_days return result
In 6 years, Alex will be half as old as Sam. If Sam is currently 16, how old is Alex?
def solve() -> int: sam_age = 16 alex_age_in_6_years = (sam_age * 2) - 6 alex_age = alex_age_in_6_years - 6 result = alex_age return result
Emma is baking cookies. It takes 10 cups of flour and 5 cups of sugar to make one batch of cookies. Each of her 4 helpers can measure 3 cups of ingredients per hour and will work for 4 hours today. How many batches of cookies can Emma bake with the ingredients measured today, provided that the ratio of flour to sugar i...
def solve() -> int: flour_per_batch = 10 sugar_per_batch = 5 helpers = 4 cups_per_hour = 3 hours_worked = 4 flour_to_sugar_ratio = 2/1 total_cups = helpers * cups_per_hour * hours_worked total_flour = total_cups * (2/3) * flour_to_sugar_ratio total_sugar = total_cups * (1/3) * f...
4. Harold and Henry are sharing the cost of pizza. If Harold pays $9 and Henry pays $7.50, how much did the pizza cost?
def solve() -> int: costHaroldPay = 9 costHenryPay = 7.50 totalCostPizza = costHaroldPay + costHenryPay result = totalCostPizza return result
Student: A hotel charges $80 per night plus an additional $10 per day for the use of its swimming pool. If Jim stayed at the hotel for 3 days, how much did he have to pay in total?
def solve() -> int: price_per_night = 80 price_per_day_for_pool = 10 days_stayed = 3 total_cost = price_per_night * days_stayed + price_per_day_for_pool * days_stayed result = total_cost return result
Alice and Bob are sharing a pizza that has 12 slices. Alice eats 3 slices and Bob eats 4 slices. Then, they decide to give away 2 slices to their neighbor. If the neighbor gives them back 1/4 of a slice as a thank you, how much pizza do Alice and Bob have left in total?
def solve() -> int: alice_eats = 3 bob_eats = 4 give_away = 2 receive_back = 1/4 total_slices = 12 left_slices = total_slices - (alice_eats + bob_eats + give_away) + receive_back result = left_slices return result
Jane has 30 marbles, 6 of them are red and 4 of them are green. What is the ratio of red to green marbles?
def solve() -> int: total_marbles = 30 red_marbles = 6 green_marbles = 4 red_green_ratio = red_marbles / green_marbles result = red_green_ratio return result
At a wedding reception, there are 100 guests. If each guest will have 2 glasses of soda and each bottle of soda can fill up 10 glasses, how many bottles of soda should be ordered?
def solve() -> int: num_guests = 100 num_glasses_per_guest = 2 total_glasses = num_guests * num_glasses_per_guest num_glasses_per_bottle = 10 num_bottles = total_glasses // num_glasses_per_bottle + 1 result = num_bottles return result
Student: Omar had two cartons of eggs. In the first carton, there were 18 eggs and in the second there were 22 eggs. How many eggs did Omar have in total?
def solve() -> int: eggs_in_first = 18 eggs_in_second = 22 total_eggs = eggs_in_first + eggs_in_second result = total_eggs return result
A mail-order company sold 1500 gift baskets last month. If 1% of customers returned their baskets, how many were returned?
def solve() -> int: total_baskets = 1500 return_percentage = 0.01 returned_baskets = total_baskets*return_percentage result = returned_baskets return result
Anna baked 15 pies for a fundraiser. She sold one-fifth of them for $10 each, one-third of them for $12 each, and one-half of the remaining pies for $15 each. How much money did she make from selling those pies?
def solve() -> int: pies_10 = 0.2 * 15 pies_12 = 0.33 * 15 pies_remaining = 15 - pies_10 - pies_12 pies_15 = 0.5 * pies_remaining revenue_10 = pies_10 * 10 revenue_12 = pies_12 * 12 revenue_15 = pies_15 * 15 result = revenue_10 + revenue_12 + revenue_15 return result
Abigail went to the mall with $80 and spent 3/5 of it on shoes. She spent the rest of it on snacks. How much money did she spend on shoes?
def solve() -> int: money = 80 shoes = money * 3/5 result = shoes return result
Student: If the bus fare of 2 adults and 3 children is $8.45, how much would it cost for 4 adults and 2 children?
def solve() -> int: adults = 2 children = 3 cost_2_adults_3_children = adults * 2.50 + children * 1.25 adults = 4 children = 2 cost_4_adults_2_children = adults * 2.50 + children * 1.25 result = cost_4_adults_2_children - cost_2_adults_3_children return result
A recipe calls for 2 cups of flour for 12 pancakes. How much flour is needed to make 30 pancakes?
def solve() -> int: pancakes_needed = 30 pancakes_given = 12 flour_given = 2 flour_needed = (flour_given/pancakes_given)*pancakes_needed result = flour_needed return result
Student: Aurora has been investing in bonds for 6 months. She started with an initial sum of 700 USD, increased it by 24.2% for the first 2 months, decreased it by 1/3 of the sum she had from the 2nd period for the 3rd period, and in the fourth month she further increased it by 40% of the sum she had after the 3rd peri...
def solve() -> int: initial_sum = 700 increase_1 = initial_sum * 0.242 sum_after_2_months = initial_sum + increase_1 decrease_2 = sum_after_2_months / 3 sum_after_3_months = sum_after_2_months - decrease_2 increase_3 = sum_after_3_months * 0.4 sum_after_4_months = sum_after_3_months + increa...
Andrew has 12 pencils. His brother has half as many pens as Andrew has pencils. His brother has one blue pen, one red pen, and the rest are pens. How many pens does Andrew's brother have?
def solve() -> int: pencils = 12 pens = pencils / 2 brother_pens = pens - 2 result = brother_pens return result
Student: John wants to invest 2000 dollars at an annual interest rate of 6%. How much interest will he earn in 5 years?
def solve() -> int: principal = 2000 interest_rate = 0.06 time = 5 interest = principal * interest_rate * time total_amount = principal + interest result = total_amount return result
If a bicycle traveled 64 km in 4 hours, how long will it take to travel 128 km?
def solve() -> int: distance_1 = 64 time_1 = 4 distance_2 = 128 time_2 = (distance_2 / distance_1) * time_1 result = time_2 return result
Lily and Sam shared a pizza that was cut into 8 slices. Lily ate 3 slices and Sam ate 2 slices. They then decided to split the remaining slices equally. How many slices did each of them get?
def solve() -> int: total_slices = 8 remaining_slices = total_slices - 3 - 2 slices_per_person = remaining_slices / 2 result = slices_per_person return result
A water tank can be filled by pipe A in 6 hours and by pipe B in 4 hours. If the tank can hold 150 liters of water, how many liters of water will be filled in 2 hours by both pipes working together?
def solve() -> int: capacity = 150 A_rate = capacity/6 B_rate = capacity/4 combined_rate = A_rate + B_rate time = 2 combined_work = combined_rate*time result = combined_work return result
Student: A watermelon weighs 7 kilograms. If a quarter of its weight is the weight of its seeds, how heavy are the seeds?
def solve() -> int: watermelon_weight = 7 seed_weight = watermelon_weight / 4 result = seed_weight return result
Possible questions and programs: Kim has 300 yards of ribbon. She wants to decorate a rectangular cake that is 12 inches by 18 inches. How much ribbon will Kim have left over after covering the perimeter of the cake once?
def solve() -> int: cake_width = 12 / 36 cake_length = 18 / 36 cake_perimeter = 2 * (cake_width + cake_length) ribbon_left = 300 - cake_perimeter result = ribbon_left return result
Lena started counting books on the third floor of a library. She then went up 2 floors then went down 1 floor. She again went up 4 floors and found that she is 2 floors away from the top of the library. How many books did she count in total if there are 30 books on each floor?
def solve() -> int: start = 3 up1 = 2 down1 = 1 up2 = 4 away = 2 books = 30 current = start + up1 - down1 + up2 total = current + away counted = (start + up1 + down1 + up2) * books result = counted return result
An aquarium has 4 tanks with 10 fish each, and 3 tanks with 8 fish each. How many fish are in the aquarium in total?
def solve() -> int: small_tanks = 4 large_tanks = 3 small_tank_fish = 10 large_tank_fish = 8 total_fish = (small_tanks * small_tank_fish) + (large_tanks * large_tank_fish) result = total_fish return result
If a train travels 300 miles in 4 hours, how fast is it going in miles per hour?
def solve() -> int: distance = 300 time = 4 speed = distance / time result = speed return result
Harry organized a cookie sale and sold 100 cookies with 6 pieces each for a local community kitchen. If each piece sold for $0.50, and a local business owner donated $0.25 for each piece sold, how much money did he raise in total?
def solve() -> int: cookies_sold = 100 pieces_per_cookie = 6 price_per_piece = 0.50 donation_per_piece = 0.25 total_pieces_sold = cookies_sold * pieces_per_cookie total_money_raised = total_pieces_sold * price_per_piece total_donation = total_pieces_sold * donation_per_piece to...