question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Student: Patrick has twice as many apples as Marta. If Patrick has 24 apples, how many apples does Marta have?
def solve() -> int: patrick_apples = 24 marta_apples = patrick_apples / 2 result = marta_apples return result
In a dance competition, there were 20 couples at the beginning. After 45 minutes, 10 more couples joined the competition. The total number of couples increased by 100% after another 1 hour. If only 45 couples completed the competition, how many couples dropped out?
def solve() -> int: couples_start = 20 couples_45min = couples_start + 10 couples_total = couples_45min * 2 couples_completed = 45 percent_increase = 100 couples_dropped_out = couples_total - couples_completed result = couples_dropped_out return result
Adam ate 1.5 bowls of soup every day for 10 days. How many total bowls of soup did he eat?
def solve() -> int: num_days = 10 num_bowls_per_day = 1.5 def total_bowls(num_days, num_bowls_per_day): result = num_days * num_bowls_per_day return result result = total_bowls(num_days, num_bowls_per_day) return result
Greg makes bird feeders and adds 3 scoops of seeds for every 4 sticks he uses. He runs out of sticks and switches to twigs, which are stronger. If twigs improve the effectiveness of the seeds by 50%, how many scoops of seeds should Greg add to restore the equilibrium?
def solve() -> int: sticks = 4 twigs = sticks * 1.5 scoops = 3 scoops_per_stick = scoops / sticks scoops_per_twig = scoops_per_stick / 1.5 equilibrium_scoops = scoops_per_twig * twigs result = equilibrium_scoops return result
A new smartphone has a discount of 12%. The original price was $800. What is the discounted price?
def solve() -> int: original_price = 800 discount_percentage = 0.12 discount_amount = original_price*discount_percentage discounted_price = original_price - discount_amount result = discounted_price return result
75% of all houses in a neighborhood have gardens. If there are 300 houses in the neighborhood, how many houses do not have gardens?
def solve() -> int: total_houses = 300 percent_with_gardens = 75 percent_without_gardens = 100 - percent_with_gardens houses_with_gardens = total_houses * percent_with_gardens / 100 houses_without_gardens = total_houses * percent_without_gardens / 100 result = houses_without_gardens ...
ally is trying to lose weight and has a goal of losing 2 pounds a week. She has already lost 5 pounds and plans to keep losing weight at this rate. How many weeks will it take her to reach her goal weight if she wants to lose a total of 20 pounds?
def solve() -> int: start_weight = 5 goal_weight = 20 weekly_loss = 2 weeks = (goal_weight - start_weight) / weekly_loss result = weeks return result
- Sandra made cupcakes for a bake sale that cost her $15 to make 24 cupcakes. She sold them for $2 each. How much did Sandra earn if she sold all of her cupcakes?
def solve() -> int: revenue = 24 * 2 profit = revenue - 15 result = profit return result
Dan has 12 pencils, and 8 of them are red. What percentage of pencils are NOT red?
def solve() -> int: pencils = 12 red_pencils = 8 not_red_pencils = pencils - red_pencils percentage = not_red_pencils/pencils result = percentage*100 return result
Jake is a painter. He paints a new painting every month. He has been painting for 12 years and sells each painting for $500. How much money has he made from his paintings?
def solve() -> int: paintings_per_month = 1 months_per_year = 12 years_painting = 12 paintings_total = paintings_per_month * months_per_year * years_painting money_total = paintings_total * 500 result = money_total return result
ome possible new questions and python programs are: Mark has a reading goal of 30 minutes per day. He read for 18 minutes in the morning and 12 minutes in the afternoon. How many more minutes does he need to read to reach his goal today?
def solve() -> int: goal = 30 morning = 18 afternoon = 12 remaining = goal - (morning + afternoon) result = remaining return result
A photo is 6 inches wide and 8 inches tall. What is its aspect ratio in the form of width:height?
def solve() -> int: width = 6 height = 8 aspect_ratio = str(width) + ':' + str(height) result = aspect_ratio return result
A store offers a 20% discount for all products. If a customer buys 2 items, the third one is free. If David bought 4 items, and the prices for those items are $10, $8, $12, and $15. How much did he pay?
def solve() -> int: item1 = 10 item2 = 8 item3 = 12 item4 = 15 total = item1 + item2 + item3 + item4 discount = 0.2 * total if item1 and item2 and item3 and item4: discount += min(item1, item2, item3, item4) result = total - discount else: result = total - (discou...
A toy store is having a sale on stuffed animals. A teddy bear costs $10 and a bunny costs $8. The store sold 20 teddy bears and 30 bunnies. How much money did they make in total?
def solve() -> int: teddy_bear_price = 10 bunny_price = 8 num_teddy_bears = 20 num_bunnies = 30 total_sales = (teddy_bear_price * num_teddy_bears) + (bunny_price * num_bunnies) result = total_sales return result
Student: Q5: Jorge has 24 watermelons and Leah has 1/4 of that amount. How many watermelons does Leah have?
def solve() -> int: jorge_watermelons = 24 leah_watermelons = jorge_watermelons / 4 result = leah_watermelons return result
There are 18 students in a class. They are divided into 6 groups with equal members. How many members are there in each group?
def solve() -> int: total_students = 18 total_groups = 6 students_per_group = total_students / total_groups result = students_per_group return result
Mary has $27.50 in her wallet and wants to buy 3 books at $5.75 each and 2 chocolates at $1.30 each. How much money will be left in her wallet?
def solve() -> int: money_in_wallet = 27.50 books_cost = 5.75 * 3 chocolates_cost = 1.30 * 2 total_cost = books_cost + chocolates_cost money_left = money_in_wallet - total_cost result = money_left return result
Michael has 24 toy cars. He wants to divide them equally among 6 of his friends. How many toy cars will each friend get?
def solve() -> int: toy_cars = 24 num_friends = 6 cars_per_friend = toy_cars/num_friends result = cars_per_friend return result
Mary runs at a speed of 8 km/h. She stops to rest for 15 minutes after every 4 km. If she runs for 40 km, how long does it take her in total?
def solve() -> int: speed = 8 distance = 40 rest = 0.25 time = (distance / speed) + (rest * (distance // 4)) result = time return result
A farmer has a total of 425 sheep. 25% of the sheep are grazing in the fields, and 135 of those sheep are baby sheep. How many adult sheep are grazing in the fields?
def solve() -> int: total_sheep = 425 percent_grazing = 0.25 baby_sheep = 135 grazing_sheep = total_sheep * percent_grazing adult_sheep = grazing_sheep - baby_sheep result = adult_sheep return result
You have 250$ to buy a new phone. You find a phone that costs 300$ but has a 20% discount. You also have to pay a 10% tax on the final price. How much money do you need to borrow from your friend to buy the phone?
def solve() -> int: money = 250 discount = 300 * 0.2 phone = 300 - discount tax = phone * 0.1 phone = phone + tax borrow = phone - money result = borrow return result
Jack and Jill visited a toy store. Jack bought a toy car for $10 and a puzzle for $5, while Jill bought a board game for $18. If Jill's bill was $9 less than twice the amount Jack spent, what was the total cost of their purchases?
def solve() -> int: jack_toy_car = 10 jack_puzzle = 5 jill_board_game = 18 jill_bill = 2 * (jack_toy_car + jack_puzzle) - 9 total_cost = jack_toy_car + jack_puzzle + jill_board_game result = total_cost return result
Student: There are 500 different classes at a school. What is the probability that a student taking two classes have the same teacher for them?
def solve() -> int: classes = 500 classes_taken = 2 total_combinations = classes ** classes_taken same_teacher_combinations = classes * (classes - 1) probability = same_teacher_combinations / total_combinations result = probability return result
9. There were 87 cans of food that needed to be sorted. Brian sorted 1/5 of the cans of food. How many cans of food still need to be sorted?
def solve() -> int: total_cans = 87 percent_sorted = 20 amount_sorted = (percent_sorted/100)*total_cans remaining_cans = total_cans - amount_sorted result = remaining_cans return result
A box of 12 pencils costs $3.60. What is the cost of one pencil?
def solve() -> int: num_of_pencils = 12 total_cost = 3.60 cost_per_pencil = total_cost / num_of_pencils result = cost_per_pencil return result
Mark went to a hardware store to buy some tools. At the first aisle, he checked out 10 different types of saws. At the second aisle, he checked out half as many hammers as the saws he checked out at the first aisle. At the third aisle, he did not buy any tools, but he bought a measuring tape at the fourth aisle. But at...
def solve() -> int: saws = 10 hammers = saws / 2 measuring_tape = 1 screwdrivers = 2 * (saws + hammers + measuring_tape) total_tools = saws + hammers + measuring_tape + screwdrivers result = total_tools return result
Each candy bar weighs 50 grams. Each chocolate bar weighs 80 grams. Amy has 12 candy bars and 9 chocolate bars. How much does her collection of bars weigh in kilograms?
def solve() -> int: candy_weight = 50 chocolate_weight = 80 candy_quantity = 12 chocolate_quantity = 9 candy_total = candy_weight * candy_quantity chocolate_total = chocolate_weight * chocolate_quantity total = candy_total + chocolate_total total = total / 1000 result = total ret...
Steve cooked 30 chicken wings and 20 buffalo wings for the game night. Each chicken wing had 1 bone and each buffalo wing had 2 bones. If the guests ate 60 bones in total, how many buffalo wings did they eat?
def solve() -> int: chicken_wings = 30 buffalo_wings = 20 chicken_bones = chicken_wings * 1 buffalo_bones = buffalo_wings * 2 total_bones = chicken_bones + buffalo_bones buffalo_wings_eaten = (total_bones - 60) / 2 result = buffalo_wings_eaten return result
Six years ago, Alex was three times the age of his cousin. In 2 years, his cousin will be 15. How old is Alex now?
def solve() -> int: cousin_age_in_2_years = 15 cousin_age_six_years_ago = cousin_age_in_2_years - 2 alex_age_six_years_ago = 3 * cousin_age_six_years_ago alex_age_now = alex_age_six_years_ago + 6 result = alex_age_now return result
In a park, there are 10 benches with 4 legs each, 3 swings with 2 legs each, and 2 seesaws with 3 legs each. How many legs are there in the park?
def solve() -> int: benches = 10 legs_per_bench = 4 swings = 3 legs_per_swing = 2 seesaws = 2 legs_per_seesaw = 3 total_legs = benches * legs_per_bench + swings * legs_per_swing + seesaws * legs_per_seesaw result = total_legs return result
Alex goes to the toy store. Counting Alex's wishlist, half of the items are board games and 1/7 are puzzles. If there are 14 board games, how many puzzles are there?
def solve() -> int: board_games = 14 puzzles = (board_games * 7) / 2 result = puzzles return result
Student: You have $1000 to invest in a stock that earns 5% interest annually. How much money will you have after 3 years if you reinvest the interest each year?
def solve() -> int: initial_investment = 1000 interest_rate = 0.05 years = 3 interest_1 = initial_investment * interest_rate total_1 = initial_investment + interest_1 interest_2 = total_1 * interest_rate total_2 = total_1 + interest_2 interest_3 = total_2 * interest_rate total_3 = to...
Cheryl has 14 marbles. She gives 3 marbles to each of her 4 friends. How many marbles does she have left?
def solve() -> int: cheryl_marbles = 14 friends = 4 marbles_given = friends * 3 marbles_left = cheryl_marbles - marbles_given result = marbles_left return result
Lucia bought 6 yards of fabric and 4 spools of thread to make a dress. A yard of fabric costs $8 and a spool of thread costs $1.25. She also paid a $15 fee to rent a sewing machine. How much will Lucia spend in all?
def solve() -> int: fabric_cost = 8 thread_cost = 1.25 fee = 15 fabric_total = 6 * fabric_cost thread_total = 4 * thread_cost material_total = fabric_total + thread_total final_cost = material_total + fee result = final_cost return result
Marcus found a total of 73 coins: 5 quarters, 26 dimes, and 42 pennies. How much money did Marcus find in total?
def solve() -> int: total_amount = 5*25 + 26*10 + 42 result = total_amount return result
John needs to calculate the total surface area of a rectangular prism. He knows that the length is 7 cm, the width is 3.5 cm and the height is 11 cm. What is the total surface area of the rectangular prism?
def solve() -> int: l = 7 w = 3.5 h = 11 area_1 = 2 * (l * w + l * h + w * h) result = area_1 return result
Paul has 370 apples. He gave 49 apples to his friends. How many apples does Paul have left?
def solve() -> int: total_apples = 370 given_away = 49 result = total_apples - given_away return result
Student: A train leaves a station at 9 a.m. and travels north at an average speed of 40 miles per hour. Another train leaves the same station at 9:30 a.m. and travels south at an average speed of 50 miles per hour. How far apart will the two trains be at 11 a.m.?
def solve() -> int: train_1_speed = 40 train_2_speed = 50 time_difference = 0.5 distance_train_1 = train_1_speed * 2 distance_train_2 = train_2_speed * 2 total_distance = distance_train_1 + distance_train_2 result = total_distance - (time_difference * (train_1_speed + train_2_speed)) re...
Martin wants to build a mini-garden. He has two boxes of soil: each of them containing 15kg of soil and covering an area of 1m2. Martin estimates the garden to cover an area of 2.4m2. How much additional soil does Martin need to buy?
def solve() -> int: soil_per_box = 15 area_per_box = 1 required_area = 2.4 total_soil = required_area * soil_per_box total_boxes = total_soil / soil_per_box result = 3.6 return result
David drops a marble from the top of a 120-foot tower. The marble rebounds to half the height from which it fell on each bounce. How tall will it bounce on the eighth bounce?
def solve() -> int: height = 120 bounce_height = height/2 bounce_count = 8 for i in range(bounce_count-1): bounce_height = bounce_height/2 result = bounce_height return result
For his game night, Leo bought 5 bags of chips, each containing 50 pieces. After playing board games, 10 of his friends stayed to eat and hang out, each eating an equal number of chips. Calculate the number of chips that each person will eat.
def solve() -> int: bags_of_chips = 5 chips_per_bag = 50 friends = 10 total_chips = bags_of_chips * chips_per_bag chips_per_person = total_chips / friends result = chips_per_person return result
Tom has two $20 bills, one $10 bill, five $5 bills, and $3.50 in coins. He goes to the store to buy a phone that costs $81.50. How much money will be left in his wallet?
def solve() -> int: remainder = 0 remainder = 20 + 20 + 10 + 5 + 5 + 5 + 5 + 3.50 remainder = remainder - 81.50 result = remainder return result
James has 900 cents in quarters. He gives 75 cents to Charlotte and gives twice as many cents to Leo as he gave to Charlotte. How many more quarters does Leo have than Charlotte?
def solve() -> int: quarters = 900 cents_given_to_charlotte = 75 cents_given_to_leo = 2 * cents_given_to_charlotte quarters_given_to_charlotte = cents_given_to_charlotte // 25 quarters_given_to_leo = cents_given_to_leo // 25 quarters_difference = quarters_given_to_leo - quarters_given_...
Student: Emma has 26 books in her bookshelf. She bought 10 new books and gave away 25% of her collection. How many books does she have now?
def solve() -> int: books = 26 new_books = 10 percentage = 0.25 total_books = books + new_books books_gave_away = total_books * percentage books_now = total_books - books_gave_away result = books_now return result
On Monday, Jane buys 10 more pencils than Pete. Pete buys 6 pencils on his own. On Tuesday, Pete buys triple the pencils he bought on Monday, while Jane buys half the pencils she bought on Monday. On Wednesday, Jane buys 7 pencils, and Pete buys 4 times the number of pencils Jane bought on Wednesday. How many pencils d...
def solve() -> int: Pete1 = 6 Jane1 = Pete1 + 10 Pete2 = Pete1 * 3 Jane2 = Jane1 / 2 Pete3 = Jane2 * 4 Jane3 = 7 total = Pete1 + Jane1 + Pete2 + Jane2 + Pete3 + Jane3 result = total return result
Bob had $100. He spent $25 on groceries and $45 on clothes. How much money does Bob have left?
def solve() -> int: money = 100 money -= 25 money -= 45 result = money return result
A group of friends decide to save money together for charity. Sarah puts $12 every week for 12 weeks, Robert saves $2 every day for 60 days, and Mary saves 25 cents every other day for 90 days. How much do they save together?
def solve() -> int: weeks_sarah = 12 amount_sarah = 12 days_robert = 60 amount_robert = 2 days_mary = 90 amount_mary = 0.25 total_sarah = weeks_sarah * amount_sarah total_robert = days_robert * amount_robert total_mary = (days_mary // 2) * (amount_mary * 2) if days_mary % 2 == 1:...
Jake is selling his car for $7000 and has two offers. One offer is for $6500 and includes a trade-in of a motorcycle that Jake values at $1500. The other offer is for $6000 and includes a trade-in of a boat that Jake values at $2000. What is the difference between the amounts Jake will earn from the two offers?
def solve() -> int: first_offer = 6500 + 1500 second_offer = 6000 + 2000 difference = first_offer - second_offer result = difference return result
Jackson and Zoey are organizing a potluck party. Jackson is bringing 30 of his friends, and Zoey is bringing three quarters as many friends. If each guest brings a dish to share, and they want to prepare an extra 10 servings just in case, how many servings of food do they need in total?
def solve() -> int: jackson_friends = 30 zoey_friends = jackson_friends * 0.75 total_guests = jackson_friends + zoey_friends servings_per_guest = 1 extra_servings = 10 total_servings = (total_guests * servings_per_guest) + extra_servings result = total_servings ...
Emma needs 2 and a quarter cups of sugar to bake one cake. She wants to bake 3 cakes for her sister's birthday. How many cups of sugar does she need in total?
def solve() -> int: sugar_per_cake = 2.25 number_of_cakes = 3 total_sugar = sugar_per_cake * number_of_cakes result = total_sugar return result
If Bob has twice as many marbles as Henry, and Henry has one third as many marbles as Sally, and Sally has 18 marbles, how many marbles does Bob have?
def solve() -> int: sally_marbles = 18 henry_marbles = sally_marbles / 3 bob_marbles = henry_marbles * 2 result = bob_marbles return result
A bus travels 360 km in 6 hours. What's the average speed of the bus in km/h?
def solve() -> int: distance = 360 time = 6 speed = distance / time result = speed return result
Henry is installing a new kitchen counter. Each counter section requires 6 pieces of tile, with each tile measuring 4 inches by 6 inches. If Henry is installing a counter that measures 4 feet by 8 feet, how many pieces of tile will he need in total?
def solve() -> int: tiles_per_section = 6 tile_length = 4 tile_width = 6 counter_length = 4 * 12 counter_width = 8 * 12 counter_area = counter_length * counter_width tile_area = tile_length * tile_width num_tiles = counter_area / tile_area * tiles_per_section ...
Student: A train travels 120 km/h and leaves the station at 8 A.M. Another train leaves the same station at 9 A.M. traveling in the same direction at a speed of 150 km/h. At what time will the second train overtake the first train?
def solve() -> int: speed_1 = 120 speed_2 = 150 time_1 = 8 time_2 = (120/30) + time_1 result = time_2 + 1 return result
A hotel room can accommodate a maximum of 4 people. If a group of 20 people books rooms, how many rooms will they need to book?
def solve() -> int: max_people_per_room = 4 num_people = 20 num_rooms = num_people // max_people_per_room + (num_people % max_people_per_room > 0) result = num_rooms return result
A student wants to buy a new PC. The price is $1120. She can take a part-time job with an hourly wage of $6.5. Meanwhile, bank interest pays 1.5% per year. If she saves all her money and works for 6 hours a day, when will she have saved enough to buy the computer, considering the bank interest she gets?
def solve() -> int: pc_price = 1120 hourly_rate = 6.5 hours_per_day = 6 interest_rate = 1.5 interest_per_day = (pc_price * interest_rate / 100) / 365 days = pc_price / (hourly_rate * hours_per_day + interest_per_day) result = days return result
John is buying 7 boxes of crayons. Each box of crayons costs $2.25. If John has a coupon for 25% off of his purchase, how much will he spend on the crayons?
def solve() -> int: price_per_box = 2.25 num_boxes = 7 total_price_before_discount = price_per_box * num_boxes discount = 0.25 total_price_after_discount = total_price_before_discount - (total_price_before_discount*discount) result = total_price_after_discount return result
Jake is making some pancakes. He takes a bowl that holds 500 ml and fills it 1/5th with milk and 4/5ths with flour. The milk weighs 1.03 kg/liter and the flour weighs 0.5 kg/liter. How many kilograms does the pancake mix weigh?
def solve() -> int: milk_volume = 500 * 0.2 flour_volume = 500 * 0.8 milk_weight = milk_volume * 0.001 * 1.03 flour_weight = flour_volume * 0.001 * 0.5 pancake_weight = milk_weight + flour_weight result = pancake_weight return result
Alex and his friends went out to see a movie. Each movie ticket costs $12. They also bought 4 boxes of popcorn that were $6 each. Alex includes a 10% tip for the concession stand workers and an extra $5 for parking. How much did Alex spend in total?
def solve() -> int: num_tickets = 4 ticket_price = 12 num_popcorn = 4 popcorn_price = 6 tip_percent = 0.1 parking_fee = 5 total_ticket_cost = num_tickets * ticket_price total_popcorn_cost = num_popcorn * popcorn_price total_concession_cost = total_popcorn_cost + (total_popcorn_c...
A car travels at an average speed of 80 km/hr. If it travels for 4 hours a day, how many days will it take to cover a distance of 2,000 km?
def solve() -> int: avg_speed = 80 time = 4 distance = 2000 days = distance/(avg_speed * time) result = f'<<<{round(days)}>>>' result = round(days) return result
A supermarket is trying to decide which produce to sell to make the most money. Apples cost $0.50 each and can be sold for $1 each, while Oranges cost $0.75 each and can be sold for $1.50 each. If the supermarket predicts they will sell 2000 apples and 500 oranges, which produce will generate the most profit?
def solve() -> int: apple_profit = (1-0.5)*2000 orange_profit = (1.5-0.75)*500 if apple_profit > orange_profit: result = apple_profit else: result = orange_profit return result
The cost of producing 700 DVDs is $7000. How much will it cost to produce 500 DVDs?
def solve() -> int: total_DVDs_produced = 700 cost_produced = 7000 new_number_DVDs_produced = 500 price_per_DVD = cost_produced / total_DVDs_produced new_cost = new_number_DVDs_produced * price_per_DVD result = new_cost return result
Amanda counted that she has ten times more stickers than Ben, and eight less than Taylor. Ben has 5 stickers. How many stickers do Amanda, Ben, and Taylor have in total?
def solve() -> int: ben_stickers = 5 amanda_stickers = 10 * ben_stickers taylor_stickers = amanda_stickers + 8 total_stickers = ben_stickers + amanda_stickers + taylor_stickers result = total_stickers return result
A recipe for pancakes requires 1 egg for every 4 cups of flour. If you want to use 6 cups of flour to make pancakes, how many eggs do you need?
def solve() -> int: eggs_per_cup_of_flour = 1/4 eggs_needed_for_6_cups = eggs_per_cup_of_flour * 6 result = eggs_needed_for_6_cups return result
Sarah wants to buy a new dress for $45. She has $20 in cash and will put the rest on her credit card. If she has a credit limit of $60, how much money can she put on her card?
def solve() -> int: cash = 20 total_cost = 45 credit_limit = 60 credit_used = total_cost - cash credit_remaining = credit_limit - credit_used result = credit_remaining return result
A school has two types of books, fiction and non-fiction. Each fiction book weighs 300g and each non-fiction book weighs 400g. The school library has 500 books in total and the total weight of the books is 180kg. How many fiction books and how many non-fiction books are there in the school library?
def solve() -> int: from sympy import symbols, solve fiction, non_fiction = symbols('fiction, non_fiction') eq1 = fiction + non_fiction - 500 eq2 = 300 * fiction + 400 * non_fiction - 180000 solution = solve((eq1, eq2), (fiction, non_fiction)) fiction = solution[fiction] non_fictio...
There are 56 pencils in a box. If each pencilcase can hold 16 pencils, how many pencilcases are needed?
def solve() -> int: pencilcase_num = 56 // 16 result = pencilcase_num return result
A baker has 48 eggs and wants to make as many muffins as possible. Each muffin requires 2 eggs and 1/4 cup of flour. The baker has 10 cups of flour. How many muffins can the baker make and how much flour will be left over?
def solve() -> int: eggs = 48 eggs_per_muffin = 2 flour = 10 flour_per_muffin = 0.25 muffins_by_eggs = eggs // eggs_per_muffin muffins_by_flour = flour // flour_per_muffin muffins = min(muffins_by_eggs, muffins_by_flour) flour_left = flour - (muffins * flour_per_...
John went to the store and bought 3 bags of candy. Each bag contained 20 pieces of candy. He ate 2 pieces of candy and then gave 1/4 of the remaining candy to his friends. How many pieces of candy does John have left?
def solve() -> int: pieces_of_candy = 3 * 20 pieces_of_candy -= 2 pieces_of_candy *= (3/4) result = pieces_of_candy return result
Student: Mia bought a bicycle for $500. She paid 20% of the price as a down payment, and the rest in 10 equal monthly installments. She also paid $50 for a helmet and $25 for a lock. How much money did Mia spend in total for the bicycle, the helmet, and the lock?
def solve() -> int: bicycle_price = 500 down_payment = 0.2 installments = 10 helmet_price = 50 lock_price = 25 down_payment_amount = bicycle_price * down_payment installment_amount = (bicycle_price - down_payment_amount) / installments bicycle_total = down_payment_amount + install...
Liam sold his house for $65000 and received a 10% profit on his original investment. He also paid a 4% broker's commission. What was the broker's commission?
def solve() -> int: original_investment = 65000 / (1 + 0.10) broker_commission = original_investment * 0.04 result = broker_commission return result
If Tiffany’s tote bag is 6 pounds heavier than Bob’s briefcase when empty, and Bob’s briefcase is three times heavier than Tiffany’s tote bag when they both carry their work, how much does Tiffany’s work weigh if Bob’s briefcase weighs 36 pounds?
def solve() -> int: bob_weight = 36 tiffany_weight = bob_weight / 3 empty_weight_diff = 6 tiffany_empty_weight = (bob_weight - empty_weight_diff) / 2 tiffany_work_weight = tiffany_weight + tiffany_empty_weight result = tiffany_work_weight return result
Daniel has 9 times as many coins as Dana. If Dana has 3 coins, how many coins will they have if they deposit half of their coins in a bank account and keep the other half?
def solve() -> int: Daniel = 9 * 3 Dana = 3 Daniel_after = Daniel / 2 Dana_after = Dana / 2 total = Daniel_after + Dana_after result = total return result
A teacher assigns 60 questions for an exam. She makes the true/false questions 3 times as many as the multiple-choice questions. There are also 10 more fill-in-the-blank questions than the multiple-choice. How many multiple-choice questions are there?
def solve() -> int: total_questions = 60 true_false_questions = 0 multiple_choice_questions = 0 fill_in_the_blank_questions = 0 true_false_questions = total_questions // 4 fill_in_the_blank_questions = multiple_choice_questions + 10 multiple_choice_questions = (total_questions...
Student: Jason earns $15 an hour and worked for 8 hours. If he spent $40 on dinner, how much money does he save?
def solve() -> int: hourly_rate = 15 hours_worked = 8 dinner_cost = 40 total_earned = hourly_rate * hours_worked money_left = total_earned - dinner_cost result = money_left return result
- Anna bought a new laptop for $1200. She paid 20% of the price as a down payment and financed the rest with a 12-month installment plan. The interest rate was 6% per year. How much did Anna pay in total for the laptop?
def solve() -> int: down_payment = 1200 * 0.2 balance = 1200 - down_payment monthly_rate = 0.06 / 12 monthly_payment = balance * (monthly_rate / (1 - (1 + monthly_rate)**(-12))) total_interest = monthly_payment * 12 - balance total_payment = down_payment + balance + total_interest ...
The cost of a laptop is nine times the age of Alex. If Ben, Alex's friend, is 35 years old and Alex is one-third his age, and they want to buy 6 laptops, what will be the total cost?
def solve() -> int: ben_age = 35 alex_age = ben_age / 3 laptop_cost = 9 * alex_age total_cost = laptop_cost * 6 result = total_cost return result
Tom and Jerry are building a sandcastle. Tom can fill a bucket with sand in two rounds, while Jerry can fill a bucket in three rounds. If it takes 150 buckets of sand to build the sandcastle, how many rounds will it take to fill the buckets?
def solve() -> int: buckets_needed = 150 tom_rounds = 2 jerry_rounds = 3 total_rounds = (buckets_needed * tom_rounds) + (buckets_needed * jerry_rounds) result = total_rounds return result
Ella has 40 less cookies than Anna, and Leo has twice as many cookies as Ella. If Anna has 96 cookies, how many cookies does Leo have?
def solve() -> int: anna = 96 ella = anna - 40 leo = ella * 2 result = leo return result
A chef can cook 2 dishes in an hour. From Wednesday to Sunday, the chef works for 6 hours each day, and on Monday, he only works from 11am to 2pm. How many dishes can the chef cook in a week? Anna's car can drive 60 miles per hour. She is chasing a truck that can drive 45 miles per hour. The truck has a head start of 2...
def solve() -> int: dishes_per_hour = 2 hours_per_day = 6 dishes_wed_to_sun = dishes_per_hour * hours_per_day * 5 dishes_mon = dishes_per_hour * (2-11) total_dishes = dishes_wed_to_sun + dishes_mon anna_speed = 60 truck_speed = 45 head_start = 2 catch_up_speed = anna_speed - tru...
A 4x4x4 cube is painted on all sides. If the cubic blocks are 1x1x1, how many blocks will have no paint?
def solve() -> int: blocks_with_paint = 6*4**2 total_blocks = 4**3 blocks_without_paint = total_blocks - blocks_with_paint result = blocks_without_paint return result
A company has a budget of $5000 to advertise their new product. If each advertisement costs $100, how many advertisements can they run?
def solve() -> int: num_of_ads = 5000 // 100 result = num_of_ads return result
Jacob paid $180 for a watch, which is 30% less than what Ethan paid for the same watch. How much did Ethan pay for the watch?
def solve() -> int: ethan_paid = 180 / (1 - 0.30) result = ethan_paid return result
Yuseff cycles at 12 miles per hour. He cycles for 3 hours at that speed, then takes a break for 30 minutes, and then cycles again at a speed of 10 miles per hour for 2 hours. What is the total distance he cycled?
def solve() -> int: speed_first_leg = 12 time_first_leg = 3 speed_second_leg = 10 time_second_leg = 2 distance_first_leg = speed_first_leg*time_first_leg distance_second_leg = speed_second_leg*time_second_leg total_distance = distance_first_leg + distance_second_leg result = total_distan...
Zoe bought a pack of pencils. She gave 2 to Rachel, then she gave three times as many as she had given Rachel to Maria, and then she gave 8 less than four times as many to Alex as she had given to Maria. If Zoe had 4 pencils remaining, how many pencils did she buy?
def solve() -> int: pencils_bought = 4 + 2 + (2 * 3) + (4 * 3) - 8 result = pencils_bought return result
Jazmin bought 8 yards of fabric. If she cuts the fabric into pieces that are each 1/3 yard long, how many pieces of fabric will she have?
def solve() -> int: fabric = 8 piece_length = 1/3 pieces = fabric / piece_length result = pieces return result
Four friends, Emma, Kiera, Lily and Noah, equally split a bag of 28 toy cars between them. How many toy cars did each of them get?
def solve() -> int: total_toy_cars = 28 num_friends = 4 toy_cars_per_friend = total_toy_cars / num_friends result = toy_cars_per_friend return result
Mary has a credit card debt of $5,000. The annual interest rate on the debt is 20%. How much interest will she pay per year?
def solve() -> int: debt = 5000 interest_rate = 0.20 interest = debt * interest_rate result = interest return result
In the following rectangle, the base is 4 times as long as the height, what is the perimeter?
def solve() -> int: base = 4 height = base / 4 perimeter = (2 * base) + (2 * height) result = perimeter return result
Student: Peter buys 10 nails for $1.50 each, and 12 screws for $2 each. How much does he spend in total?
def solve() -> int: nails = 10 nail_price = 1.5 screws = 12 screw_price = 2 nail_cost = nails * nail_price screw_cost = screws * screw_price total_cost = nail_cost + screw_cost result = total_cost return result
Juanita is filling up her company car with gas. The gas tank holds 80 liters of fuel, but the car already has 55 liters in the tank. If gas costs $3.50 per liter, how much will it cost to fill up the car and how much change will she get from $300?
def solve() -> int: tank_capacity = 80 current_fuel = 55 fuel_needed = tank_capacity - current_fuel cost_per_liter = 3.50 total_cost = fuel_needed * cost_per_liter change = 300 - total_cost result = change return result
Student: A bookstore sells books for $20 each. If Sarah buys 5 books, how much does she spend in total?
def solve() -> int: price = 20 books = 5 total = price * books result = total return result
Student: Maya buys 10 plastic containers of different sizes, but the larger ones cost twice as much as the smaller ones. If the total cost for all the containers was $82, how much did the smallest container cost?
def solve() -> int: x = 82/30 result = x return result
A square field has an area of 64 sq m. What is the length of its diagonal?
def solve() -> int: area = 64 side = area ** 0.5 diagonal = side * 2 ** 0.5 result = diagonal return result
A jar contains 75 marbles, of which 10% are red. How many red marbles are in the jar?
def solve() -> int: total_marbles = 75 red_marbles_percent = 10 red_marbles_amount = (red_marbles_percent/100)*total_marbles result = red_marbles_amount return result
Possible questions and programs: A farmer has 30 hens and 20 roosters. He sells one-fourth of his hens and one-fifth of his roosters at the market. How many chickens does he have left on his farm?
def solve() -> int: hens = 30 roosters = 20 hens_sold = hens // 4 roosters_sold = roosters // 5 hens_left = hens - hens_sold roosters_left = roosters - roosters_sold chickens_left = hens_left + roosters_left result = chickens_left return result
Student: Rachel has $50 in her wallet. She buys a book for $15 and a t-shirt for $18. How much money does she have left in her wallet?
def solve() -> int: wallet = 50 book = 15 tshirt = 18 result = wallet - book - tshirt return result
Tina has 20% of an apple pie left while her brother Max ate 3/4 of it. What percent of the pie did Max eat?
def solve() -> int: Tina_portion_left = 20/100 Max_portion_left = 100 - Tina_portion_left Max_portion_eaten = 3/4 * Max_portion_left total_portion = 100 Max_portion_percent = Max_portion_eaten/total_portion*100 result = round(Max_portion_percent,2) return result
In a square football field, the total length between the two opposite corners is 420 meters. Calculate the length of each side of the football field?
def solve() -> int: length_of_each_side = 0 total_length_of_opposite_corners = 420 length_of_each_side = total_length_of_opposite_corners/4 result = length_of_each_side return result
A farmer has 40 hens in his farm. He sells 1/4th of them and then buys 10 more hens. If each hen costs 10 dollars, how much does the farmer spend on the purchase of new hens?
def solve() -> int: hens = 40 hens *= 0.75 hens += 10 cost = hens * 10 result = cost return result