question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A bus covers 80% of its route in 40 minutes. How long does it take to complete the whole route at the same speed?
def solve() -> int: percentage = 0.8 minutes1 = 40 route = 1 distance1 = percentage * route speed = distance1 / minutes1 distance2 = route minutes2 = distance2 / speed result = minutes2 return result
The speed of sound in air is 343 meters per second. A thunderstorm is 2 kilometers away from a person. How long does it take for the person to hear the thunder after seeing the lightning?
def solve() -> int: speed = 343 distance = 2000 result = distance / speed return result
Amy saved $600 in January and $800 in February. If she saves $110 each month, how much money will she have saved in a year?
def solve() -> int: jan_savings = 600 feb_savings = 800 monthly_savings = 110 year_savings = (jan_savings + feb_savings) + (10 * monthly_savings) result = year_savings return result
Yoko has 90 feet of rope that she wants to cut it into smaller pieces first. If she cuts it into 18 equal length pieces, but then realizes it's too short, how many pieces of these pieces should she tie together if each knot shortens it by 3 inches?
def solve() -> int: rope_length = 90 * 12 piece_length = rope_length / 18 knot_shortening = 3 pieces_needed = rope_length / (piece_length - knot_shortening) result = int(pieces_needed) return result
A store is having a sale with 20% off all items. A shirt costs $25. How much is the discounted price of the shirt?
def solve() -> int: original_price = 25 discount_rate = 0.2 discount = original_price * discount_rate discounted_price = original_price - discount result = discounted_price return result
Jack wants to buy a car that costs $6,500. He has $7,100 saved up. He also needs to pay a registration fee of $200, a sales tax of $400, and an insurance fee of $800. How much money will he have left after he buys the car?
def solve() -> int: money_saved = 7100 car_cost = 6500 registration_fee = 200 sales_tax = 400 insurance_fee = 800 total_cost = car_cost + registration_fee + sales_tax + insurance_fee money_left = money_saved - total_cost result = money_left return result
Student: If 2 pounds of sugar can make 20 cookies, how much sugar is needed for 100 cookies?
def solve() -> int: sugar_per_pound = 2 cookies = 20 target_cookies = 100 sugar_per_cookie = sugar_per_pound / cookies sugar_needed = sugar_per_cookie * target_cookies result = sugar_needed return result
Wendy invests $15,000 in a savings account with an annual interest rate of 3.5%. Calculate the interest she will earn in 2 years.
def solve() -> int: interest = 15000 * (0.035 * 2) result = interest return result
Maya has a rectangular garden that measures 15 meters by 12 meters. She wants to plant roses along the perimeter of the garden. Each rose plant needs 0.5 meters of space. How many rose plants can Maya plant?
def solve() -> int: length = 15 width = 12 perimeter = (length + width) * 2 space_per_rose = 0.5 rose_plants = perimeter / space_per_rose result = rose_plants return result
At a store, a jacket is on sale for $60, marked down from the original price of $100. What is the percentage discount?
def solve() -> int: original_price = 100 sale_price = 60 discount = (original_price - sale_price) / original_price * 100 result = discount return result
A new ice cream business makes $2 million in sales each of the first 6 months. If their monthly operating costs are $250,000, what is their net profit at the end of the 6 months?
def solve() -> int: operating_costs = 250000 sales = 2000000 total_income = 6 * sales net_profit = total_income - (6 * operating_costs) result = net_profit return result
Student: The area of a triangle is 24 square units and its height is 8 units. What is the length of its base?
def solve() -> int: area = 24 height = 8 base = area / height result = base return result
Sarah has 7 baskets of flowers. One contains 5 flowers, one contains 9 flowers, one contains 12 flowers, one contains 15 flowers, one contains 18 flowers, one contains 20 flowers, and one contains 25 flowers. She combines the basket with 5 flowers with another basket, and the new basket now has 19 flowers. She then com...
def solve() -> int: basket1 = 5 basket2 = 9 basket3 = 12 basket4 = 15 basket5 = 18 basket6 = 20 basket7 = 25 new_basket = basket1 + basket2 if new_basket == 19: larger_basket = basket3 + basket4 + basket5 + basket6 + basket7 result = larger_basket else: ...
Student: A semi-circular garden has a radius of 5 meters. What is the area of the garden?
def solve() -> int: radius = 5 pi = 3.14 area = pi * radius**2 result = area return result
In a dance competition, Team A has won four times as many rounds as Team B. If both teams competed in ten rounds and lost three each, how many rounds has Team A won?
def solve() -> int: team_b_rounds = 10 - 3 team_a_rounds = 4 * team_b_rounds result = team_a_rounds return result
After pulling a muscle, Michael decided to rest for 2 days. He knew it would take 7 times that long to fully recover, and then he would wait an additional 5 days before exercising again. If he wants to wait 4 weeks before playing sports, how long until he can return to the field?
def solve() -> int: rest_days = 2 recovery_days = rest_days * 7 additional_days = 5 total_days = rest_days + recovery_days + additional_days weeks = 4 return_days = weeks * 7 remaining_days = return_days - total_days result = remaining_days return result
The ratio of boys to girls in a class is 3:4. If there are 15 boys in the class, how many students are there in total?
def solve() -> int: boys = 15 girl_to_boy_ratio = 4/3 total_students = boys + boys*girl_to_boy_ratio result = total_students return result
Sally can paint a fence in 4 hours while John can paint the same fence in 6 hours. If they both work together for 2 hours, how much of the fence will be painted?
def solve() -> int: sally_rate = 1/4 john_rate = 1/6 time = 2 work_done = (sally_rate + john_rate) * time result = work_done return result
Ben has a jar with 40 marbles. He takes out 5 marbles at random and puts them in his pocket. He then adds 7 new marbles to the jar. What is the probability that he picks a new marble from the jar?
def solve() -> int: jar = 40 pocket = 5 jar = jar - 5 pocket = pocket + 5 jar = jar + 7 probability = 7 / jar result = probability return result
A box contains one dozen of apples and six oranges. If the contents of the box are mixed thoroughly and three pieces of fruit are picked at random. What is the probability that two of them are apples and one is an orange?
def solve() -> int: apples = 12 oranges = 6 total_fruits = apples + oranges prob_2a1o = (apples/total_fruits) * ((apples-1)/(total_fruits-1)) * (oranges/ (total_fruits-2)) result = prob_2a1o return result
Thomas pours 1 cup of milk per serving of cereal for breakfast. He usually has 2 servings of cereal per day. He buys his milk in a 64-ounce carton. If there are 8 servings of milk per ounce, how many days will he be able to pour milk on his cereal?
def solve() -> int: cereal_servings_per_day = 2 milk_carton_ounces = 64 servings_per_ounce = 8 total_servings = cereal_servings_per_day * milk_carton_ounces * servings_per_ounce days = total_servings / cereal_servings_per_day result = days return result
A store is having a 20% discount on all items. A shirt originally costs $40. What is the new price of the shirt?
def solve() -> int: original_price = 40 discount = 0.2 * original_price new_price = original_price - discount result = new_price return result
Mia has $80; Leo has $52; and Ava has $39. Mia owed Leo $20. Leo owed Ava $13. Ava owed Mia $27. What is the total amount of money Mia and Ava will have when all debts have been paid?
def solve() -> int: mia_money = 80 leo_money = 52 ava_money = 39 mia_owe_leo = 20 leo_owe_ava = 13 ava_owe_mia = 27 mia_money -= mia_owe_leo leo_money += mia_owe_leo leo_money -= leo_owe_ava ava_money += leo_owe_ava ava_money -= ava_owe_mia mia_money +...
Olivia wants to make a necklace out of beads. She wants the necklace to be 24 inches long. Each bead is 1/2 inch long and she wants to add an additional 2 inches for the clasp. How many beads does Olivia need to buy?
def solve() -> int: bead_length = 0.5 clasp_length = 2 necklace_length = 24 total_length = necklace_length - clasp_length beads_needed = total_length / bead_length result = int(beads_needed) return result
A high school has 840 students and 350 of them are girls. What percentage of the students are boys?
def solve() -> int: total_students = 840 girls = 350 boys = total_students - girls percent_boys = (boys/total_students) * 100 result = percent_boys return result
Student: In Jenny's house, there are 24 windows; 3 of which are open. What fraction of the windows are open?
def solve() -> int: windows = 24 open_windows = 3 result = open_windows / windows return result
Sarah and her cousin are having a badminton smash contest. They each get to hit the shuttlecock 15 times. Smashes in the forecourt area are worth 1 point, smashes in the midcourt area are worth 2 points, and smashes in the backcourt area are worth 3 points. Sarah makes 6 points in the forecourt area, 5 points in the mi...
def solve() -> int: sarah_forecourt = 6 sarah_midcourt = 5 sarah_backcourt = 2 cousin_midcourt = 10 sarah_total = sarah_forecourt * 1 + sarah_midcourt * 2 + sarah_backcourt * 3 cousin_total = cousin_midcourt * 2 points_difference = sarah_total - cousin_total result = point...
- Leo is saving money for a new laptop. He earns $15 per hour from his part-time job. He spends $10 per day on food and transportation. He already has $200 in his savings account. The laptop costs $800. How many hours does he need to work to buy the laptop?
def solve() -> int: hourly_rate = 15 daily_expense = 10 current_savings = 200 laptop_price = 800 money_needed = laptop_price - current_savings daily_savings = hourly_rate - daily_expense days_needed = money_needed / daily_savings hours_needed = days_needed * hourl...
Leo has a jar of 50 marbles. He takes out 12 marbles and gives them to his sister. Then he takes out 20% of the remaining marbles and trades them for some candy. How many marbles does Leo have left in the jar?
def solve() -> int: marbles = 50 marbles = marbles - 12 trade = 0.2 * marbles marbles = marbles - trade result = marbles return result
In a factory, there are 7 machines that can produce 12 units per hour. If the factory runs for 8 hours a day, how many units can be produced in a day?
def solve() -> int: units_per_machine = 12 * 8 total_units = units_per_machine * 7 result = total_units return result
Joseph wants to buy a new gaming PC that costs $1500. He currently has $300 in his savings account. He can save $60 per week from his allowance and earn $50 a week from his part-time job. How many weeks will he have to work to save enough to get the gaming PC?
def solve() -> int: cost_of_pc = 1500 savings_account = 300 allowance_savings = 60 part_time_income = 50 total_weekly_savings = allowance_savings + part_time_income weeks_needed = (cost_of_pc - savings_account) / total_weekly_savings result = weeks_needed return result
David climbs up 6 floors of a building. Each floor is 14 feet tall. He then climbs a fence that is one-half the height of each floor. Finally, he climbs a ladder that is 20 feet longer than the fence. How high up did he go?
def solve() -> int: floor_height = 14 num_floors = 6 total_floor_height = floor_height * num_floors fence_height = floor_height / 2 ladder_height = fence_height + 20 total_height = total_floor_height + fence_height + ladder_height result = total_height return result
Student: Marcus has a collection of 48 stamps. He sells 25% of his stamps and replaces them with 50% more than before. How many stamps does Marcus have now?
def solve() -> int: stamps = 48 sold_stamps = stamps * 0.25 new_stamps = stamps + (stamps * 0.5) result = new_stamps - sold_stamps return result
A car travels at a speed of 60 miles per hour. How far will it travel in 2.5 hours?
def solve() -> int: distance = 60 * 2.5 result = distance return result
Student: Alex drives his car for 125 miles, and his car consumes 5 gallons of fuel per 100 miles. How many gallons of fuel will he need to complete the trip?
def solve() -> int: distance = 125 fuel_consumption = 5/100 fuel_needed = distance * fuel_consumption result = fuel_needed return result
Jennifer is running a delivery service that has two different routes. Route P takes 8 hours to deliver the products to the customers, while route Q takes only 3 hours. By how many hours can Jennifer save her time if she chooses route Q for deliveries and back to her distribution center?
def solve() -> int: p_time = 8 q_time = 3 time_saved = p_time - q_time result = time_saved return result
A book store has 3 shelves labeled A, B and C. At 11:00 PM, shelf A had $40 more money than shelf B, which had twice as money as shelf C. If there was $20 on shelf C, how much money was there on all the shelves?
def solve() -> int: a = 20 b = a * 2 c = b + 40 result = a + b + c return result
A farmer had 200 oranges in the basket to be given to his kids. Out of the 60 kids, only 70% were allowed to take oranges. Each kid took 4 oranges. How many oranges remained untouched?
def solve() -> int: kids = 60 total_oranges = 200 allowed_percentage = 70 oranges_taken_per_kid = 4 allowed_kids = (allowed_percentage / 100) * kids total_oranges_taken = allowed_kids * oranges_taken_per_kid oranges_remaining = total_oranges - total_oranges_taken result = orang...
A laptop is sold for $1200 at a 20% discount. What is the original price of the laptop?
def solve() -> int: sale_price = 1200 discount_percent = 0.2 original_price = sale_price / (1 - discount_percent) result = original_price return result
In a salad-making process, a cook mixes 2/5th of 25 grams of lettuce with 3/7th of 21 grams of carrot. How many grams of the mixture are obtained?
def solve() -> int: lettuce_fraction = 2/5 carrot_fraction = 3/7 lettuce_amount = lettuce_fraction * 25 carrot_amount = carrot_fraction * 21 mixture_amount = lettuce_amount + carrot_amount result = mixture_amount return result
Tom is making a model pyramid. He wants to add three triangular faces: one that's 4 inches at the base and 10 inches high, one is 7 inches at the base and 12 inches high and the other one is 5 inches at the base and 8 inches high. How many square inches of paper does he need to cover the pyramid?
def solve() -> int: base1 = 4 height1 = 10 area1 = 0.5 * base1 * height1 base2 = 7 height2 = 12 area2 = 0.5 * base2 * height2 base3 = 5 height3 = 8 area3 = 0.5 * base3 * height3 total_area = area1 + area2 + area3 result = total_area return result
In a class of 30 students, the average score is 72. If the teacher's score is included, the average becomes 74. What is the teacher's score?
def solve() -> int: total_students = 30 avg_score = 72 new_avg_score = 74 teacher_score = (total_students * new_avg_score) - (total_students - 1) * avg_score result = teacher_score return result
Student: Laura is collecting stamps. She buys 5 stamps for $2 each, and she sells 3 stamps for $3 each. She also receives 2 stamps as gifts. How much money does she have left after her transactions, if she started with $20?
def solve() -> int: stamps_bought = 5 price_bought = 2 stamps_sold = 3 price_sold = 3 stamps_gifted = 2 money_start = 20 money_spent = stamps_bought * price_bought money_earned = stamps_sold * price_sold money_left = money_start - money_spent + money_earned result = money_left ...
A salon decides to stop offering haircuts and start offering facials instead. When they offeredMr. Johnson has a box of 15 apples. He bought 6 more boxes with the same number of apples in each box. How many apples does Mr. Johnson have in total?
def solve() -> int: num_boxes = 6 apples_per_box = 15 total_apples = (num_boxes + 1) * apples_per_box result = total_apples return result
At the beach, there are 40 seashells and 15 starfish. If 10 seashells are taken away, what percentage of objects are starfish now?
def solve() -> int: seashells = 40 starfish = 15 seashells -= 10 total_objects = seashells + starfish percentage_starfish = (starfish / total_objects) * 100 result = percentage_starfish return result
Student: Suzy has 6 art books and 2 coloring books. She has twice as many coloring books as art books. Also, she has 4 more magazines than coloring books. How many books does Suzy have?
def solve() -> int: art_books = 6 coloring_books = 2 coloring_books = art_books * 2 magazines = coloring_books + 4 result = art_books + coloring_books + magazines return result
What is the total amount of water used to do 6 heavy washes, 3 regular washes, and 5 light washes with three bleached loads?
def solve() -> int: total_heavy = 6 * 20 total_regular = 3 * 10 total_light = 5 * 2 total_extra_light_when_bleached = 3 * 2 result = total_heavy + total_regular + total_light + total_extra_light_when_bleached return result
At a store, you can buy 3 pounds of apples for $5. If you want to buy 6 pounds of apples, how much will it cost?
def solve() -> int: price_per_pound = 5 / 3 num_pounds = 6 total_cost = price_per_pound * num_pounds result = total_cost return result
Student: John invested $5000 into a savings account with an annual interest rate of 3%. How much money will he have in the account after 5 years if the interest is compounded annually?
def solve() -> int: principal = 5000 interest_rate = 0.03 time = 5 amount = principal * (1 + interest_rate) ** time result = amount return result
Student: A person invests $5000 in stock A, $3000 in stock B, and $2000 in stock C. If the stocks return 10%, 12%, and 8% respectively, what is the average return on investment?
def solve() -> int: stockA = 5000 stockB = 3000 stockC = 2000 returnA = stockA * 0.1 returnB = stockB * 0.12 returnC = stockC * 0.08 totalReturn = returnA + returnB + returnC result = totalReturn / (stockA + stockB + stockC) return result
After their first stage performance, the group received 2500 fans. A week later, they noticed 5 times the initial number of fans. They gained an additional 8000 fans after two more weeks. What is the total number of fans the group has now?
def solve() -> int: initial_fans = 2500 week1_fans = initial_fans * 5 week2_fans = week1_fans + 8000 total_fans = initial_fans + week1_fans + week2_fans result = total_fans return result
- Every weekend, Alice goes to the library and borrows 32 books to read. She returns 10 books on Saturday and 8 books on Sunday. However, she also loses 3 books and damages 4 books, which she has to pay for. How many books does she have to return on Monday?
def solve() -> int: books_borrowed = 32 books_returned = 10 + 8 books_lost = 3 books_damaged = 4 books_to_return = books_borrowed - books_returned - books_lost - books_damaged result = books_to_return return result
If a restaurant serves an average of 25 customers per hour, how many customers will they serve in a week if they are open for 12 hours a day, 7 days a week?
def solve() -> int: hours_per_week = 12 * 7 customers_per_hour = 25 total_customers = hours_per_week * customers_per_hour result = total_customers return result
Sara makes her own salsa with tomatoes and onions in a blender. She uses a ratio of two tomatoes to every six onions. Her last batch of salsa weighed 40 ounces. How many onions did she use?
def solve() -> int: tomatoes_to_onions = 2/6 total_weight = 40 onions_weight = total_weight / (1 + tomatoes_to_onions) tomatoes_weight = total_weight - onions_weight onions_used = onions_weight / 6 result = onions_used return result
Student: In a party, every three kids get $20 altogether. If 24 kids came to the party, how much money did they get in total?
def solve() -> int: num_kids = 24 money_per_group = 20 total_money = num_kids // 3 * money_per_group result = total_money return result
Student: If a rectangle has a width of 10 inches and a perimeter of 48 inches, what is its length?
def solve() -> int: width = 10 perimeter = 48 length = perimeter - 2 * width result = length return result
There were 36 eggs in a basket and 6 times as many bread slices. If Amy makes 12 sandwiches using 2 eggs and 4 bread slices each, how many more bread slices than eggs are there in the basket now?
def solve() -> int: eggs = 36 bread_slices = 6 * eggs eggs = eggs - 12 * 2 bread_slices = bread_slices - 12 * 4 difference = bread_slices - eggs result = difference return result
Sarah is driving from point A to point B. Point A is 60 miles away, and she is driving at 30 miles per hour. After 1 hour, she stops for lunch, which takes 30 minutes. Then, she continues driving at 40 miles per hour for the remaining distance. What time does she arrive at point B?
def solve() -> int: time_for_first_leg = 60/30 time_for_lunch = 0.5 time_for_second_leg = (60-30)/40 total_time = time_for_first_leg + time_for_lunch + time_for_second_leg arrival_time = 1 + total_time result = arrival_time return result
Student: If a bag has 7 candy bars, and each candy bar has 5 chocolates in it, how many chocolates are there in the bag?
def solve() -> int: bag = 7 candy_bar = 5 total_chocolates = bag * candy_bar result = total_chocolates return result
Avery created a scholarship to support college students studying engineering. In the first week, 15 students applied for the scholarship. In the second week, applications were twice as high as the first week. If she awarded 50% of the scholarships in the third week, calculate the number of scholarships remaining.
def solve() -> int: week1 = 15 week2 = week1 * 2 total_applicants = week1 + week2 week3_awarded = total_applicants * 0.5 remaining_scholarships = total_applicants - week3_awarded result = remaining_scholarships return result
A company pays its employees $12 per hour for the first 40 hours of work per week, and $18 per hour for any additional work above 40 hours. If an employee works 47 hours per week, how much will they be paid?
def solve() -> int: reg_pay_rate = 12 overtime_pay_rate = 18 reg_hours = 40 total_hours = 47 if total_hours <= reg_hours: total_pay = total_hours * reg_pay_rate else: reg_pay = reg_hours * reg_pay_rate overtime_pay = (total_hours - reg_hours) * overtime_pay_rate t...
John eats 1/4 of a pizza in 10 minutes. How many pizzas can he eat in 2 hours?
def solve() -> int: pizza_per_minute = 1/40 minutes_in_2_hours = 120 pizzas_in_2_hours = pizza_per_minute * minutes_in_2_hours result = pizzas_in_2_hours return result
A game has a total of 80 points. Each player scores 8 points per round and they play for a total of 10 rounds. How many players are there?
def solve() -> int: total_points = 80 points_per_round = 8 total_rounds = 10 players = total_points / (points_per_round * total_rounds) result = players return result
A farmer has 700 cows in total on his farm. He sells 4/5 of the cows. How many were sold?
def solve() -> int: total_cows = 700 ratio_sold = 4/5 no_cows_sold = total_cows * ratio_sold result = no_cows_sold return result
A bird flies 30 feet forward but then gets blown back 8 feet due to strong winds. How far has it flown after 15 rounds?
def solve() -> int: forward_distance = 30 backward_distance = 8 total_distance = forward_distance - backward_distance rounds = 15 distance_flown = total_distance * rounds result = distance_flown return result
arah ran a 5 mile race in 45 minutes. What was her average speed in miles per hour?
def solve() -> int: total_distance = 5 time_in_hours = 45 / 60 average_speed = total_distance / time_in_hours result = average_speed return result
Rachel has 1500 pages to read for her finals. She has already read 20% of them. If she needs to finish all pages in 5 days, how many pages should she read every day?
def solve() -> int: total_pages = 1500 percent_read = 20 days_left = 5 pages_read = total_pages * percent_read / 100 pages_left = total_pages - pages_read pages_per_day = pages_left / days_left result = pages_per_day return result
Joe's mum baked 3 cakes for her family. Joe and his brother took 2/3 of the entire cake, while his mum and dad took the remaining 1/3 of it. If the whole cake was divided into 24 slices, how many slices did Joe and his brother get?
def solve() -> int: total_slices = 24 slices_taken = 2/3 slices_Joe = total_slices * slices_taken result = slices_Joe print ('Joe and his brother got', result,'slices') return result
Four consecutive even numbers have a sum of 100. What are the four even numbers?
def solve() -> int: sum_of_numbers = 100 x = (sum_of_numbers / 4) - 1 result = x, x+2, x+4, x+6 return result
A truck carrying 15 pigs, 12 chickens and 9 rabbits had a flat tire. 4 of the pigs ran away. Half as many chickens ran away as did pigs. All of the rabbits stayed in the truck. How many total animals remained in the truck or were caught by the farmer?
def solve() -> int: pigs = 15 chickens = 12 rabbits = 9 pigs_ran = 4 chickens_ran = pigs_ran // 2 pigs -= pigs_ran chickens -= chickens_ran total = pigs + chickens + rabbits result = total return result
Max played video games for 4 hours and 15 minutes on Monday and Tuesday combined. On Wednesday, he played for three times as long as he did on Monday. If he spends 30 minutes less time playing video games on Thursday than he did on Tuesday, how many hours has he spent playing video games in total?
def solve() -> int: minutes_monday_tuesday = 4 * 60 + 15 minutes_wednesday = 3 * (4 * 60 + 15) minutes_thursday = (4 * 60 + 15) - 30 total_minutes = minutes_monday_tuesday + minutes_wednesday + minutes_thursday total_hours = total_minutes / 60 result = total_hours return result
The length of a rectangle is 3 more than the width. The perimeter is 26. What is the length of the rectangle?
def solve() -> int: perimeter = 26 w = perimeter//6 l = w+3 result = l return result
A soccer team has won 8 matches, drawn 4 and lost 2. If the team scores 3 points for every win, 1 point for a draw, and 0 points for a loss, how many points did the team get in total?
def solve() -> int: num_wins = 8 num_draws = 4 num_losses = 2 points_per_win = 3 points_per_draw = 1 total_points = (num_wins * points_per_win) + (num_draws * points_per_draw) + (num_losses * 0) result = total_points return result
A high school student wants to buy a new laptop, a backpack, and a phone. The laptop costs $1200, the backpack costs $50, and the phone costs $800. The student has $2000. How much money will he have left after buying the items?
def solve() -> int: total_cost = 1200 + 50 + 800 money_left = 2000 - total_cost result = money_left return result
Lisa has a jar of 150 jelly beans. She gives 20% of them to her brother and 10% of them to her sister. How many jelly beans does she have left?
def solve() -> int: brother = 0.2 * 150 sister = 0.1 * 150 left = 150 - brother - sister result = left return result
Student: Hal and Tina both have pistachios. Hal has 23 pistachios, while Tina has 29 pistachios. If they each give away the same amount, how many pistachios does each one give away?
def solve() -> int: hal = 23 tina = 29 difference = tina - hal give_away = difference // 2 hal -= give_away tina -= give_away result = give_away return result
A pizza place sells a large pizza for $15 and a medium pizza for $12. If a customer orders 2 large pizzas and 3 medium pizzas, how much will their total cost be?
def solve() -> int: large_price = 15 medium_price = 12 num_large = 2 num_medium = 3 total_cost = (large_price*num_large) + (medium_price*num_medium) result = total_cost return result
A car travels 500 km in 5 hours. If it maintains the same speed throughout the journey, how long will it take to travel 1200 km?
def solve() -> int: distance_1 = 500 time_1 = 5 speed = distance_1 / time_1 distance_2 = 1200 time_2 = distance_2 / speed result = time_2 return result
Ben bought a dozen (12) eggs for $2.40. He used 4 eggs to make an omelette and sold the omelette for $3. He then bought 6 more eggs for $1.20. How much money does Ben have now?
def solve() -> int: eggs = 12 price = 2.40 used = 4 sold = 3 bought = 6 new_price = 1.20 left = eggs - used + bought spent = price + new_price earned = sold result = earned - spent return result
Student: A cyclist travels 180 km in 6 hours. At the same rate, how many kilometers would he travel in 45 minutes?
def solve() -> int: distance = 180 time = 6 rate = distance / time target_time = 45 / 60 target_distance = rate * target_time result = target_distance return result
If a triangle with base length 8cm and height length 6cm is dilated by a scale factor of 2, what is the area of the new, dilated triangle?
def solve() -> int: base = 8 height = 6 scale_factor = 2 new_base = base*scale_factor new_height = height*scale_factor new_area = (1/2)*new_base*new_height result = new_area return result
Student: A bookstore sells books for $12 each with a 20% discount on every 3rd book. If you buy 5 books, how much would it cost?
def solve() -> int: book_price = 12 discount_rate = 0.2 num_books = 5 total_cost = book_price * num_books num_discount_books = num_books // 3 total_discount = num_discount_books * book_price * discount_rate final_cost = total_cost - total_discount result = final_cost return resul...
The perimeter of a square is 80 meters. What is the area of the square?
def solve() -> int: perimeter = 80 side_length = perimeter / 4 result = side_length**2 result return result
Black Panther is 8 years older than Spiderman and 20 years younger than Doctor Strange. If Doctor Strange is 100 years old, how old is Black Panther?
def solve() -> int: age_DoctorStrange = 100 age_BlackPanther = age_DoctorStrange - 20 - (age_DoctorStrange / 13) + 8 result = age_BlackPanther return result
Question X+1: New question with endofquestion and endofprogram tags. Some possible questions and programs are: Rosie has five fish in her aquarium. On average, they eat a total of 15 grams of fish food a week. The first fish eats an average of 1 gram of fish food a day. How many grams of fish food a day does the second...
def solve() -> int: food_first = 1 * 7 food_other = 15 - food_first food_second = food_other / 4 result = round(food_second, 2) return result
Tom bought 6 burgers and 10 fries for $34 in total. If each burger costs $4, what was the cost of each order of fries?
def solve() -> int: burgers = 6 fries = 10 total_cost = 34 burger_cost = 4 burger_total_cost = burgers * burger_cost fries_cost = (total_cost - burger_total_cost) / fries result = fries_cost return result
Jack has a rectangular garden that is 6 meters long and 4 meters wide. He wants to plant some flowers along the perimeter of the garden, leaving 1 meter of space between each flower. If each flower costs $0.5, how much money does Jack need to spend on the flowers?
def solve() -> int: length = 6 width = 4 space = 1 cost_per_flower = 0.5 perimeter = 2 * (length + width) number_of_flowers = perimeter // space total_cost = number_of_flowers * cost_per_flower result = total_cost return result
``` A person invested $2,000 in a mutual fund for 3 years. The interest rate was 5% per year. How much money did the person get back at the end of the 3 years?
def solve() -> int: principal = 2000 years = 3 interest_rate = 0.05 interest = principal * interest_rate * years amount = principal + interest result = amount return result
Student: The toy store sells dolls for $10 each and cars for $4 each. Emily wants to buy 8 dolls, and with the rest of the money she has left, buy as many cars as she can. How many cars could Emily buy if she has $100 for her entire purchase?
def solve() -> int: doll_price = 10 car_price = 4 dolls_bought = 8 total_money = 100 total_doll_price = doll_price * dolls_bought remaining_money = total_money - total_doll_price cars_bought = remaining_money // car_price result = cars_bought return result
Amanda has 200 stamps in her collection. She gives away 50 stamps to her sister and buys 75 more stamps. How many stamps does she have now?
def solve() -> int: stamps = 200 stamps -= 50 stamps += 75 result = stamps return result
A student scored 75 on the first math test and 90 on the second math test. If the tests are worth the same amount, what is the average score for the two tests?
def solve() -> int: total_score = 75 + 90 average_score = total_score / 2 result = average_score return result
Student: A restaurant has 48 chickens in its storeroom. Each chicken can be broken down into 4 pieces. How many total pieces of chicken can the restaurant make?
def solve() -> int: chickens = 48 pieces_per_chicken = 4 total_pieces = chickens * pieces_per_chicken result = total_pieces return result
Mia is baking a cake for her friend's birthday. She needs 3 cups of flour, 2 cups of sugar, and 4 eggs for the cake. She has 5 cups of flour, 3 cups of sugar, and 10 eggs in her kitchen. How many cakes can she make with the ingredients she has, and how much of each ingredient will she have left over?
def solve() -> int: flour_needed = 3 sugar_needed = 2 eggs_needed = 4 flour_available = 5 sugar_available = 3 eggs_available = 10 cakes = min(flour_available // flour_needed, sugar_available // sugar_needed, eggs_available // eggs_needed) flour_remainder = flour_available - cakes * ...
The area of a square is 36 sq. units. What is the length of one side of the square?
def solve() -> int: area = 36 s = (area)**(1/2) result = s return result
Lila wants to buy some books that cost her $12 each and some pencils that cost $1 each. If Lila wants to spend $50 in total, how many books and pencils can she buy?
def solve() -> int: book_cost = 12 pencil_cost = 1 total_cost = 50 books = (total_cost - pencil_cost)/book_cost pencils = (total_cost - (books*book_cost))/pencil_cost result = (books,pencils) return result
David has 2 pounds of chocolate. He wants to share half of it with his best friend. If he repeats this activity twice, then how much chocolate will he have given away?
def solve() -> int: chocolate = 2 shared_chocolate = chocolate / 2 given_away = shared_chocolate * 2 result = given_away * 2 return result
If it takes 2 mechanics 3 hours to fix a car, how long will it take 4 mechanics to fix the same car working at the same rate?
def solve() -> int: mechanics_1 = 2 time_1 = 3 mechanics_2 = 4 time_2 = (mechanics_1 * time_1) / mechanics_2 result = time_2 return result
Liam, Aiden, and Ethan collected 128 seashells. If Liam has three times as many seashells as Aiden, and Aiden has 16 seashells, how many seashells does Ethan have?
def solve() -> int: aiden_seashells = 16 liam_seashells = 3 * aiden_seashells total_seashells = 128 ethan_seashells = total_seashells - (aiden_seashells + liam_seashells) result = ethan_seashells return result
William is organizing a donut breakfast for his 4 kids and their 14 friends. He also buys enough donuts for himself and the 4 other adults present. If each donut box has 12 donuts and there are 8 boxes in total, what is the total number of donuts each person gets?
def solve() -> int: kids = 4 friends = 14 adults = 4 donuts_per_box = 12 total_boxes = 8 total_people = kids + friends + adults + 1 total_donuts = donuts_per_box * total_boxes donuts_per_person = total_donuts // total_people result = donuts_per_person return...
etc. Possible new questions and programs are: Eric earns 5 dollars for every hour he helps his mom with chores. His mom decided to increase his pay by 15%. Eric worked for 10 hours this week. How much more money will he earn as a result of his increase?
def solve() -> int: original_rate = 5 new_rate = original_rate * 1.15 hours = 10 original_earnings = original_rate * hours new_earnings = new_rate * hours difference = new_earnings - original_earnings result = difference return result