question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Ben and Bill bought 96 apples at the grocery store. Ben ate 4 more apples than Bill. How many apples did each of them eat?
def solve() -> int: total_apples = 96 difference = 4 ben_apples = (total_apples + difference) / 2 bill_apples = (total_apples - difference) / 2 result = (ben_apples, bill_apples) return result
Amanda's horseback riding crew covered 80% of the trail in the forest, but 20% had to turn back after a sudden rain shower. If the trail was originally 25 miles long, how many miles did they have to turn back from?
def solve() -> int: trail_length = 25 covered_distance = trail_length * 0.8 turn_back_distance = covered_distance * 0.2 result = turn_back_distance return result
Karen has 2 times as many pens as Mark, and Mark has 5 pens. How many pens does Karen have?
def solve() -> int: mark_pens = 5 karen_pens = mark_pens * 2 result = karen_pens return result
Sophia and her family are picking apples in an orchard. Sophia picks 50 apples, while her family picks a quarter of that amount each. If Sophia eats a sixth of her apples, and her family eats a half of theirs, how many apples were eaten in total?
def solve() -> int: sophia_apples = 50 family_apples = sophia_apples / 4 sophia_eaten = sophia_apples / 6 family_eaten = family_apples / 2 total_eaten = sophia_eaten + family_eaten result = total_eaten return result
A runner is trying to complete a 10 km race in 1 hour. If the runner has completed 7 km in 40 minutes, what is the minimum speed (in km/h) the runner needs to maintain to finish the race on time?
def solve() -> int: distance_remaining = 10 - 7 time_remaining = 60 - 40 speed_needed = distance_remaining / (time_remaining/60) result = speed_needed return result
Juan spent $120 on 4 video games, 2 packs of batteries, and 12 notebooks for his school supplies. If each video game costs $25 and each battery pack costs $5, what was the cost of each notebook?
def solve() -> int: video_game_cost = 25 battery_pack_cost = 5 total_cost = 120 number_of_video_games = 4 number_of_battery_packs = 2 number_of_notebooks = 12 total_video_game_cost = number_of_video_games * video_game_cost total_battery_pack_cost = number_of_battery_packs * bat...
A store offers 20% off on all items. If a customer uses a $10 coupon on a $50 purchase, how much does the customer pay?
def solve() -> int: original_price = 50 discount = 0.2 discount_amount = original_price * discount after_discount_price = original_price - discount_amount final_price = after_discount_price - 10 result = final_price return result
ophia has a book club that meets every week. There are 20 members in the club, and each member reads 2 books a month on average. Every meeting, 5 members give away one book each to another member, and 3 members buy one book each from a bookstore. If the average price of a book is $10, how much money do the club members...
def solve() -> int: members = 20 books_read = 2 books_given = 5 books_bought = 3 book_price = 10 books_read_total = members * books_read books_given_total = books_given * 4 books_bought_total = books_bought * 4 books_change = books_bought_total - books_given_total...
A recipe calls for 2 cups of sugar for every 3 cups of flour. If you want to use 9 cups of flour, how many cups of sugar will you need?
def solve() -> int: flour = 9 sugar_per_flour = 2/3 sugar = flour * sugar_per_flour result = sugar return result
Ethan purchased 5 bags of apples and 3 cartons of bananas. If each bag of apples is $3 and a carton of bananas costs the same as three bags of apples, how much change will Ethan receive if he gave the cashier a $50 bill?
def solve() -> int: bags_of_apples = 5 cartons_of_bananas = 3 cost_of_apple_bag = 3 cost_of_banana_carton = cost_of_apple_bag * 3 total_cost = (bags_of_apples * cost_of_apple_bag) + (cartons_of_bananas * cost_of_banana_carton) change = 50 - total_cost result = change return result
A student earned the following grades: 88, 78, 92, 74, 98. What is their average grade?
def solve() -> int: grades = [88, 78, 92, 74, 98] average = sum(grades) / len(grades) result = average return result
A grocery store offers a discount of $2 if a customer spends $20 or more. If a customer buys products worth $25, what is the percent discount they will receive?
def solve() -> int: subtotal = 25 required_amount = 20 discount_amount = 2 if subtotal >= required_amount: discount_percent = discount_amount/subtotal * 100 else: discount_percent = 0 result = discount_percent return result
A school has 120 students, and 35% of them are girls who play basketball, 40% of the girls do not play basketball at all, and the rest are boys. How many girls are there who do not play basketball?
def solve() -> int: students = 120 girls_basketball_percent = 0.35 girls_basketball = students * girls_basketball_percent girls_not_basketball = students * 0.4 girls = girls_not_basketball + girls_basketball boys = students - girls result = girls_not_basketball return res...
Student: A toy car costs $6.25. How many toy cars can you buy with $100?
def solve() -> int: cost = 6.25 money = 100 num_cars = money // cost result = num_cars return result
Amy has 24 flowers in her garden. 2/3 of them are roses, 1/6 are tulips, and the rest are daisies. How many daisies does she have?
def solve() -> int: roses = 2/3 * 24 tulips = 1/6 * 24 daisies = 24 - roses - tulips result = daisies return result
A class of 24 students needs to be split across 6 tables. How many students will be at each table?
def solve() -> int: students = 24 tables = 6 students_per_table = students / tables result = students_per_table return result
A gardener needs to water her garden every 3 days. If she last watered her garden 5 days ago, when is the next time she needs to water her garden?
def solve() -> int: watering_interval = 3 last_watered_days_ago = 5 next_watering_day = (last_watered_days_ago // watering_interval + 1) * watering_interval result = next_watering_day return result
A pie was cut into 8 slices. Five friends bought 2 pies. If they all eat all 2 pies equally, how many slices of pie did each of them eat?
def solve() -> int: total_slices = 8 num_pies = 2 num_friends = 5 total_slices_eaten = total_slices * num_pies slices_per_friend = total_slices_eaten / num_friends result = slices_per_friend return result
Lisa has 144 toys that she wants to give away to children. If she wants to give each child 6 toys, calculate the total number of children that will receive toys.
def solve() -> int: total_toys = 144 toys_per_child = 6 total_children = total_toys / toys_per_child result = total_children return result
Student: Kevin has 60 TikTok friends. 40% are boys and 60% are girls. Ruby has five times as many friends who are boys and has 180 friends total. What percentage of Ruby's friends are girls?
def solve() -> int: kevin_friends = 60 kevin_boys = 0.4 * kevin_friends kevin_girls = 0.6 * kevin_friends ruby_boys = 5 * kevin_boys ruby_friends = 180 ruby_girls = ruby_friends - ruby_boys ruby_girls_percentage = (ruby_girls / ruby_friends) * 100 result = ruby_girls_percentage ...
A car consumes 0.66 liters of petrol for every 10 km traveled. How many liters of petrol will be needed by the car to travel a distance of 390 km?
def solve() -> int: x = 0.66 * (390/10) result = round(x,2) return result
Student: For their anniversary, Amy and Tom bought a 13-pound cake. They served 10 slices, each weighig 7 ounces. How many more pounds, rounded down, did Amy and Tom have left after serving all of the slices?
def solve() -> int: cake_weight = 13 slice_weight = 7 num_slices = 10 slice_weight_in_pounds = slice_weight / 16 total_slices_weight = num_slices * slice_weight_in_pounds remaining_cake_weight = cake_weight - total_slices_weight result = int(remaining_cake_weight) return result
A rectangle has a length of 8cm and a width of 5cm. What is the perimeter of the rectangle?
def solve() -> int: length = 8 width = 5 perimeter = 2 * (length + width) result = perimeter return result
A company has 300 employees. 70% of the employees are full-time and the rest are part-time. How many part-time employees does the company have?
def solve() -> int: num_employees = 300 percent_full_time = 70 num_full_time = num_employees * percent_full_time / 100 num_part_time = num_employees - num_full_time result = num_part_time return result
A recipe for a pizza requires 2 cups of flour. If you want to make 6 pizzas, how many cups of flour are needed?
def solve() -> int: cups_for_one_pizza = 2 num_pizzas = 6 total_cups = cups_for_one_pizza * num_pizzas result = total_cups return result
If an assembly line can produce 10 toys every 20 minutes, how many toys can it produce in a day?
def solve() -> int: toys_per_minute = 10 / 20 minutes_per_hour = 60 hours_per_day = 24 total_toys = toys_per_minute * minutes_per_hour * hours_per_day result = total_toys return result
Jacob is twice as old as Lily, who is 12. How old will Jacob be in 3 years?
def solve() -> int: result = 27 return result
A train travels 300 km in 4 hours. What is its speed in kilometers per hour?
def solve() -> int: distance = 300 time = 4 speed = distance / time result = speed return result
If Rachel is currently 25 years old and half the age of her mother, who is 50 years, how old will they both be in 10 years?
def solve() -> int: rachel_age = 25 mother_age = 50 rachel_age_in_10_years = rachel_age + 10 mother_age_in_10_years = mother_age + 10 result = f"Rachel will be {rachel_age_in_10_years} years old and her mother will be {mother_age_in_10_years} years old in 10 years." return result
The Panthers track and field team has participated in 10 competitions and won 8 of them. They need to win at least 75% of their competitions to make the finals. If there are 4 competitions left, how many do they need to win?
def solve() -> int: total_competitions = 10 competitions_won = 8 competitions_left = 4 percent_won = competitions_won / total_competitions percent_needed = 0.75 competitions_needed = round((percent_needed * (total_competitions + competitions_left)) - competitions_won) result =...
Ana has $45 and she bought 3 folders costing $8 each and 1 drawing paper costing $9. How much money does Ana have left?
def solve() -> int: given_money = 45 num_folders = 3 price_folders = 8 drawing_paper = 1 price_drawing_paper = 9 total_cost = num_folders * price_folders + drawing_paper * price_drawing_paper result = given_money - total_cost return result
Amy buys 3 loaves of bread for $6. If each loaf of bread costs the same amount, what is the cost of one loaf of bread?
def solve() -> int: total_cost = 6 num_loaves = 3 cost_per_loaf = total_cost / num_loaves result = cost_per_loaf return result
If it takes a machine 3 seconds to make 2 widgets, how long will it take to make 100 widgets?
def solve() -> int: number_of_widgets = 100 time_per_widget = 3/2 total_time = number_of_widgets * time_per_widget result = total_time return result
Student: Ralph has 1/4 cup of sugar. If 1 cup of sugar weighs 8 ounces, how many ounces of sugar does Ralph have?
def solve() -> int: cup_sugar = 1/4 cup_sugar_weight = 8 result = cup_sugar * cup_sugar_weight return result
Joe earns $20 an hour by tutoring students. He tutors for 4 hours each week. After tutoring for 2 weeks, how much money will he have earned?
def solve() -> int: hours = 4 rate = 20 weeks = 2 hours_worked = hours * weeks earnings = hours_worked * rate result = earnings return result
A group of 17 haulers was hired to move a shipment of 4280 goods from a warehouse to a store. If it takes the group 20 minutes to move each item, how many hours will it take them to finish the job?
def solve() -> int: goods_total = 4280 minutes_per_goods = 20 result = (goods_total * minutes_per_goods) / 60 print (result) return result
Laura has twice as many marbles as beads. If she has a total of 72 marbles and beads combined, how many beads does she have?
def solve() -> int: marbles = 72/3 result = marbles * 2 return result
Olivia has 20 candies. Michael gives Olivia triple the number she has. Olivia then gives Michael back half of her new total plus 3. How many candies does Olivia have now?
def solve() -> int: candies = 20 michael_candies = candies * 3 olivia_candies = michael_candies - (michael_candies // 2) + 3 result = olivia_candies return result
Chris wants to buy a game that costs $30. He has $10 saved up and can make an extra $6 per hour helping his neighbor with yard work. If he helps with yard work for 3 hours, how much more money does he need to buy the game?
def solve() -> int: game_cost = 30 saved_up_money = 10 yard_work_hours = 3 yard_work_pay = 6 * yard_work_hours total_money_available = saved_up_money + yard_work_pay total_money_needed = game_cost - total_money_available result = total_money_needed return result
Student: A class of 40 students have to attend a seminar. However, only 70% of them attended. If there were 6 more girls than boys in the class and 2/5 of them were girls, then how many girls attended the seminar?
def solve() -> int: total_students = 40 attendance_rate = 0.7 girls_more = 6 girls_ratio = 2/5 total_girls = girls_ratio * total_students total_boys = total_students - total_girls attended_girls = attendance_rate * total_girls attended_boys = attendance_rate * total_boys resu...
Student: A painting is originally priced at $300, but it is on sale for 20% off. What is the sale price of the painting?
def solve() -> int: original_price = 300 discount_rate = 0.2 discount_amount = original_price * discount_rate sale_price = original_price - discount_amount result = sale_price return result
Luke is building a sandbox that is 4 feet long, 4 feet wide, and 1.5 feet deep. He wants to fill it with sand. Each bag of sand has 0.5 cubic feet. How many bags of sand will Luke need to fill the sandbox?
def solve() -> int: length = 4 width = 4 depth = 1.5 sandbox_volume = length * width * depth bag_volume = 0.5 bags_needed = sandbox_volume / bag_volume result = bags_needed return result
- Jessica likes to draw sketches of her favorite animals every 2nd day. She uses 5 minutes to draw a sketch on a quarter of a page. On Sundays, she draws a more detailed sketch of her favorite animal of the week on a full page. It takes her 30 minutes to draw this sketch. How many pages does she use for sketching in 4 ...
def solve() -> int: sketches = (28 / 2) - 4 pages = sketches * 0.25 sunday_sketches = 4 sunday_pages = 4 total_pages = pages + sunday_pages result = total_pages return result
In a group of 84 people, 45% are men. How many women are in the group?
def solve() -> int: people = 84 men = people*0.45 women = people - men result = women return result
John collected 16 colorful stones. He gave 3 of them to his friend. How many stones did he have left?
def solve() -> int: given_away = 3 start_amount = 16 result = start_amount - given_away result = 13 return result
An online store is having a sale where all items are 15% off. If you buy a shirt for $20, pants for $30, and a jacket for $50, what is the total cost of your purchase?
def solve() -> int: shirt_price = 20 pants_price = 30 jacket_price = 50 discount_rate = 0.15 subtotal = shirt_price + pants_price + jacket_price discount = subtotal * discount_rate total_cost = subtotal - discount result = total_cost return result
An art class needs 324 paint brushes to start the semester. Each box of paint brushes comes with 12 brushes. How many boxes of paint brushes should they order?
def solve() -> int: num_paintbrushes = 324 paintbrushes_per_box = 12 num_boxes = num_paintbrushes // paintbrushes_per_box result = num_boxes return result
Emily is creating a mosaic backsplash for her kitchen. The backsplash is 2 feet tall and 8 feet long. Each tile she uses is 1.5 inches square. How many tiles will she need?
def solve() -> int: height_feet = 2 length_feet = 8 tile_size_inches = 1.5 height_inches = height_feet * 12 length_inches = length_feet * 12 area_inches = height_inches * length_inches tiles_needed = area_inches / tile_size_inches ** 2 result = tiles_needed return...
A rectangle has a length of 15 cm and a width of 8 cm. What is the perimeter of the rectangle?
def solve() -> int: perimeter = 2 * (15 + 8) result = perimeter return result
A recipe calls for 3/4 cup of sugar to make 12 cookies. How much sugar is needed to make 24 cookies?
def solve() -> int: num_of_cookies_1 = 12 sugar_1 = 0.75 sugar_2 = sugar_1*(24/num_of_cookies_1) result = sugar_2 return result
2. In a school, there are 24 classes, and each class contains 25 students. How many students are there in the whole school?
def solve() -> int: total_students = 24 * 25 result = total_students return result
and Kasper bought some furniture for their apartment. Sue paid $435 and Kasper paid $290. If the total cost of the furniture was $725, how much is still owing on the furniture?
def solve() -> int: total = 0 total = total + 435 total = total + 290 owing = 725 - total result = owing return result
A gardener has 32 flowers in her garden. The gardener picked 6 flowers for her vase, 8 flowers for her friend, and 5 flowers for her neighbor. The gardener will pick 3 flowers for her mother and 2 flowers for her teacher. Assuming the gardener picks all the flowers, how many flowers will she leave on average for the be...
def solve() -> int: total_flowers = 32 flowers_done = 6 + 8 + 5 + 3 + 2 flowers_left = total_flowers - flowers_done insects_left = 2 flowers_per_insect = flowers_left / insects_left result = flowers_per_insect return result
Paul walks at the speed of 4 miles per hour. He goes for 10 hours. How much distance does he cover?
def solve() -> int: speed = 4 time = 10 distance = speed * time result = distance return result
A box of 16 pencils costs $6. If a box of 4 pencils costs $1.50, what is the cost of each pencil?
def solve() -> int: cost_small_box = 1.5 cost_big_box = 6 num_pencils_small_box = 4 num_pencils_big_box = 16 cost_per_pencil_small_box = cost_small_box / num_pencils_small_box cost_per_pencil_big_box = cost_big_box / num_pencils_big_box result = round(cost_per_pencil_small_box, 2), round(cos...
At Blue Sky Supermarket, 60% of shoppers prefer to use the self-checkout on Sundays. If there are 350 shoppers in the store on a Sunday, how many shoppers will use the regular checkout?
def solve() -> int: percent_self_checkout = 60 total_shoppers = 350 self_checkout_shoppers = (percent_self_checkout / 100) * total_shoppers regular_checkout_shoppers = total_shoppers - self_checkout_shoppers result = regular_checkout_shoppers return result
John and his friends went to a restaurant and split the bill evenly. If they spent a total of $120 and there were 6 people in the group, how much did each person pay?
def solve() -> int: total_bill = 120 num_people = 6 each_person_pays = total_bill / num_people result = each_person_pays return result
Von bought 5 shirts totaling $252.50. One shirt was discounted $19.99 and the others were on sale for 20% off. What was the original price of the discounted shirt?
def solve() -> int: total_cost = 252.5 discount_amount = 19.99 discount_percentage = 20 other_discounts = total_cost * (discount_percentage / 100) reduced_cost = total_cost + other_discounts - discount_amount original_price = reduced_cost / 4 result = original_price ...
A company produced 5000 items per hour for the first 5 hours and 4000 items per hour for the next 3 hours. What is the average production rate per hour?
def solve() -> int: items_in_first_5_hours = 5000 * 5 items_in_next_3_hours = 4000 * 3 total_items_produced = items_in_first_5_hours + items_in_next_3_hours total_time = 5 + 3 average_production_rate = total_items_produced / total_time result = average_production_rate return result
1. Nikki babysits her neighbor every Saturday, and each time she works for 3 hours. She earns 5 dollars per hour. Last Saturday she earned a total of 33 dollars. What is the hourly rate Nikki charges her neighbor?
def solve() -> int: result = 5 hours = 3 rate = 33/hours result = rate return result
Lucy bought 5 packs of juice boxes for her birthday party. Each pack had 10 juice boxes and each juice box had 200 ml of juice. How many liters of juice did Lucy buy in total?
def solve() -> int: packs = 5 juice_per_pack = 10 volume = 200 ml_to_liter = 1 / 1000 total_volume = packs * juice_per_pack * volume total_volume_liter = total_volume * ml_to_liter result = total_volume_liter return result
Student: Gloria has $96. She spends $30 on a new sweater and $15 on new shoes. How much money, in dollars, does Gloria have left?
def solve() -> int: money = 96 spent = 30 + 15 result = money - spent return result
Sally wants to buy a book for $20. However, the store is having a sale of 15% off the original price. What is the price of the book on sale?
def solve() -> int: original_price = 20 discount_percentage = 0.15 sale_price = original_price * (1 - discount_percentage) result = sale_price return result
Here are some possible questions and programs: Elijah wants to make some lemonade for a summer party. He needs 8 lemons, 4 cups of sugar, and 12 cups of water. Each lemon costs $0.25, each cup of sugar costs $0.10, and each cup of water costs $0.05. How much will Elijah spend on the ingredients for the lemonade?
def solve() -> int: lemon_cost = 8 * 0.25 sugar_cost = 4 * 0.10 water_cost = 12 * 0.05 total_cost = lemon_cost + sugar_cost + water_cost result = total_cost return result
Lily swam for 1 hour and stopped to take a break for 20 minutes. After that, she swam for 40 minutes. How long did Lily swim in total?
def solve() -> int: time_1 = 1 time_2 = 0.33 time_3 = 0.66 total_time = time_1 + time_2 + time_3 result = 2.00 return result
A company pays its employees $15 per hour for the first 40 hours of work, and $22.50 per hour for any additional hours. If an employee works for 50 hours, how much money will they make in total?
def solve() -> int: regular_hours_pay = 15 * 40 overtime_pay = 22.5 * 10 total_pay = regular_hours_pay + overtime_pay result = total_pay return result
A store offers a 15% discount on the total bill. If the original bill was $200, what is the discounted amount?
def solve() -> int: bill = 200 discount = 0.15 discounted_amount = bill * (1-discount) result = discounted_amount return result
A company is releasing two new products, X and Y, with different probabilities of success. Product X has a 60% chance of being successful and a 40% chance of failing, while Product Y has a 30% chance of being successful and a 70% chance of failing. If the company needs at least one product to be successful to make a pr...
def solve() -> int: p_X = 0.6 p_fail_X = 0.4 p_Y = 0.3 p_fail_Y = 0.7 profit = p_X*(1-p_fail_Y) + p_Y*(1-p_fail_X) result = profit return result
Isaac has 40 candy bars. Ethan has 12 more candy bars than Isaac, and Chloe has 8 less candy bars than Isaac. How many candy bars do Ethan and Chloe have together?
def solve() -> int: isaac = 40 ethan = isaac + 12 chloe = isaac - 8 total = ethan + chloe result = total return result
Steve needs to drink 4 liters of water during his day-long camping trip. He drinks 300 milliliters every half-hour. After how many hours will he reach his daily goal?
def solve() -> int: water_goal = 4 water_per_half_hour = 0.3 hours = water_goal / (water_per_half_hour * 2) result = hours return result
James has a part-time job selling candy in a small store where he gets paid 10% commission on all sales he makes. If James sells $2000 worth of candy, how much money will he get paid?
def solve() -> int: total_sales = 2000 commission_per_sale = total_sales * 0.10 total_money_paid = commission_per_sale result = total_money_paid return result
Student: In a classroom of 50 students, 30 of them scored a passing grade, while the average of the passing grades is 82. What is the sum of all the passing grades?
def solve() -> int: num_students = 50 num_passing = 30 passing_avg = 82 sum_passing = num_passing * passing_avg result = sum_passing return result
A slice of pizza costs $3, while a slice of cake is 25% cheaper. Sam ordered four slices of pizza and two slices of cake. How much did he pay for his order?
def solve() -> int: pizza_cost = 3 cake_cost = pizza_cost * 0.75 pizza_total = pizza_cost * 4 cake_total = cake_cost * 2 total_cost = pizza_total + cake_total result = total_cost return result
A store gives a discount of 20% on all purchases above $100 and a gift card worth $20 on all purchases above $150. A customer purchases items worth $80, $90, $120, $140, and $180. What is the total discount the customer receives?
def solve() -> int: items = [80, 90, 120, 140, 180] total_price = sum(items) if total_price > 150: discount = 0.2 * total_price + 20 elif total_price > 100: discount = 0.2 * total_price else: discount =0 result = discount return result
A train travels at an average speed of 60 kilometers per hour for 2 hours, then slows down to 40 kilometers per hour for another hour, and finally stops at a station. How far is the station from the starting point of the train?
def solve() -> int: speed1 = 60 time1 = 2 distance1 = speed1 * time1 speed2 = 40 time2 = 1 distance2 = speed2 * time2 distance = distance1 + distance2 result = distance return result
Alyssa has 200 dollars as her monthly budget. She spends 85 dollars on groceries, 50 dollars on transportation, and 25 dollars on clothes. What percentage of her budget is left?
def solve() -> int: budget = 200 expenses = 85 + 50 + 25 remaining_budget_percentage = (budget - expenses) / budget * 100 result = remaining_budget_percentage return result
John owns 2 trucks. The following year, he multiplies the number of trucks by 5. In the third year, he sells 6 trucks, but then he gains 10 more trucks in the next year. In the fourth year, he adds twice asJohn and his friend purchase an apartment worth $120,000. They agree to split the cost based on the percentage of ...
def solve() -> int: trucks_year1 = 2 trucks_year2 = trucks_year1 * 5 trucks_year3 = trucks_year2 - 6 trucks_year4 = trucks_year3 + 10 trucks_year5 = trucks_year4 + (2 * trucks_year1) total_trucks = trucks_year1 + trucks_year2 + trucks_year3 + trucks_year4 + trucks_year5 john_share ...
A group of 5 friends went to a restaurant and the total cost of their meal is $125. They decided to split the bill equally. How much will each person pay?
def solve() -> int: total_cost = 125 num_people = 5 cost_per_person = total_cost / num_people result = cost_per_person return result
Frank and Michael shared a sum of money in the ratio of 5:3. If Frank got $35 more than Michael, how much money did Frank get?
def solve() -> int: difference = 35 total_ratio = 5+3 michael_ratio = 3/total_ratio frank_ratio = 5/total_ratio michael = difference/frank_ratio - difference total_money = michael/michael_ratio frank = total_money*michael_ratio*5 result = frank return result
Amy has 12 stickers. She gave 4 stickers to Bob and 2 stickers to Cathy. Then she received 3 stickers from Dan. How many stickers does Amy have now?
def solve() -> int: amy_stickers = 12 bob_stickers = 4 cathy_stickers = 2 dan_stickers = 3 amy_stickers = amy_stickers - bob_stickers - cathy_stickers amy_stickers = amy_stickers + dan_stickers result = amy_stickers return result
Emma and Olivia took a biology exam. Emma got 25% of the questions wrong while Olivia answered 20 questions incorrectly. If the exam consists of 60 items, how many more correct answers did Emma get than Olivia?
def solve() -> int: emma_wrong = 0.25 * 60 olivia_wrong = 20 emma_correct = 60 - emma_wrong olivia_correct = 60 - olivia_wrong emma_more_correct = emma_correct - olivia_correct result = emma_more_correct return result
A store is having a sale and is offering a discount of 25% off all items. If an item originally costs $80, what is the sale price of the item?
def solve() -> int: discounted_price = 80 * 0.75 result = discounted_price return result
-Try to use different modes of transportation and different units of time and distance. Avoid repeating the same keywords or numbers. Possible questions and programs are: Jane walks from her home to the library, which takes her 15 minutes. She then takes a bus that goes at an average speed of 30 km/h for 20 minutes, an...
def solve() -> int: walk_time = 15 walk_speed = 5 walk_distance = walk_time / 60 * walk_speed bus_time = 20 bus_speed = 30 bus_distance = bus_time / 60 * bus_speed bike_time = 10 bike_speed = 15 bike_distance = bike_time / 60 * bike_speed total_distance = walk_distance +...
A cube has an edge length of 10 inches. What is its volume in cubic inches?
def solve() -> int: edge_length = 10 volume = edge_length ** 3 result = volume return result
A company produces 250 units of a product in one day, and their production increases by 20% in the next day. If the company produces 500 units of the product on the third day, determine the production increase rate in percentage from day 2 to day 3.
def solve() -> int: initial_production = 250 day2_production = initial_production + (initial_production * 0.2) day2_to_day3_increase = ((500 - day2_production) / day2_production) * 100 result = day2_to_day3_increase return result
A movie ticket for an adult costs $10, and a senior citizen's ticket costs $5. One senior citizen is taking a group of adults to the movies. She has $50. How many adults can she take with her to the movies?
def solve() -> int: adult_ticket_price = 10 senior_ticket_price = 5 senior_budget = 50 num_adults = senior_budget // adult_ticket_price result = num_adults return result
Amy paints 5 pictures. Each picture takes her 2 hours to paint. She sells each picture for $15. How much money does she make from selling the pictures?
def solve() -> int: total_time = 5 * 2 total_income = 5 * 15 result = total_income return result
If a store sells 350 items in a day, and 245 of them were sold at full price, what percentage of items were sold with a discount?
def solve() -> int: items_sold = 350 full_price_sold = 245 discount_sold = items_sold - full_price_sold percentage_discount_sold = (discount_sold / items_sold) * 100 result = percentage_discount_sold return result
If a company has 24 employees, and each employee works for 8 hours a day, how many hours are collectively worked by the employees in one week’s work?
def solve() -> int: employees = 24 hours_per_day = 8 days_per_week = 5 total_hours = employees * hours_per_day * days_per_week result = total_hours return result
Joe has a pet dog and a pet cat. The dog weighs 50 pounds. The cat weighs 75% less. What is the combined weight of the two animals in pounds?
def solve() -> int: dog_weight = 50 cat_weight = dog_weight - (dog_weight * 0.75) combined_weight = dog_weight + cat_weight result = combined_weight return result
A square room has an area of 225 square feet. What is the length of each side of the room?
def solve() -> int: area = 225 side = area ** 0.5 result = side return result
A music streaming service offers a subscription for $5 per month or $50 per year. If a user subscribes for a year and then cancels the service after 7 months, how much money did they save compared to only subscribing monthly?
def solve() -> int: monthly_cost = 5 yearly_cost = 50 months_subscribed = 7 cost_monthly = monthly_cost * months_subscribed cost_yearly = yearly_cost savings = cost_yearly - cost_monthly result = savings return result
Q10: Fiona reads 50 pages per hour and Luke reads 70 pages per hour. When both of them read for 1 hour, how many pages does Luke read more than Fiona?
def solve() -> int: pages_Fiona = 50 pages_Luke = 70 time = 1 result = pages_Luke*time - pages_Fiona*time return result
Karen bought 6 hats for $18. If the hats are all the same price, how much does each hat cost?
def solve() -> int: num_hats = 6 total_cost = 18 cost_per_hat = total_cost / num_hats result = cost_per_hat return result
Emily invested $10,000 into a retirement account. The account promised a yearly interest rate of 4%. If she deposits an additional $500 every month into the account to add to her initial investment of $10,000, how much money will she have in the account after ten years?
def solve() -> int: initial_investment = 10000 monthly_deposit = 500 interest_rate = 0.04 years = 10 total_investment = initial_investment for i in range(years * 12): total_investment += monthly_deposit total_investment *= (1 + interest_rate) result = total_investme...
A delivery truck has a capacity of 2200 pounds. If the driver has loaded 1500 pounds of cargo, how many more pounds can the truck hold?
def solve() -> int: truck_capacity = 2200 current_cargo = 1500 remaining_capacity = truck_capacity - current_cargo result = remaining_capacity return result
``` John has 10 pennies, 12 dimes, and 6 nickels. He buys 4 packs of gum for 25 cents each and a pencil for 30 cents. If he pays with all the coins he has, how much money (in cents) will he have left?
def solve() -> int: total_pennies = 10 total_dimes = 12 total_nickels = 6 cost_gum = 4 * 25 cost_pencil = 30 total_money = (total_pennies * 1) + (total_dimes * 10) + (total_nickels * 5) money_left = total_money - cost_gum - cost_pencil result = money_left return result
A rectangle has 4 sides with the lengths of 10cm, 25cm, 15cm, and 18cm. What is the perimeter of the rectangle?
def solve() -> int: side_1 = 10 side_2 = 25 side_3 = 15 side_4 = 18 perimeter = side_1 + side_2 + side_3 + side_4 result = perimeter return result
Mike and his brother went out for lunch and the total was $70.00. Mike paid 60% of the bill. How much did Mike pay?
def solve() -> int: total_bill = 70 percentage = 0.6 result = total_bill * percentage return result
Student: Lisa and her friend Amy baked cookies. Each cookie had 2 chocolate chips. Lisa baked 12 cookies. Amy baked 15 cookies. How many chocolate chips did they use in total?
def solve() -> int: cookies_lisa = 12 cookies_amy = 15 chips_per_cookie = 2 total_chips = cookies_lisa * chips_per_cookie + cookies_amy * chips_per_cookie result = total_chips return result