question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Student: A store sells watermelons. Each watermelon weighs 15 kilograms. If a truck can carry a maximum of 1200 kilograms, how many watermelons can be loaded into the truck?
def solve() -> int: weight_of_watermelon = 15 max_weight_of_truck = 1200 num_of_watermelons = max_weight_of_truck // weight_of_watermelon result = num_of_watermelons return result
Student: Sophie read 48 pages of a book in one hour. She read the same number of pages every 15 minutes. She stopped reading after 2 hours and 45 minutes. How many pages of the book did she read in total?
def solve() -> int: pages_per_hour = 48 pages_per_15min = pages_per_hour / 4 reading_time = 2.75 total_pages = pages_per_15min * reading_time * 4 result = total_pages return result
It takes a worker 45 minutes to complete one task. How many tasks can be completed in 7 hours?
def solve() -> int: mins_in_hour = 60 tasks_per_hour = mins_in_hour / 45 hours = 7 result = int(tasks_per_hour * hours) return result
Alex and Zoe went to a restaurant. They ordered fried rice and noodle. Alex ordered 2 plates of fried rice and 1 plate of noodle, while Zoe ordered 1 plate of fried rice and 2 plates of noodle. The cost of each plate of fried rice is $5.50 and each plate of noodle is $4.25. How much did they spent in total?
def solve() -> int: fr_price = 5.50 n_price = 4.25 alex_fr = 2 alex_n = 1 zoe_fr = 1 zoe_n = 2 alex_total = (alex_fr * fr_price) + (alex_n * n_price) zoe_total = (zoe_fr * fr_price) + (zoe_n * n_price) total_spent = alex_total + zoe_total result = total_spent return result
Alex wants to buy a new guitar for his band's upcoming gig. The cost of the cheapest guitar is $300, and the most expensive in the store is 5 times more expensive. If Alex has $1500, how much money will he have remaining after buying the most expensive guitar?
def solve() -> int: cheapest_guitar = 300 most_expensive_guitar = 5 * cheapest_guitar total_money = 1500 money_spent = most_expensive_guitar remaining_money = total_money - money_spent result = remaining_money return result
A school is organizing a field trip and needs to rent an activity center. The rental fee is $200 and they need to have an additional $50 for snacks and drinks. If their budget is $1500, how many field trips can they organize in total?
def solve() -> int: rental_fee = 200 snacks_and_drinks = 50 budget = 1500 total_cost = rental_fee + snacks_and_drinks remaining_budget = budget - total_cost trips = remaining_budget // total_cost result = trips return result
A store sells apples for $0.50 each and bananas for $0.75 each. If Mary buys 4 apples and 2 bananas, how much did she spend?
def solve() -> int: total_spent = 4 * 0.50 + 2 * 0.75 result = total_spent return result
A recipe for a cake requires 2.5 cups of flour, 1 cup of sugar, and 0.75 cups of oil. If the recipe is doubled, how many cups of each ingredient would be required in total?
def solve() -> int: flour = 2.5 sugar = 1 oil = 0.75 flour *= 2 sugar *= 2 oil *= 2 result = flour + sugar + oil return result
A single scoop of vanilla ice cream contains 120 calories, and a sugar-free ice cream contains half as many calories as the traditional one. How many calories are there in a mixture of one-fourth scoop of sugar-free ice cream and three-fourth scoops of traditional ice cream?
def solve() -> int: sugar_free_calories = 120 / 2 traditional_calories = 120 mixture_calories = (1/4) * sugar_free_calories + (3/4) * traditional_calories result = mixture_calories return result
Student: Jason is building a container out of squares. Each square is 6 inches wide. If the container is 60 inches long, how many squares does Jason need to build the container?
def solve() -> int: square_width = 6 container_length = 60 squares_needed = container_length // square_width result = squares_needed return result
The average of 5 numbers is 12. If one of the numbers is changed to 5, what is the new average of the 5 numbers?
def solve() -> int: num_numbers = 5 old_average = 12 old_sum = num_numbers * old_average old_number = old_sum / num_numbers new_sum = old_sum + 5 - old_number new_average = new_sum / num_numbers result = new_average return result
Sarah's restaurant buys 200 pounds of beef every two weeks. If she decides to increase her order size by 30%, how much beef will she need in a year?
def solve() -> int: beef_per_week = 200 / 2 beef_per_year = beef_per_week * 52 increased_beef_per_year = beef_per_year * 1.3 result = increased_beef_per_year return result
Student: A train travels a distance of 300 km at a speed of 60 km/hour. How long does it take to complete the journey?
def solve() -> int: distance = 300 speed = 60 time = distance / speed time = time * 60 result = time return result
Student: A car travels at a speed of 60km/hour. How far can it go in 2 hours and 15 minutes?
def solve() -> int: speed = 60 time = 2.25 distance = speed * time result = distance return result
A tadpole takes 21 days to develop into a frog. If each frog spends five times as much time as a frogspawn as in a frog, how long does each frog spend as frogspawn? Amy reads for 3 hours every day. She spends 1/4 of the time reading magazines and the rest of the time reading novels. If she reads for twice the time she ...
def solve() -> int: tadpole_to_frog = 21 frogspawn_to_frog_ratio = 5 frogspawn_to_frog = tadpole_to_frog / frogspawn_to_frog_ratio reading_time = 3 * 60 magazine_time = reading_time / 4 novel_time = reading_time - magazine_time novel_time_minutes = novel_time ...
A bookshelf has 4 rows of books, with 5 books in each row. If each book costs $10, how much does it cost to buy all the books on the shelf?
def solve() -> int: num_rows = 4 num_books_per_row = 5 cost_per_book = 10 total_num_books = num_rows * num_books_per_row total_cost = total_num_books * cost_per_book result = total_cost return result
A dress costs $30 less than a suit. If a dress costs $120, find the total cost of both items.
def solve() -> int: dress_cost = 120 suit_cost = dress_cost + 30 total_cost = dress_cost + suit_cost result = total_cost return result
Student: A farmer has 100 apples. He sells 60 of them at the market and then gives 10 to his neighbor. He then realizes that 5 of the remaining apples are rotten and he throws them away. How many apples does he have left?
def solve() -> int: apples = 100 apples = apples - 60 apples = apples - 10 apples = apples - 5 result = apples return result
Lucas is building a toy car. It takes him 15 minutes to assemble the frame and a third of that time to attach the wheels. It takes him 30 minutes to paint the car, twice as long to let it dry, and 1/9th the combined paint and dry time to add the stickers. How long does Lucas spend building the toy car altogether?
def solve() -> int: frame_assembly_time = 15 wheel_attachment_time = frame_assembly_time / 3 painting_time = 30 drying_time = painting_time * 2 paint_and_dry_time = painting_time + drying_time sticker_addition_time = paint_and_dry_time / 9 total_time = frame_assembly_time + wheel_attach...
A pizza parlor is making pizza. Each pizza requires 1/2 cup of tomato sauce, 2 cups of flour, and 1 cup of cheese. If the pizzeria has 14 cups of tomato sauce, 48 cups of flour, and 24 cups of cheese, how many pizzas can they make?
def solve() -> int: tomato_sauce = 14 flour = 48 cheese = 24 sauce_per_pizza = 1/2 flour_per_pizza = 2 cheese_per_pizza = 1 max_pizzas_sauce = tomato_sauce // sauce_per_pizza max_pizzas_flour = flour // flour_per_pizza max_pizzas_cheese = cheese // cheese_per_pizza ...
Peter sells twice the number of apples than oranges each day. If he sells 9 oranges on a certain day, how many apples did he sell?
def solve() -> int: oranges = 9 relative_apples = oranges / 2 apples = relative_apples * oranges result = apples return result
Carlos wants to grow a beard starting with 1 inch in January. He plans to increase its length by 0.5 inches every month. How long will his beard be in June?
def solve() -> int: january_length = 1 february_length = january_length + 0.5 march_length = february_length + 0.5 april_length = march_length + 0.5 may_length = april_length + 0.5 june_length = may_length + 0.5 result = june_length return result
Mason and Jake collected 42 stamps each. Mason traded 3 of his stamps for 2 of Jake's stamps. How many stamps did each of them have after the trade?
def solve() -> int: mason_stamps = 42 jake_stamps = 42 mason_traded = 3 jake_traded = 2 mason_new = mason_stamps - mason_traded + jake_traded jake_new = jake_stamps - jake_traded + mason_traded result = (mason_new, jake_new) return result
A food delivery service charges $2.99 for delivery, and offers a 10% discount on orders above $20.00. If the price of a meal is $16.99, what would be the total cost for two meals with delivery and discount?
def solve() -> int: price_of_meal = 16.99 number_of_meals = 2 delivery_cost = 2.99 total_cost = price_of_meal * number_of_meals + delivery_cost if total_cost > 20: total_cost *= 0.9 result = total_cost return result
Eric has 7 more than 3 times what Fiona has. Eric then gives a third of his money to charity and loses $10 in a bet. If Fiona has $25, how much money does Eric have?
def solve() -> int: fiona = 25 eric = 7 + 3 * fiona eric = eric - eric / 3 - 10 result = eric return result
During the day, Lucas walks 2km. He also runs 3km every two hours. After 5 hours, he stops to rest and takes a break for half an hour. After that, he continues walking for 3 km every 4 hours till the end of the day. How much distance did Lucas cover on foot in one day?
def solve() -> int: km_walked = 0 km_run = 0 for i in range(5): km_walked += 2 if i % 2 == 0: km_run += 3 km_rest = 0.5 km_walked += km_rest*6 for i in range(2): for j in range(2): km_walked += 3 km_walked += 3 result = km_walked + km_r...
A gym has 20kg of protein powder to distribute among its members. There are 4 members. Each member needs 2kg of powder. How much powder will each member get?
def solve() -> int: total_protein = 20 num_members = 4 protein_per_member = 2 total_protein_needed = num_members * protein_per_member protein_per_member = total_protein / total_protein_needed result = protein_per_member return result
Maria's monthly income is $2000. Her monthly expenses include $200 on electricity bills, $500 on rent, $50 on transportation, and $150 on grocery. Calculate Maria's monthly savings after excluding all her expenses.
def solve() -> int: monthly_income = 2000 electricity_bill = 200 rent = 500 transportation_cost = 50 grocery_cost = 150 total_expenses = electricity_bill + rent + transportation_cost + grocery_cost savings = monthly_income - total_expenses result = savings return result
Tyler wants to replace his old car by selling it for $2000 and buying a new one for $25,000. If he wants to replace 2 cars, what will be his total cost for both cars? Alicia needs to cook at least 500 cupcakes in one month for a fundraising event. She has baked 50 cupcakes on the first day. Assuming she bakes three tim...
def solve() -> int: old_car_price = 2000 new_car_price = 25000 num_cars = 2 total_cost = (new_car_price - old_car_price) * num_cars result = total_cost first_day = 50 remaining_days = 29 daily_multiplier = 3 total_cupcakes = first_day for i in range(remaining_days)...
A bakery wants to increase their production so that they will have 4 times their current output minus 15 loaves. If they currently bake 30 loaves of bread per day, how many additional loaves of bread must they bake?
def solve() -> int: current_output = 30 new_output = 4 * current_output - 15 additional_loaves = new_output - current_output result = additional_loaves return result
Student: 6. Pam wants to buy 12 chops of pork. Each chop weighs 0.75 pounds. What is the total weight of the chops in ounces?
def solve() -> int: num_chops = 12 weight_per_chop = 0.75 ounces_per_pound = 16 weight_per_chop_in_ounces = weight_per_chop * ounces_per_pound total_weight_in_ounces = num_chops * weight_per_chop_in_ounces result = total_weight_in_ounces return result
Karen goes to the gym every weekday and buys a protein shake for $7. If she works out for 3 weeks, how much will she spend on protein shakes?
def solve() -> int: weekdays = 5 cost_per_shake = 7 weeks = 3 total_cost = weekdays * cost_per_shake * weeks result = total_cost return result
Jacob has 16 quarters, 8 dimes, and 4 nickels. How much money does he have in total?
def solve() -> int: quarters = 16 dimes = 8 nickels = 4 total_amount = (quarters * 0.25) + (dimes * 0.1) + (nickels * 0.05) result = total_amount return result
A recipe calls for 3/4 cup of sugar to make 1 dozen candies. How many cups of sugar do you need to make 15 candies?
def solve() -> int: candies1 = 12 sugar1 = 3/4 ratio = sugar1 / candies1 candies2 = 15 sugar2 = ratio * candies2 result = sugar2 return result
A family of 5 goes to a movie theater. The tickets cost $12 for adults and $8 for children. The family also buys a large popcorn for $6 and 5 drinks for $2 each. How much money does the family spend in total?
def solve() -> int: adult_number = 2 child_number = 3 adult_ticket = adult_number * 12 child_ticket = child_number * 8 ticket_total = adult_ticket + child_ticket popcorn_cost = 6 drink_cost = 5 * 2 snack_total = popcorn_cost + drink_cost total_cost = ticket_total + snack_total re...
Emma's insurance plan costs $100 per month. In her first month, she was able to avail a 50% discount. However, in the third month, she had to pay an extra amount of $40 as a penalty. What was the total amount she paid for insurance in the first 6 months?
def solve() -> int: monthly_cost = 100 discount = 0.5 penalty = 40 total_cost = (monthly_cost * (1 - discount) * 1) + (monthly_cost * 2) + penalty result = total_cost return result
Possible questions and programs are: Lily is a salesperson who earns a base salary of $2,500 a month plus a 5% commission on every product she sells. One month, Lily sells 4 products and earns $9,500 total. Product D costs twice as much as Product C plus $300. Product B costs $100 more than Product A. Product C costs $...
def solve() -> int: commission = 9500 - 2500 average_commission = commission / 4 average_price = average_commission / 0.05 price_A = average_price - 50 price_B = price_A + 100 price_C = price_A - 500 price_D = 2 * price_C + 300 result = price_D return result
Find the length of the diagonal of a rectangle whose length is 15 and breadth is 9.
def solve() -> int: l = 15 b = 9 d = (l ** 2 + b ** 2) ** 0.5 result = d return result
April drove 90 miles in 1.5 hours. How many miles did she drive per hour?
def solve() -> int: distance = 90 duration = 1.5 speed = distance / duration result = speed return result
Emily collected 120 stones. She painted 24 stones red and 30 stones blue. She then divided the remaining stones equally into 6 groups, and painted them purple, yellow, green, white, black, and brown. How many stones did she paint white?
def solve() -> int: stones_collected = 120 stones_red = 24 stones_blue = 30 remaining_stones = stones_collected - stones_red - stones_blue stones_per_group = remaining_stones // 6 stones_white = stones_per_group result = stones_white return result
Ava, Chloe, and Zoey are saving up to buy a new laptop that costs $700. Ava has $50, Chloe has six times the amount that Ava has, and Zoey has four times the amount that Chloe has. How much more money do they need to buy the laptop?
def solve() -> int: ava_money = 50 chloe_money = 6 * ava_money zoey_money = 4 * chloe_money total_money = ava_money + chloe_money + zoey_money money_needed = 700 - total_money result = money_needed return result
Student: Sophia had a bakery where she sold 5 cakes at a price of $5 each and 4 cupcakes for $3 each. How much money did she get in total?
def solve() -> int: cakes = 5 cake_price = 5 cupcakes = 4 cupcake_price = 3 cake_money = cakes * cake_price cupcake_money = cupcakes * cupcake_price total_money = cake_money + cupcake_money result = total_money return result
Diego has to cut 3,000 sheets of paper using a paper cutter that can cut through 20 sheets at a time. How many times does Diego have to cut until he's done?
def solve() -> int: sheets_per_cut = 20 total_sheets = 3000 cuts_needed = total_sheets // sheets_per_cut result = cuts_needed return result
Joe bought a bag of chips that contained 345 g of chips. If he eats 88 g, how much will he have left?
def solve() -> int: original_amount = 345 amount_eaten = 88 remaining_amount = original_amount - amount_eaten result = remaining_amount return result
Emily needs to wallpaper all four walls in her 8 meter by 12 meter dining room, which has 10 meter high ceilings. Each wall needs two layers of adhesive and two layers of wallpaper. If Emily can wallpaper 35 square meters per hour, how many hours will it take her to wallpaper the dining room?
def solve() -> int: wall_length = 8 wall_width = 10 ceiling_height = 12 wall_area = wall_length * ceiling_height total_wall_area = 4 * wall_area total_wallpaper_area = 2 * total_wall_area time_needed = total_wallpaper_area / 35 result = time_needed return res...
The cost of 3 burgers is $9. How much would 7 burgers cost?
def solve() -> int: burger_count_1 = 3 cost_1 = 9 burger_count_2 = 7 cost_2 = (burger_count_2 / burger_count_1) * cost_1 result = cost_2 return result
Kelly bought 2 books for $12 each, 1 journal for $8 and 3 pencils for $1 each. She paid the cashier $38. How much change did she receive?
def solve() -> int: book_price = 12 book_quantity = 2 journal_price = 8 pencil_price = 1 pencil_quantity = 3 total_price = book_price * book_quantity + journal_price + pencil_price * pencil_quantity paid_amount = 38 change = paid_amount - total_price result = change return resul...
The art club is painting a mural. Thirteen members are painting the sky. There are seven times as many members painting the sun. There are eleven less members painting the clouds than sun painters, and nine more members painting the grass than cloud painters. There are three times as many members painting the trees as ...
def solve() -> int: sky_painters = 13 sun_painters = 7 * sky_painters cloud_painters = sun_painters - 11 grass_painters = cloud_painters + 9 tree_painters = 3 * sky_painters flower_painters = cloud_painters + 7 art_club_members = sky_painters + sun_painters + cloud_painters + grass_pain...
Student: James has 7 toy cars. He trades 2 of them for toy dinosaurs and then buys 5 more of each. He then loses 1 toy car and 2 toy dinosaurs. How many toys does he have now?
def solve() -> int: toy_cars = 7 toy_cars -= 2 toy_dinosaurs = 2 toy_cars += 5 toy_dinosaurs += 5 toy_cars -= 1 toy_dinosaurs -= 2 result = toy_cars + toy_dinosaurs return result
Lily can type 60 words in 2 minutes. How many words can she type in 30 minutes if she takes four 1-minute breaks?
def solve() -> int: words_per_minute = 60 minutes = 30 breaks = 4 total_break_time = breaks * 1 total_time = minutes + total_break_time words_typed = words_per_minute * total_time result = words_typed return result
At the pet store, there are 12 rabbits, 18 hamsters, 24 parrots and 36 fish. Each rabbit costs 20 dollars, each hamster costs 10 dollars, each parrot costs 30 dollars and each fish costs 5 dollars. How much more money would it cost to buy all the rabbits and parrots than to buy all the hamsters and fish?
def solve() -> int: Rabbits = 12 Hamsters = 18 Parrots = 24 Fish = 36 Rabbits_cost = Rabbits * 20 Hamsters_cost = Hamsters * 10 Parrots_cost = Parrots * 30 Fish_cost = Fish * 5 Rabbits_and_Parrots = Rabbits_cost + Parrots_cost Hamsters_and_Fish = Hamsters_cost ...
A classroom has 40 students. There are 20 boys and 20 girls. 30% of the boys and 40% of the girls wear glasses. What percent of the classroom wear glasses?
def solve() -> int: n_students = 40 n_boys = 20 n_girls = 20 p_glasses_boys = 0.3 p_glasses_girls = 0.4 n_glasses_boys = n_boys * p_glasses_boys n_glasses_girls = n_girls * p_glasses_girls n_glasses_total = n_glasses_boys + n_glasses_girls p_glasses_total = n_glasses_total / n_studen...
Jack received 40 candy bars for Halloween and shared 10 with his siblings. He went to a party and came back with 30 more candy bars. After 2 days, he divided 12 candy bars among his friends and received 18 more from his cousin. How many candy bars does Jack have now?
def solve() -> int: candy_bars_received = 40 candy_bars_shared = 10 candy_bars_party = 30 candy_bars_divided = 12 candy_bars_received_cousin = 18 candy_bars_remaining = candy_bars_received - candy_bars_shared + candy_bars_party - candy_bars_divided + candy_bars_received_cousin resu...
You have a cupcake business. You buy butter for $2.00, sugar for $1.50, flour for $2.00 and eggs for $1.00 per dozen. Each cupcake costs $3.00 to make. If you sell 18 cupcakes, how much profit will you make?
def solve() -> int: butter_cost = 2 sugar_cost = 1.5 flour_cost = 2 egg_cost = 1/12 cupcake_cost = butter_cost + sugar_cost + flour_cost + egg_cost*2 cupcake_price = 3 num_cupcakes = 18 total_cost = cupcake_cost * num_cupcakes total_revenue = cupcake_price * num_cupcakes profit =...
Omar was able to purchase 5 cars for $30 each, while Beth was able to purchase 8 cars for $25 each. How much more did Omar earn than Beth?
def solve() -> int: pricepercar_o = 30 pricepercar_b = 25 numcars_o = 5 numcars_b = 8 totalprice_o = pricepercar_o * numcars_o totalprice_b = pricepercar_b * numcars_b totalprice_delta = totalprice_o - totalprice_b result = totalprice_delta return result
A hotel has 200 rooms. If 45% of the rooms are single occupancy and 35% are double occupancy, how many people can stay in the hotel at once?
def solve() -> int: single_rooms = (45/100) * 200 double_rooms = (35/100) * 200 total_people = (single_rooms * 1) + (double_rooms * 2) result = total_people return result
A department store has a promotion where, for every 3 shirts you buy, you get a 4th shirt free. If each shirt costs $25, how much would it cost to buy 12 shirts?
def solve() -> int: shirt_cost=25 num_shirts=12 num_sets=num_shirts//3 num_free=num_sets total_cost=(num_shirts-num_free)*shirt_cost result = total_cost return result
Rachel works as an event planner and earns a base pay of $20 per hour. She also gets a bonus of $50 for every 5 events she plans. If Rachel worked for 8 hours and planned 3 events today, how much money did she make?
def solve() -> int: base_pay = 20 bonus_per_event = 50 hours_worked = 8 events_planned = 3 total_pay = base_pay * hours_worked bonus_pay = (events_planned // 5) * bonus_per_event result = total_pay + bonus_pay return result
A train travels 300 miles in 5 hours. If it maintains the same speed, how many miles will it travel in 8 hours?
def solve() -> int: speed = 300 / 5 distance_in_8_hours = speed * 8 result = distance_in_8_hours return result
Liam has 70 marbles in a jar. 15 of them are blue, and three times as many are red. The rest of the marbles are equally divided between green and yellow. What percentage chance does Liam have of picking a green marble at random?
def solve() -> int: total_marbles = 70 blue_marbles = 15 red_marbles = 3 * blue_marbles green_yellow_marbles = total_marbles - (blue_marbles + red_marbles) green_chance = (green_yellow_marbles / total_marbles) * 100 result = green_chance return result
Student: Jean has 22 bananas. She gives away 11 bananas. How many bananas does Jean have left?
def solve() -> int: bananas = 22 give_away = 11 bananas_left = bananas - give_away result = bananas_left return result
Jason pays $2,000 for a camera. He buys another that is three times more expensive and then sells the former for a third of its original price. What is his total expense?
def solve() -> int: original_camera_price = 2000 second_camera_price = original_camera_price * 3 sold_camera_price = original_camera_price / 3 total_expense = second_camera_price + sold_camera_price result = total_expense return result
A football team has two goalkeepers. The first goalkeeper had 2 more saves than the second. If the second goalkeeper made 8 saves, how many saves did both goalkeepers have altogether?
def solve() -> int: saves_first = 8 + 2 saves_second = 8 result = saves_first + saves_second return result
Student: John wants to make pizzas for a party. He has 3.5 kg of flour and each pizza requires 500 grams of flour. If he wants to make 10 pizzas, how much flour will be left?
def solve() -> int: flour_kg = 3.5 flour_per_pizza = 0.5 num_pizzas = 10 total_flour_needed = flour_per_pizza * num_pizzas flour_left = flour_kg - total_flour_needed result = flour_left return result
A bag has 10 red marbles and 5 blue marbles. If two marbles are drawn at random from the bag, what is the probability that both marbles are blue?
def solve() -> int: num_red = 10 num_blue = 5 total_marbles = num_red + num_blue prob_first_blue = num_blue / total_marbles prob_second_blue = (num_blue - 1) / (total_marbles - 1) prob_both_blue = prob_first_blue * prob_second_blue result = prob_both_blue return result
A student needs to achieve an average of 85% or higher to pass a class. The student has scored an 80%, 85%, and 90% on their first three assignments. What percent do they need to score on their fourth and final assignment to pass the class?
def solve() -> int: num_assignments = 4 required_average = 0.85 average_so_far = (80 + 85 + 90) / 3 required_total = required_average * num_assignments needed_on_final_assignment = required_total - sum([80, 85, 90]) result = needed_on_final_assignment return result
Nick has three times as many balloons as Olivia, and Olivia has one fewer balloon than Paul. If Paul has 13 balloons, how many balloons does Nick have?
def solve() -> int: olivia_balloons = 13 - 1 nick_balloons = olivia_balloons * 3 result = nick_balloons return result
A taxi driver charges $2.00 for the first mile and $0.75 for each additional mile. If a passenger traveled 5 miles, how much did the ride cost?
def solve() -> int: first_mile_cost = 2 additional_mile_cost = 0.75 miles = 5 total_cost = first_mile_cost + additional_mile_cost * (miles - 1) result = total_cost return result
Alex wants to take a dance class. The class costs $200 for 10 sessions, and he has to pay $30 for the dance shoes. He decides to pay an extra $50 for a private lesson. But then he realizes that he doesn't have the time for it, and he gets a 80% refund. How much money did he lose?
def solve() -> int: class_cost = 200 num_sessions = 10 shoe_cost = 30 private_lesson_cost = 50 refund_percentage = 0.8 total_cost = class_cost + shoe_cost + private_lesson_cost refund_amount = total_cost * refund_percentage money_lost = total_cost - refund_amount result = m...
The grocery store is having a discount. A pound of apples costs $0.50 less than its original price of $2, and the oranges are sold at $1 for 2. If Alex buys three pounds of apples and eight oranges, how much will he pay?
def solve() -> int: apples_original_price = 2 apples_discount = 0.50 oranges_price = 1/2 apples_weight = 3 oranges_weight = 8 apples_discounted_price = apples_original_price - apples_discount apples_cost = apples_weight * apples_discounted_price oranges_cost = oranges_weig...
A farmer has a rectangular field that is 150 meters long and 80 meters wide. To fence the entire field, how many meters of fencing does the farmer need to buy?
def solve() -> int: length_field = 150 width_field = 80 perimeter = 2 * (length_field + width_field) result = perimeter return result
Julia bought 90 donuts. She gave a dozen donuts to her neighbor. If a dozen has 12 donuts, how many dozens of donuts does Julia have left?
def solve() -> int: donuts_bought = 90 donuts_given_away = 12 donuts_left = donuts_bought - donuts_given_away dozens_left = donuts_left / 12 result = dozens_left return result
Sarah works at a bakery. She makes $12 an hour working 25 hours a week and $15 an hour working 15 hours a week. If she spends $120 a week on expenses, how much money does she have left at the end of the week?
def solve() -> int: hours1 = 25 hourly1 = 12 hours2 = 15 hourly2 = 15 expenses = 120 weekly_earnings = (hours1 * hourly1) + (hours2 * hourly2) leftover_money = weekly_earnings - expenses result = leftover_money return result
David is running a marathon. He ran for 7 hours and had 350 meters to go to reach the finish line. If he completed the last 350 meters in exactly 30 minutes, what was his average speed in miles per hour?
def solve() -> int: distance = 350 time_run = 7 time_finish = 0.5 total_time = time_run + time_finish distance_in_miles = distance * 0.000621371 speed = distance_in_miles / total_time result = speed return result
Lars has a store and wants to know how much money he will make by selling 3 packs of tuna for each hour of the day. How much will he make if he sells the packs for $60 per pack and the store is open for 8 hours?
def solve() -> int: packs = 3 price = 60 hours = 8 result = packs * price * hours return result
Mark spent six days in the city. Each day he spent 2 hours in museums and an additional 30 minutes walking between them. What percentage of his total time in the city was spent in museums?
def solve() -> int: days_in_city = 6 hours_in_museums_per_day = 2 walking_time_per_day = 0.5 total_time_in_city = days_in_city * 24 total_time_in_museums = days_in_city * hours_in_museums_per_day total_walking_time = days_in_city * walking_time_per_day percentage_in_museums = (to...
Student: Sarah wants to put a downpayment on a house that costs $700,000. She earns $120,000 a year and saves 15% of her salary each month. If she wants to save up for the downpayment in 7 years, how much should she save each month?
def solve() -> int: cost_of_house = 700000 salary = 120000 percentage_saved = 0.15 years = 7 total_amount_saved = salary * percentage_saved * 12 * years monthly_amount_saved = total_amount_saved / (12 * years) result = monthly_amount_saved return result
A car travels 135 km in 3 hours. If it continues to travel at the same speed, how long will it take to travel 225 km?
def solve() -> int: speed = 135/3 distance = 225 time = distance/speed result = time return result
A car has a fuel efficiency of 7 kilometers per liter. If the car's gas tank can hold 40 liters of fuel, how far can the car travel on a full tank?
def solve() -> int: efficiency = 7 tank_size = 40 distance = efficiency * tank_size result = distance return result
Student: Matthew has 20 pins, 10 needles and 5 buttons. How many items does Matthew have in total?
def solve() -> int: pins = 20 needles = 10 buttons = 5 total_items = pins + needles + buttons result = total_items return result
Gabriel's sister offers to pay him $12 for each song that he plays on his guitar. Each set has 3 songs; Gabriel's job is to perform the sets. To get Gabriel to finish the job faster, his sister tells him that she will subtract $4 for every 9 days that pass without Gabriel finishing the job. In 27 days, Gabriel finishes...
def solve() -> int: sets = 9 days = 27 extra_days = days - sets * 3 subtraction = (extra_days // 9) * 4 total_payment = sets * 12 - subtraction result = total_payment return result
Student: A restaurant offers a lunch special that includes a sandwich, a side, and a drink for $8.50. The sandwich options are turkey, roast beef, or ham which cost $4.25, $5.00, and $4.75 respectively. The side options are chips or a salad which cost $1.50 and $2.25 respectively. The drink options are soda, tea, or wa...
def solve() -> int: sandwich_rb = 5.00 side_salad = 2.25 drink_tea = 1.50 total_cost = sandwich_rb + side_salad + drink_tea result = total_cost return result
A person buys a car worth $20,000. The following year, the car's value decreases by 12%, and then again by 5% the year after that. What is the value of the car two years after the purchase?
def solve() -> int: car_value = 20000 decreased_value_1 = car_value * 0.88 decreased_value_2 = decreased_value_1 * 0.95 result = decreased_value_2 return result
Alex went grocery shopping and bought a carton of eggs for $2.50 and a loaf of bread for $4.50. If the sales tax is 8%, how much did Alex spend in total?
def solve() -> int: subtotal = 2.5 + 4.5 tax_rate = 0.08 tax_amount = subtotal * tax_rate total = subtotal + tax_amount result = total return result
Rebecca spends 3 years less than normal to complete her elementary education. It takes her 8 times that long to complete her bachelor's and Ph.D. degrees. How many years did she spend in elementary school and college?
def solve() -> int: elementary_years = 0 college_years = 0 elementary_years = elementary_years + 3 college_years = elementary_years * 8 result = elementary_years + college_years return result
A right triangle has a hypotenuse of length 10 cm. One of the legs is 6 cm longer than the other. What are the lengths of the legs in cm?
def solve() -> int: hypotenuse = 10 leg_1_difference = 6 leg_2 = (hypotenuse**2 - (leg_1_difference)**2)**0.5 leg_1 = leg_2 + leg_1_difference result = (leg_1, leg_2) return result
During a sale, James purchases 10 board games at $18.00 each. Each second game is half off. How much does James spend on board games?
def solve() -> int: games = 10 price = 18.00 total_cost = games * price for i in range(2, games+1, 2): total_cost += (price/2) * i result = total_cost return result
Student: A truck can carry 2000 pounds of cargo. The cargo weighs 400 pounds. Each passenger weighs 150 pounds. If there are 5 passengers in the truck, how much more weight can be added before the truck is overloaded?
def solve() -> int: cargo_weight = 400 passenger_weight = 150 num_passengers = 5 max_weight = 2000 total_weight = cargo_weight + passenger_weight * num_passengers remaining_weight = max_weight - total_weight result = remaining_weight return result
Possible questions and programs are: Tom buys a car for $15,000 and pays $3000 as a down payment. He agrees to pay the rest in 36 monthly installments with 10% annual interest. How much is each installment?
def solve() -> int: monthly_interest_rate = 0.1/12 loan_amount = 15000 - 3000 monthly_installment = loan_amount * monthly_interest_rate / (1 - (1 + monthly_interest_rate) ** (-36)) result = round(monthly_installment, 2) return result
Alex has $60. He wants to give his sister $15 and his brother $20. How much money does Alex have left?
def solve() -> int: money = 60 sister = 15 brother = 20 money_given = sister + brother money_left = money - money_given result = money_left return result
Student: A company increases employee salaries by 10%. John used to make $5000 before the increase. How much does he make now?
def solve() -> int: salary_increase = 0.1 john_salary = 5000 new_salary = john_salary * (1 + salary_increase) result = new_salary return result
Student: A football team has 18 players and 21 members in the support staff. How many members do the team have in total?
def solve() -> int: team_players = 18 support_staff = 21 total_members = team_players + support_staff result = total_members return result
A coffee shop charges $3.50 for a small coffee, $4.50 for a medium coffee and $5.50 for a large coffee. If Jane bought 2 small coffees, 1 medium coffee and 1 large coffee, how much did she spend in total?
def solve() -> int: total = 2 * 3.5 + 1 * 4.5 + 1 * 5.5 result = total return result
A car rental company charges $30 per day plus $0.25 per mile driven. If John rented a car for 4 days and drove 200 miles, what is his total rental cost?
def solve() -> int: rental_cost_per_day = 30 cost_per_mile = 0.25 num_days = 4 num_miles = 200 total_rental_cost = (rental_cost_per_day * num_days) + (cost_per_mile * num_miles) result = total_rental_cost return result
A school has 12 classes with an average of 25 students in each class. How many students are in the school in total?
def solve() -> int: avg_students_per_class = 25 num_of_classes = 12 total_students = avg_students_per_class * num_of_classes result = total_students return result
Student: A grocery store bought 100 apples for $50. If they sell them for $1 each, what is their profit?
def solve() -> int: apples_bought = 100 price_bought = 50 price_sold = 1 total_cost = apples_bought * price_bought total_revenue = apples_bought * price_sold profit = total_revenue - total_cost result = profit return result
Cindy has a basket of flowers with 15 fewer flowers than her basket of vegetables. She decides to add 30 vegetables into the basket of vegetables. If the basket of flowers has 95 flowers, how many vegetables are there?
def solve() -> int: basket_of_flowers = 95 basket_of_vegetables = basket_of_flowers + 15 basket_of_vegetables += 30 result = basket_of_vegetables return result
If x=3 and y=4, what is the value of x^2 + y^2?
def solve() -> int: x = 3 y = 4 result = (x ** 2) + (y ** 2) return result
Ms. Singh is the owner of a business with 20 workers and a monthly income of $800000. After tax deductions of 9%, the company spends 6% of the remaining amount on marketing and advertising, 18% on operational costs, and 10% on employee salaries. If every employee has the same income, what is the monthly salary of each ...
def solve() -> int: workers = 20 monthly_income = 800000 after_tax = monthly_income * (1 - 0.09) marketing = after_tax * 0.06 operational_costs = after_tax * 0.18 employee_salaries = after_tax * 0.10 remaining_amount = after_tax - marketing - operational_costs - empl...
A bus takes 12 women and 9 men to a theater. If the theater has a seating capacity of 1580 and is full, how many seats are occupied by women?
def solve() -> int: x = 1571 result = x return result