question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A farmer has 15 cows in his barn. He sold 6 of them at the market and bought 10 more to add to his herd. How many cows does he have now?
def solve() -> int: cows_in_barn = 15 cows_sold = 6 cows_bought = 10 cows_remaining = cows_in_barn - cows_sold cows_now = cows_remaining + cows_bought result = cows_now return result
Mary wants to grow her shoe collection and asked her family to gift her shoes. On her graduation, she received 16 new shoes, and on her birthday, she received 10 more shoes. Mary already had 80% of the total number of shoes she received on both occasions. How many shoes does Mary now own?
def solve() -> int: total_shoes = 16 + 10 known_percentage = 0.8 known_shoes = total_shoes * known_percentage new_shoes = total_shoes - known_shoes total_owned = known_shoes + new_shoes result = total_owned return result
Jackson bought 2 shirts at $14 each and 3 pants at $18 each. If he received a $5 discount, what is the total cost of his purchase?
def solve() -> int: shirt_cost = 14 num_shirts = 2 pants_cost = 18 num_pants = 3 discount = 5 total_cost = (shirt_cost*num_shirts) + (pants_cost*num_pants) - discount result = total_cost return result
Leo and his two sisters wanted to buy a gift for their mother's birthday. They decided to buy her a necklace that cost $75. Leo had $25 saved from his allowance, and his sisters each had $15. They also had a coupon that gave them 10% off the necklace. How much more money did they need to buy the necklace?
def solve() -> int: total = 25 + 15 + 15 discounted = 75 * 0.9 difference = discounted - total result = difference return result
If a person runs 8 kilometers in 45 minutes, what is their average speed in kilometers per hour?
def solve() -> int: distance = 8 time_minutes = 45 time_hours = time_minutes / 60 average_speed = distance / time_hours result = average_speed return result
Mr. Jackson bought a pack of 24 pencils for his students. If Mr. Jackson kept 2 pencils but each student got to use 3 pencils, how many students were there?
def solve() -> int: pencils_in_pack = 24 pencils_kept = 2 pencils_per_student = 3 pencils_given = pencils_in_pack - pencils_kept students = pencils_given / pencils_per_student result = students return result
Q2: Sarah goes to the mall for 2 hours and 45 minutes. She spends $1.25 for every 9 minutes. How much money did she spend, in dollars?
def solve() -> int: time = 165 cost = 1.25 total_cost = time * (cost/9) result = total_cost return result
At a party, Emily had 10 cookies. Her friend Jake gave her one-sixth of his 42 cookies. How many cookies did Emily have after that?
def solve() -> int: emilys_cookies = 10 jakes_cookies = 42 cookies_given = jakes_cookies / 6 emilys_cookies += cookies_given result = emilys_cookies return result
After a big promotion, there were 536 t-shirts left at the store. If they had originally ordered 1,256 t-shirts and sold 684 that day, how many t-shirts were at the store before the promotion?
def solve() -> int: original_order = 1256 sold_today = 684 left_at_store = 536 total_before_promotion = original_order - sold_today + left_at_store result = total_before_promotion return result
Alex buys 1 croissant a day. He grabs a chocolate croissant for $2.00 every morning. In the afternoons, he grabs a plain croissant for $1.50. After 30 days, how much money has he spent on croissants?
def solve() -> int: morning_croissant_cost = 2.00 afternoon_croissant_cost = 1.50 days = 30 morning_croissants = days afternoon_croissants = days total_cost = morning_croissants * morning_croissant_cost + afternoon_croissants * afternoon_croissant_cost result = total_cost ...
In a classroom with 30 students, 17 are girls. If each girl has 3 pencils and each boy has 2 pencils, and there are 4 more boys than girls in the classroom, how many pencils are in the classroom in total?
def solve() -> int: girls = 17 boys = girls + 4 total_students = girls + boys pencils_girls = girls * 3 pencils_boys = boys * 2 total_pencils = pencils_girls + pencils_boys result = total_pencils return result
Emily has 9 pairs of shoes and she discovered that she already had 4 pairs in her closet. If she wears a pair of shoes for 20 days on average and she needs 5 pairs left unused, how many days can she wear her shoes without repeating a pair?
def solve() -> int: total_shoes = 9 * 2 shoes_in_closet = 4 * 2 shoes_left = total_shoes - shoes_in_closet - 5 days_without_repeating = shoes_left * 20 result = days_without_repeating return result
Student: If a student earns 4 points after completing 5 tests, how many points should the student have after completing 18 tests?
def solve() -> int: points = 4 tests = 5 x = 18 * points / tests result = x return result
Ethan has a fondness for cars and motorcycles. If he buys half as many motorcycles as cars, he spends 85% of his money on cars and the rest on motorcycles. If he has $500, how many motorcycles can he buy if they cost $50,000 each?
def solve() -> int: num_cars = 2 num_motorcycles = 1 total_money = 500 money_spent_on_cars = total_money * 0.85 money_spent_on_motorcycles = total_money - money_spent_on_cars num_motorcycles_can_buy = money_spent_on_motorcycles / 50000 result = num_motorcycles_can_buy ...
If Sarah runs 2/3 as far as Jessica and Jessica runs 18 miles, how far does Sarah run? If Sarah burns 80 calories per mile and Jessica burns 90 calories per mile, how many calories did they burn in total?
def solve() -> int: jessica_distance = 18 sarah_distance = (2/3) * jessica_distance sarah_calories = sarah_distance * 80 jessica_calories = jessica_distance * 90 total_calories = sarah_calories + jessica_calories result = total_calories return result
Kyle has $15.00 worth of quarters. His friend, Tyler has one-fourth of that amount but then loses $3.00 at the video arcade. How many quarters does Tyler have left? Emily rides her bike for 20 minutes to get to work each day. On Fridays, she works from home and doesn't ride her bike. If Emily ideally wants to bike for ...
def solve() -> int: kyle_quarters = 15.00 / 0.25 tyler_quarters = kyle_quarters / 4 - 3.00 / 0.25 emily_missed = 4 * (30 - 20) + 0 result = tyler_quarters * 1 result = emily_missed return result
Maria has 25 books in her collection. If she gives away 4 books to her friend, how many will she have left?
def solve() -> int: books_in_collection = 25 books_given_away = 4 books_left = books_in_collection - books_given_away result = books_left return result
Eleven fruit companies donated to a local food bank. If each company donated 25 boxes of apples, and 30% of the companies also donated 50 boxes of oranges, how many boxes of fruit were donated in total?
def solve() -> int: num_companies = 11 apple_boxes = 25 * num_companies orange_boxes = 0.3 * num_companies * 50 total_boxes = apple_boxes + orange_boxes result = total_boxes return result
Ashley did 7 runs around the track. On each run, she spent 30 minutes jogging and 10 minutes walking. What percentage of the total time she used up for the runs did Ashley spend jogging?
def solve() -> int: runs = 7 jogging_time = 30 walking_time = 10 total_time = (jogging_time + walking_time) * runs jogging_percentage = (jogging_time * runs) / total_time * 100 result = jogging_percentage return result
Leo sells lemonade at his stand for $0.25 per cup. He buys the lemons for $0.10 each and the sugar for $0.05 per cup. He has already sold 80 cups and has 20 lemons left. How many more cups can he sell before he runs out of lemons or sugar?
def solve() -> int: sugar_left = 0.05 * 80 lemon_cups = 20 / 0.1 min_cups = min(sugar_left, lemon_cups) result = min_cups return result
The circumference of a circle is 288 cm, what is the area of the circle?
def solve() -> int: circum_circle = 288 radius_circle = circum_circle/2/3.14 area_circle = radius_circle**2 * 3.14 result = area_circle return result
Greg starts out as 55 inches tall and grows 15 percent. If Greg then grows 3 more inches, how many inches tall is Greg now?
def solve() -> int: start_height = 55 percentage_growth = 0.15 height_growth = 3 height = start_height + (start_height * percentage_growth) + height_growth result = height return result
2. Tony is a baker. He bakes muffins and sells them to people. He charges $3 for a large muffin and $1 for a regular-sized muffin. Last month he sold 10 large muffins and 8 regular-sized muffins. If he sold half as much this month, how much is his sales for this month?
def solve() -> int: large_muffins_last_month = 10 regular_muffins_last_month = 8 large_muffins_this_month = 0.5 * large_muffins_last_month regular_muffins_this_month = 0.5 * regular_muffins_last_month price_large_muffin = 3 price_regular_muffin = 1 total_sales_this_month = (la...
The perimeter of a square is 32 meters. What is the length of one side of the square?
def solve() -> int: perimeter = 32 side_length = perimeter / 4 result = side_length return result
Caroline & Jacob have a combined weight of 345 pounds. If Caroline weighs 45 pounds more than Jacob, how much does Jacob weigh?
def solve() -> int: caroline_weight = 345 / 2 jacob_weight = caroline_weight - 45 result = jacob_weight return result
Gina had to pick 12 baskets of strawberries. On Monday she picked half of the baskets, on Tuesday she managed 3/8 of the remaining baskets, and then she picked 4/7 of the remaining baskets on Wednesday. How many total baskets of strawberries did Gina pick that week?
def solve() -> int: total_baskets = 12 baskets_monday = total_baskets/2 remaining_baskets = total_baskets - baskets_monday baskets_tuesday = (3/8) * remaining_baskets last_remaining_baskets = remaining_baskets - baskets_tuesday baskets_wednesday = (4/7) * last_remaining_baskets result = bask...
Jake plays 3 video games for 2 hours each and 2 board games for 45 minutes each. How long does he spend playing games?
def solve() -> int: video_games_time = 3 * 2 * 60 board_games_time = 2 * 45 total_time = video_games_time + board_games_time result = total_time return result
A company has 120 male employees and 180 female employees. If the average salary of male employees is $2500, and the average salary of female employees is $3000, what is the total salary of all employees?
def solve() -> int: num_male_employees = 120 num_female_employees = 180 male_salary = 2500 female_salary = 3000 total_salary = num_male_employees * male_salary + num_female_employees * female_salary result = total_salary return result
Grace has two suitcases. Each suitcase weighs 1/9 as much as Chloe's suitcase, which weighs 27 pounds. What is the total weight of Grace's suitcases?
def solve() -> int: chloes_suitcase_weight = 27 graces_suitcase_weight = chloes_suitcase_weight / 9 total_weight = graces_suitcase_weight * 2 result = total_weight return result
A can fill a tank in 30 minutes. B can fill the same tank in 60 minutes. How long it would take them to fill the tank together?
def solve() -> int: tank = 1 fill_rate_A = tank / 30 fill_rate_B = tank / 60 fill_rate_AB = fill_rate_A + fill_rate_B time = tank / fill_rate_AB result = time*60 return result
In a park, there are twice as many ducks as there are swans. If there are 30 swans, how many ducks are in the park?
def solve() -> int: swans = 30 ducks = 2 * swans result = ducks return result
Lily is driving to her friend's wedding, which is 400 miles away. Her car can get 24 miles to the gallon and has a 16-gallon gas tank. How many more miles will she be able to drive after the wedding before needing to refuel?
def solve() -> int: distance = 400 fuel_efficiency = 24 gas_tank_capacity = 16 total_distance = fuel_efficiency * gas_tank_capacity distance_to_wedding = min(distance, total_distance) remaining_distance = distance - distance_to_wedding result = remaining_distanc...
Emma collected 48 stamps from different countries. She gave away 12 stamps to her friends and sold 10 stamps for 50 cents each. How much money did Emma earn from selling the stamps?
def solve() -> int: stamps_left = 48 - 12 - 10 money_earned = 10 * 0.5 result = money_earned return result
Jenny bought 5 packs of pencils with 10 pencils in each pack, but she gave her friend Cindy 3 packs. How many pencils does Jenny have left?
def solve() -> int: initial_packs = 5 initial_pencils_per_pack = 10 given_packs = 3 remaining_packs = initial_packs - given_packs remaining_pencils = remaining_packs * initial_pencils_per_pack result = remaining_pencils return result
There are 24 small bags of candies. Sophia ate 1/3 of the candies in 3 of the bags. Each bag initially contained the same amount of candies. If the total weight of the candies in the 3 bags was 240 grams, how much does one candy weigh?
def solve() -> int: eaten_candy = (1/3) * (24*3) one_candy_weight = 240 / eaten_candy result = one_candy_weight return result
Mason wants to donate his hair to help make wigs for cancer survivors. He needs to donate 24 inches, but his hair is currently only 14 inches long. If he wants to keep his hair at a length of 11 inches after the donation, how much longer does he have to grow his hair?
def solve() -> int: hair_needed = 24 current_length = 14 desired_length = 11 length_to_grow = hair_needed - (current_length - desired_length) result = length_to_grow return result
When the museum opened, there were 35 paintings on display. Eleven more were added and seven were taken down for restoration. How many paintings are on display now?
def solve() -> int: paintings_on_display = 35 paintings_added = 11 paintings_restored = 7 total_paintings = paintings_on_display + paintings_added - paintings_restored result = total_paintings return result
Here are some possible questions and programs: Lila bought some stickers and pens from a stationery store. She paid $8.40 in total and got 12 stickers and 4 pens. How much did one pen cost, if one sticker cost $0.50?
def solve() -> int: sticker_cost = 0.50 sticker_number = 12 total_sticker_cost = sticker_cost * sticker_number total_cost = 8.40 remaining_cost = total_cost - total_sticker_cost pen_number = 4 pen_cost = remaining_cost / pen_number result = pen_cost return result
Alex completed a 10km race in 45 minutes. He increased his speed by 20% and participated in another race. How long did it take him to complete the second race?
def solve() -> int: time = 45 * 1.2 result = time/60 return result
Student: Joe wants to drive to his grandparents house, which is 200 miles away. His car has an average mileage of 25 miles/gallon. How many gallons of gas will Joe need to make the trip?
def solve() -> int: distance = 200 mileage = 25 gallons_needed = distance / mileage result = gallons_needed return result
John has a collection of 42 toy cars. He gave 25% of his collection to his cousin. Then, he went to the shop and bought 15 more toy cars. What is the total number of toy cars does he have now?
def solve() -> int: toy_cars = 42 gifted_cars = toy_cars * 0.25 toy_cars_left = toy_cars - gifted_cars toy_cars_left += 15 result = toy_cars_left return result
At Samantha's Sushi Shack, there is a 2-for-1 deal on California rolls and a buy-2-get-1-free special on spicy tuna rolls. If the original price for a roll is $4, what will be the total cost to buy 12 California rolls and 11 spicy tuna rolls using the promotional pricing?
def solve() -> int: california_roll_price = 4 spicy_tuna_roll_price = 4 california_roll_count = 12 spicy_tuna_roll_count = 11 california_roll_discount = california_roll_count // 2 spicy_tuna_roll_discount = spicy_tuna_roll_count // 3 california_roll_total = (california_roll_co...
There are twice as many books on the top shelf as there are on the bottom shelf. If there are 24 books in total, how many books are on the bottom shelf?
def solve() -> int: top_shelf = 2 total_books = 24 bottom_shelf = total_books / (top_shelf + 1) result = bottom_shelf return result
A book has 285 pages. If Juanita reads 15 pages a day, how many days will it take her to finish the book?
def solve() -> int: pages_total = 285 pages_read_day = 15 days_needed = pages_total/pages_read_day result = days_needed return result
In a dog park, there were 18 corgis, 24 beagles, and several dachshunds. If there were 2/5 as many dachshunds as corgis and beagles combined, then what was the total number of dogs at the dog park?
def solve() -> int: corgis = 18 beagles = 24 dachshunds = 2/5 * (corgis + beagles) total_dogs = corgis + beagles + dachshunds result = total_dogs result return result
Tim has a beehive in his backyard, and it has just started to produce honey. In the first week, he harvested 4 ounces. The next week, the amount of honey doubled as much as it had the first week. In the third week, he was able to gather 3 times as much honey as he did in the previous week. How much honey did Tim collec...
def solve() -> int: week_1 = 4 week_2 = week_1 * 2 week_3 = week_2 * 3 result = week_1 + week_2 + week_3 return result
A store has a sale with a discount of 15%. If a shirt that normally costs $40 is purchased during the sale, what is its discounted price?
def solve() -> int: original_price = 40 discount_percentage = 15 discount_amount = original_price * discount_percentage/100 discounted_price = original_price - discount_amount result = discounted_price return result
To build a birdhouse, Jessica needs 3 2/3 sheets of wood. If she already has one 1/3 sheet, how many more should she buy?
def solve() -> int: existing = 1 + 1/3 required = 3 + 2/3 total_required = required - existing result = total_required return result
Olivia wanted to purchase some furniture for her apartment. She needed a sofa, a coffee table, and some chairs. The price of a sofa was $800, and the coffee table was 80% of that price. The chairs cost $120 each, but due to a sale, Olivia got them for 15% cheaper. What was the total cost of all the furniture?
def solve() -> int: sofa_price = 800 coffee_table_price = 0.8 * sofa_price chair_price = 120 discounted_chair_price = 0.85 * chair_price total_cost = sofa_price + coffee_table_price + (4 * discounted_chair_price) result = total_cost return result
A recipe for a cake requires 3 cups of flour, 2 cups of sugar and 4 eggs. How many cakes can you make with 12 cups of flour, 10 cups of sugar and 16 eggs? Assume that you use the exact amount of ingredients for each cake.
def solve() -> int: flour_per_cake = 3 sugar_per_cake = 2 eggs_per_cake = 4 flour = 12 sugar = 10 eggs = 16 cakes_with_flour = flour // flour_per_cake cakes_with_sugar = sugar // sugar_per_cake cakes_with_eggs = eggs // eggs_per_cake cakes = min(cakes_with_flour, cakes_with_sugar...
- Emma is planning a picnic for 11 people. She bought 8 sandwiches and 11 bags of chips. How many sandwiches is each person able to get?
def solve() -> int: a=8 b=11 result = a/b return result
Emily is part of a film club that allows each member to take a turn choosing a new movie every week. The club is made up of four couples and six single people along with Emily. How many times a year does Emily get to choose a new movie?
def solve() -> int: couples = 4 single_people = 6 emily = 1 total_members = couples * 2 + single_people + emily movies_per_week = total_members // 2 movies_per_year = movies_per_week * 52 result = movies_per_year return result
A train covers a distance of 480 kilometers in 6 hours. What is the average speed of the train in kilometers per hour?
def solve() -> int: distance = 480 time = 6 speed = distance / time result = speed return result
A company has 15 employees. If the average salary is $3000 a month, what is the total monthly salary bill for the company?
def solve() -> int: total_salary = 15 * 3000 result = total_salary return result
Devin can type 120 words per minute. If he spends 40 minutes writing an essay, how many words did he type?
def solve() -> int: words_per_minute = 120 time = 40 total_words = words_per_minute * time result = total_words return result
During a sale, Ms. Davis has 900 shirts to sell. Thirty people come in and buy 20 shirts each. How many shirts remain at the end of the sale?
def solve() -> int: shirts_available = 900 people = 30 shirts_bought_per_person = 20 total_shirts_bought = people * shirts_bought_per_person shirts_remaining = shirts_available - total_shirts_bought result = shirts_remaining return result
Student: 10. A construction company spends $600,000 to build a house. The house is then sold for $1,000,000. How much more money does the company make from the sale than it spends?
def solve() -> int: spent = 600000 sold = 1000000 difference = sold - spent result = difference return result
In a week, Sarah worked 38 hours in the first five days, and 8 hours each on the remaining two days. If the average working hours per day for the week is 7 hours, how many hours did Sarah work on the first three days?
def solve() -> int: total_hours = 7 * 7 hours_worked = 38 + 8 + 8 remaining_hours = total_hours - hours_worked hours_for_first_three_days = 7 * 3 - remaining_hours result = hours_for_first_three_days return result
A restaurant sells 120 pizzas and 80 salads per day. A pizza costs $15 and a salad costs $8. How much profit does the restaurant make in a week if the cost of making a pizza is $10 and the cost of making a salad is $5? Assume a week has 7 days.
def solve() -> int: pizzas = 120 salads = 80 pizza_price = 15 salad_price = 8 pizza_cost = 10 salad_cost = 5 days = 7 daily_revenue = pizzas * pizza_price + salads * salad_price daily_cost = pizzas * pizza_cost + salads * salad_cost daily_profit = daily_reve...
``` Sara has a monthly budget of $1000. She spends 30% of her budget on rent, 20% on groceries, and 15% on entertainment. How much money in dollars does she have leftover?
def solve() -> int: budget = 1000 rent = budget*0.3 groceries = budget*0.2 entertainment = budget*0.15 leftover = budget-rent-groceries-entertainment result = leftover return result
A cake recipe calls for 2 cups of sugar and 1 cup of flour. If you want to bake 4 cakes, how much sugar and flour will you need?
def solve() -> int: sugar_per_cake = 2 flour_per_cake = 1 cakes = 4 total_sugar = sugar_per_cake * cakes total_flour = flour_per_cake * cakes result = (total_sugar, total_flour) return result
A baseball league is composed of 10 teams and each of them plays against every other team two times a season. How many games will be played in total in one season?
def solve() -> int: teams = 10 games_per_team = (teams-1)*2 total_games = int((teams*games_per_team)/2) result = total_games return result
The ratio of the salaries of John and Nick is 5:8. If John's salary is $3000, what is Nick's salary?
def solve() -> int: john_salary = 3000 salary_ratio = 5 / 8 nick_salary = john_salary / salary_ratio result = nick_salary return result
A train travels 200 miles in 2 hours. If the train maintains the same speed, how many miles will it travel in 5.5 hours?
def solve() -> int: mph = 200 / 2 distance = mph * 5.5 result = distance return result
Student: A store sells 500 pens, and 40% of the pens are of blue color, 35% are of green color, 10% are of red color, and 15% are of yellow color. How many pens are of blue color?
def solve() -> int: total_pens = 500 blue_pens = 0.4 * total_pens result = blue_pens return result
In a store, the price of a television set increases by 25% and later decreases by 20%. If the original price of the television set was $500, calculate its final selling price.
def solve() -> int: price = 500 increase_percent = 25 decrease_percent = 20 increase_amount = price * (increase_percent / 100) new_price = price + increase_amount decrease_amount = new_price * (decrease_percent / 100) selling_price = new_price - decrease_amount result = selling_price ...
Emily is trying to decrease her stress levels. For every 15 minutes of meditation, she feels 10% less stressed. If a meditation session costs $5, how much would it cost for Emily to reduce her stress level by 60%?
def solve() -> int: meditation_time = 15 stress_reduction = 0.1 meditation_cost = 5 sessions_needed = round(0.6 / stress_reduction) total_time = sessions_needed * meditation_time total_cost = sessions_needed * meditation_cost result = total_cost return result
In a school, there are 3 grades. In grade 1, there are 25 students. In grade 2, there are 30 students. In grade 3, there are 35 students. Each student in grade 1 has 2 books. Each student in grade 2 has 3 books. Each student in grade 3 has 4 books. How many books are there in the school?
def solve() -> int: grade1_books = 2 grade2_books = 3 grade3_books = 4 grade1_students = 25 grade2_students = 30 grade3_students = 35 total_books = grade1_students * grade1_books + grade2_students * grade2_books + grade3_students * grade3_books result = total_books return result
8. Abigail needs to buy 10 packs of chips for her party. Each pack contains 6 chips. How many chips does she need in total?
def solve() -> int: total_chips = 0 num_pack = 10 chips_per_pack = 6 for pack in range(num_pack): total_chips += chips_per_pack result = total_chips return result
``` Find the midpoint between the points (8, 5) and (-3, 2).
def solve() -> int: x1 = 8 y1 = 5 x2 = -3 y2 = 2 midpoint_x = (x1 + x2) / 2 midpoint_y = (y1 + y2) / 2 result = (midpoint_x, midpoint_y) return result
hirley's restaurant ordered new dinnerware. Each set of dinnerware cost $30 and the restaurant ordered 10 sets. How much did they spend on the dinnerware?
def solve() -> int: price_per_set = 30 sets = 10 total_spent = price_per_set * sets result = total_spent return result
A school has 150 students. If 60% of the students are girls, how many boys are in the school?
def solve() -> int: total_students = 150 girls = total_students * 0.6 boys = total_students - girls result = boys return result
A store bought 3 boxes of apples, each containing 24 apples. They sold 36 apples for $0.50 each, 10 apples for $0.75 each, and the rest for $0.25 each. In dollars, how much money did the store make?
def solve() -> int: apples_total = 3 * 24 apples1_price = 36 * 0.5 apples2_price = 10 * 0.75 apples3_price = (apples_total - 36 - 10) * 0.25 result = apples1_price + apples2_price + apples3_price return result
Mary earns twice the amount of money that Sam earns. If Mary earns $10 per hour, how much money does Sam earn in 8 hours of work?
def solve() -> int: hours_worked = 8 sam_rate = 10/2 sam_earnings = sam_rate*hours_worked result = sam_earnings return result
A triangle has a base of 6 and a height of 4. What is the area of the triangle?
def solve() -> int: base = 6 height = 4 area = 0.5 * base * height result = area return result
Samantha has $300 in her bank account. She withdraws 40% of it to buy a new dress. Afterwards, she deposits $50 back into her account. How much money does she have now?
def solve() -> int: account_balance = 300 withdrawal_amount = account_balance * 0.4 account_balance -= withdrawal_amount account_balance += 50 result = account_balance return result
Thomas bought a computer for $800, which was 10% off the original price. How much was the original price?
def solve() -> int: price = 800 discount = 0.10 originalprice = price/(1-discount) result = round(originalprice,2) return result
A store offers a 10% discount on a $80 item. What is the new price?
def solve() -> int: original_price = 80 discount = 0.1 discount_amount = original_price * discount new_price = original_price - discount_amount result = new_price return result
A book has 280 pages. If there are 25 lines per page and 50 letters per line, how many letters are in the book in total?
def solve() -> int: total_pages = 280 lines_per_page = 25 letters_per_line = 50 total_letters = total_pages * lines_per_page * letters_per_line result = total_letters return result
Adam has a total of $78. He spends one third of it to buy candy and the remaining is split between will and Lisa equally. How much money does each of them receive?
def solve() -> int: total = 78 spent_on_candy = total/3 remaining = total-spent_on_candy each = remaining/2 result = each return result
Jake has a fish tank that can hold 20 gallons of water. He fills it up halfway with water and adds 5 fish. Each fish needs 2 gallons of water to survive. How many more fish can Jake add to the tank without overflowing it or harming the fish?
def solve() -> int: water_half = 20 / 2 water_fish = 5 * 2 water_left = water_half - water_fish fish_more = water_left / 2 fish_more = int(fish_more) result = fish_more return result
A store is running a sale where customers receive a 25% discount on all items. If a shirt costs $20 and shoes cost $60, how much will it cost to buy one shirt and one shoe after the discount?
def solve() -> int: shirt_cost = 20 shoe_cost = 60 total_cost = shirt_cost + shoe_cost discounted_cost = total_cost * 0.75 result = discounted_cost return result
Maria and John are planting seedlings in their garden. Maria can plant 6 seedlings in 8 minutes and John can plant 7 seedlings in 10 minutes. If they need to plant 200 seedlings, how long will it take for them to finish planting?
def solve() -> int: maria_seedlings_per_minute = 6/8 john_seedlings_per_minute = 7/10 total_seedlings = 200 total_seedlings_per_minute = maria_seedlings_per_minute + john_seedlings_per_minute time_to_finish = total_seedlings / total_seedlings_per_minute result = time_to_finish ...
Riley is 10 years old. His father is twice as old as his mother and his mother is four years younger than his father. How old is Riley's father?
def solve() -> int: father_age = (10*2+4) result = father_age return result
There are 24 hours in one day. If you have 4320 minutes, how many days do you have?
def solve() -> int: minutes_per_day = 24*60 days = 4320/minutes_per_day result = days return result
Julia bought some books at a bookstore. She bought 3 hardcover books and 5 paperback books. She paid $76 in total. If each hardcover book cost $12, how much did she pay for each paperback book?
def solve() -> int: hardcover = 3 hardcover_cost = 12 paperback = 5 total = 76 hardcover_total = hardcover * hardcover_cost paperback_total = total - hardcover_total paperback_cost = paperback_total / paperback result = paperback_cost return result
Student: A square has an area of 49 square meters. What is the length of one side of the square?
def solve() -> int: area = 49 side_length = area ** 0.5 result = side_length return result
A recipe for a cake requires 3 eggs, 2 cups of flour, and 1 cup of sugar. How many cakes can Ben make if he has 12 eggs, 10 cups of flour, and 4 cups of sugar?
def solve() -> int: eggs_per_cake = 3 flour_per_cake = 2 sugar_per_cake = 1 cakes_with_eggs = 12 // eggs_per_cake cakes_with_flour = 10 // flour_per_cake cakes_with_sugar = 4 // sugar_per_cake cakes = min(cakes_with_eggs, cakes_with_flour, cakes_with_sugar) result = cakes return res...
Maria bakes 15 cakes each day. If she has baked for 8 days, how many cakes has she baked in total?
def solve() -> int: cakes_per_day = 15 days_baked = 8 result = cakes_per_day * days_baked return result
Samantha has 25 contacts on her email list. She has five fewer school friends than half the number of her email contacts. She also has her best friend and three coworkers on her contact list. How many people are on Samantha's email contact list?
def solve() -> int: email_contacts = 25 school_friends = (email_contacts / 2) - 5 best_friend = 1 coworkers = 3 total_contacts = email_contacts + school_friends + best_friend + coworkers result = total_contacts return result
A chef cooked 30 pizzas. One-sixth of the pizzas were vegetarian and the rest were non-vegetarian. One-third of the non-vegetarian pizzas were with chicken, one-fourth were with beef, and the rest were with pepperoni. How many non-vegetarian pizzas were with pepperoni?
def solve() -> int: total_pizzas = 30 vegetarian_pizzas = total_pizzas / 6 non_vegetarian_pizzas = total_pizzas - vegetarian_pizzas chicken_pizzas = non_vegetarian_pizzas / 3 beef_pizzas = non_vegetarian_pizzas / 4 pepperoni_pizzas = non_vegetarian_pizzas - chicken_pizza...
Lily sells cupcakes. She sold four times as many cupcakes in May as she sold in April. In June, Lily sold a sixth of what she sold in May. If Lily sold 10000 cupcakes in June, how many cupcakes did she sell from April to June?
def solve() -> int: april_cupcakes = 10000 / (4 * (1/6)) may_cupcakes = 4 * april_cupcakes june_cupcakes = 10000 total_cupcakes = april_cupcakes + may_cupcakes + june_cupcakes result = total_cupcakes return result
Mary went to a music store and bought 2 CDs for $10 each. She also bought a pair of headphones for $25. She paid the cashier $45. How much change did she receive?
def solve() -> int: CDs_cost = 2 * 10 headphones_cost = 25 total_cost = CDs_cost + headphones_cost change = 45 - total_cost result = change return result
Kim can sew a dress that requires 2 m of fabric in 3 hours. How much fabric does she need to sew a dress that takes 5 hours?
def solve() -> int: fabric_per_hour = 2 / 3 fabric = fabric_per_hour * 5 result = fabric return result
Emily has a collection of 76 fruit, which includes oranges and bananas. She has 18 more oranges than bananas. If she divides her collection equally into 4 baskets, how many oranges will be in each basket?
def solve() -> int: total_fruit = 76 x = (total_fruit - 18) // 2 num_baskets = 4 oranges_per_basket = (x + 18) // num_baskets result = oranges_per_basket return result
A truck travels at a speed of 40 miles per hour for the first 4 hours, then at a speed of 60 miles per hour for the next 3 hours. If the truck covers a total distance of 280 miles, what is its average speed during the whole journey?
def solve() -> int: distance1 = 40*4 distance2 = 60*3 total_distance = distance1+ distance2 total_time = 4+3 average_speed = total_distance/total_time result = average_speed return result
A box contains 50 marbles of different colors. If 1/5 of the marbles are red, 2/5 are blue, and the rest are green, how many green marbles are there?
def solve() -> int: red_marbles = 50 * (1/5) blue_marbles = 50 * (2/5) green_marbles = 50 - red_marbles - blue_marbles result = green_marbles return result
A box of pencils has 48 pencils in it. If Jill wants to buy 6 boxes of pencils, how many pencils will she have in total?
def solve() -> int: pencils_per_box = 48 quantity = 6 total_pencils = pencils_per_box * quantity result = total_pencils return result
am has a jar of 50 marbles. He gives 10 marbles to each of his friend. How many marbles does he have left?
def solve() -> int: marbles = 50 marbles -= (10 * 3) result = marbles return result
John drinks at least 2 liters of water per day. Every 5th day, he drinks twice as much. If he follows his regime for a year, how many liters of water will he drink?
def solve() -> int: water_per_day = 2 twice_every = 5 extra_water = 2 days_per_year = 365 total_water = 0 for day in range(1, days_per_year+1): if day % twice_every == 0: total_water += water_per_day * extra_water else: total_water += water_per_day res...