question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
The sum of three consecutive odd numbers is 87. What are the three numbers?
def solve() -> int: sum_of_numbers = 87 middle_number = sum_of_numbers / 3 first_number = middle_number - 2 third_number = middle_number + 2 result = (first_number, middle_number, third_number) return result
A company's monthly revenue is $30,000. If their fixed costs are $10,000, how much is their profit?
def solve() -> int: revenue = 30000 fixed_costs = 10000 profit = revenue - fixed_costs result = profit return result
If a store sells 18 apples for $9.72, how much would 36 apples cost?
def solve() -> int: cost_for_18 = 9.72 cost_for_1 = cost_for_18/18 cost_for_36 = cost_for_1*36 result = cost_for_36 return result
The number of students in a school is twice the number of teachers. There are also three times as many textbooks as students in the school. If the number of teachers is 20, how many textbooks are there in the school?
def solve() -> int: teachers = 20 students = 2 * teachers textbooks = 3 * students result = textbooks return result
1 bandage can stop the bleeding of 1 cut, prevent infection of 2 bites or heal the wound of a small burn. How many bandages are needed to stop the bleeding of 20 cuts, prevent infection of 30 bites and heal the wound of 10 small burns?
def solve() -> int: cuts = 20 bites = 30 burns = 10 bandages_needed = cuts + (2 * bites) + burns result = bandages_needed return result
Sarah baked 24 pies and 36 cakes for a charity event. She sold the pies for $8.00 each and the cakes for $12.00 each. If she made a total of $720, how much did she sell each pie and cake for?
def solve() -> int: pies = 24 cakes = 36 pie_price = 8.00 cake_price = 12.00 total_sales = 720 total_pie_sales = pies * pie_price total_cake_sales = cakes * cake_price total_sales_from_pies_and_cakes = total_pie_sales + total_cake_sales total_number_of_items = pies + cakes ...
Li has 1600 nuts. He gives a 1/3 of them away to his friends, then he sells 1/2 of the remaining. How many nuts does he eventually have?
def solve() -> int: total_nuts = 1600 give_away_ratio = 1/3 sell_ratio = 1/2 given_away = total_nuts * give_away_ratio remaining = total_nuts - given_away result = remaining * (1 - sell_ratio) return result
Rachel has 80 books in her library. She displays 40% of them on the top shelf, keeps a quarter of them on a table, and puts the remaining books on two additional shelves. How many books did Rachel put on the two additional shelves? Maggie is packing for a camping trip and wants to make sure her backpack isn't too heavy...
def solve() -> int: total_books = 80 displayed_percentage = 40 displayed_books = total_books * displayed_percentage / 100 table_books = total_books / 4 additional_books = total_books - displayed_books - table_books total_weight = 3*1 + 6*2 + 4*3 left_behind = to...
Rocky was planning a road trip and wanted to buy a tank of gas. If a tank of gas costs $50 with 10% additional tax, how much will Rocky end up paying for the tank of gas?
def solve() -> int: gas_price = 50 tax_percent = 0.1 tax_amount = gas_price * tax_percent total_price = gas_price + tax_amount result = total_price return result
A group of hikers started climbing a mountain at 7am. They reached the peak at noon. The hike to the peak took them 5 hours. If they climbed 1000m in the 5 hours, determine their average climbing speed.
def solve() -> int: result = 1000/5 return result
At a party, there are 20 cups of punch that are only filled up to 1/2 of their maximum capacity. If each cup has a maximum capacity of 10 ounces, how many more ounces of punch are needed to fill up all the cups?
def solve() -> int: cups = 20 max_capacity = 10 fill_percentage = 1/2 filled_ounces = cups * max_capacity * fill_percentage empty_ounces = cups * max_capacity - filled_ounces result = empty_ounces return result
A company sells boxes of candies. Each box contains 24 candies. If they have 120 candies, how many boxes can they make?
def solve() -> int: num_candies = 120 candies_per_box = 24 num_boxes = num_candies // candies_per_box result = num_boxes return result
Jamie has 10 chickens and 8 cows. Chickens have 2 legs and cows have 4 legs. What is the total number of legs of all his animals?
def solve() -> int: chickens = 10 cows = 8 legs_per_chicken = 2 legs_per_cow = 4 total_chicken_legs = chickens * legs_per_chicken total_cow_legs = cows * legs_per_cow total_legs = total_chicken_legs + total_cow_legs result = total_legs return result
A gym had 60 members sign up for a fitness challenge. A third of the members were male, a quarter were female, and a fifth were couples. The rest were teenagers. How many teenagers signed up for the fitness challenge?
def solve() -> int: total = 60 male = total // 3 female = total // 4 couples = total // 5 teenagers = total - (male + female + couples) result = teenagers return result
Ethan saves 15% of his monthly salary. If Ethan saves $550 every month, how much is his monthly salary?
def solve() -> int: monthly_savings = 550 percent_savings = 0.15 monthly_salary = monthly_savings/percent_savings result = monthly_salary return result
A carpenter has 53 wooden planks. She needs 5 planks to make a chair and 8 planks to make a table. If she wants 4 chairs and 3 tables, how many planks will she need in total?
def solve() -> int: planks_per_chair = 5 planks_per_table = 8 num_chairs = 4 num_tables = 3 total_planks = (planks_per_chair * num_chairs) + (planks_per_table * num_tables) result = total_planks return result
David rides his bike every day for 2 hours. If he missed his ride for 7 days in total last month, how many hours did he cycle in total?
def solve() -> int: hours_per_ride = 2 missed_rides = 7 total_rides = 30 - missed_rides total_hours = total_rides * hours_per_ride result = total_hours return result
Student: A basketball team won 25 games out of the 40 games they played. What percentage of games did they win?
def solve() -> int: games_won = 25 games_played = 40 ratio = games_won / games_played percentage = ratio * 100 result = percentage return result
Student: Anthony can mow his lawn in 45 minutes while Jill can mow a similar lawn in 60 minutes. How much faster can Anthony mow the lawn than Jill?
def solve() -> int: anthony_time = 45 jill_time = 60 anthony_speed = 1/anthony_time jill_speed = 1/jill_time speed_difference = anthony_speed - jill_speed time_difference = 1/speed_difference result = time_difference - anthony_time return result
A basket of 24 apples is divided equally among 6 people. How many apples does each person get?
def solve() -> int: applesPerPerson = 24//6 result = applesPerPerson return result
A shop is selling books at 20% off the original price. If a book costs $15 originally, what is the final price after the discount is applied and 8% tax is added?
def solve() -> int: original_price = 15 discount_percentage = 0.2 discount_amount = original_price * discount_percentage sale_price = original_price - discount_amount tax_rate = 0.08 total_price = sale_price * (1 + tax_rate) result = total_price return result
She sells half of the apples for $0.40 each, three-quarters of the bananas for $0.50 each, and all the oranges for $0.70 each. How much profit does she make?
def solve() -> int: cost_apples = 3.60 cost_bananas = 4.80 cost_oranges = 6 total_cost = cost_apples + cost_bananas + cost_oranges sell_apples = 0.40 * (12 / 2) sell_bananas = 0.50 * (12 * (3 / 4)) sell_oranges = 0.70 * 12 total_revenue = sell_apples + sell_bananas + sell_oranges ...
A package of 5 chocolate bars costs $10. If a store wants to mark up the price by 20%, how much will the package of chocolate bars cost?
def solve() -> int: original_price = 10 markup_percentage = 20 new_price = original_price * (1 + markup_percentage/100) result = new_price return result
Jessy bought a box of 24 donuts, and she divided them among 3 people. How many donuts did each person get?
def solve() -> int: total_donuts = 24 * 3 donuts_per_person = total_donuts // 3 result = donuts_per_person return result
Logan likes to practice guitar every day. One day, he practices for 10 minutes. Every subsequent day, he doubles the amount of time he practices the previous day. On what day does he practice more than 7 times longer than he did on the first day?
def solve() -> int: first_day = 10 current_day = 1 current_time = first_day while current_time <= 7 * first_day: current_day += 1 current_time *= 2 result = current_day return result
A family of six went on a beach vacation. John collected 15 seashells while his family members collected an average of 8 seashells each. How many seashells did they collect in total?
def solve() -> int: john = 15 family_members = 6 average_seashells = 8 total_seashells = john + (family_members * average_seashells) result = total_seashells return result
Martin received $500 for his birthday. He decided to spend 1/5 of it on a new game, 1/4 of the remainder on new shoes, and the rest on a concert. How much money did Martin spend on the concert?
def solve() -> int: game = 500/5 remainder = 500 - game shoes = remainder/4 concert = remainder - shoes result = concert return result
John wants to send souvenir to his family. The cost is $7 per package. He has two siblings, four cousins, and two aunts. How much money will John spend to send packages to all his relatives?
def solve() -> int: siblings = 2 cousins = 4 aunts = 2 cost_per_package = 7 total_relatives = siblings + cousins + aunts total_cost = total_relatives * cost_per_package result = total_cost return result
Sarah went to the grocery store with a 10% off coupon. The store was offering a 5% discount on all fruits and vegetables. She bought 5 pounds of apples at $3.50 per pound, 3 pounds of oranges at $4 per pound, and 2 pounds of bananas at $2.50 per pound. How much did Sarah spend on her fruits after the coupons and discou...
def solve() -> int: apple_price = 3.50 orange_price = 4 banana_price = 2.50 apple_weight = 5 orange_weight = 3 banana_weight = 2 coupon = 0.1 discount = 0.05 apple_cost = apple_price * apple_weight orange_cost = orange_price * orange_weight banana_cost = banana_price * b...
Possible questions and programs are: In a quiz show, Alice scored 3 times as many points as Bob, and Bob scored 4 times as many points as Charlie. If Charlie scored 12 points, how many did Alice score?
def solve() -> int: charlie = 12 bob = 4 * charlie alice = 3 * bob result = alice return result
Student: A fundraiser sells 150 tickets for $10 each, then sells another 50 tickets for $15 each. How much money was raised in total?
def solve() -> int: ticket_price_1 = 10 ticket_price_2 = 15 num_tickets_1 = 150 num_tickets_2 = 50 total_money_raised = (ticket_price_1 * num_tickets_1) + (ticket_price_2 * num_tickets_2) result = total_money_raised return result
Student: Q4: A TV costs $500, and a speakers costs $350. How much would it cost in total to purchase 5 TVs and 8 speakers with a 25% discount?
def solve() -> int: tv_cost = 500 speaker_cost = 350 total_cost = (5 * tv_cost) + (8 * speaker_cost) discount = total_cost * 0.25 total_cost_discounted = total_cost - discount result = total_cost_discounted return result
Student: A train travels 800 miles in 8 hours. What is the average speed of the train in miles per hour?
def solve() -> int: distance = 800 time = 8 result = distance / time return result
Maria spent $300 on groceries in the first week of January and $400 on groceries in the second week of January. What was her average expenditure on groceries per week during the month of January?
def solve() -> int: total_expense = 300 + 400 average_expense = total_expense / 2 result = average_expense return result
On Monday, Jack purchased 10 cans of soda. The next day, he bought five times more cans. On Wednesday, he bought half of what he purchased on Tuesday. On Thursday, he returned a third of what he bought on Tuesday because it was expired. How many cans of soda did Jack have on Thursday?
def solve() -> int: monday_cans = 10 tuesday_cans = 5 * monday_cans wednesday_cans = tuesday_cans / 2 thursday_returned = tuesday_cans / 3 thursday_cans = monday_cans + tuesday_cans + wednesday_cans - thursday_returned result = thursday_cans return result
A computer costs 20 percent less than a laptop that costs $700. What is the cost of the computer?
def solve() -> int: laptop_cost = 700 percent_off = 20 computer_cost = laptop_cost * (100 - percent_off)/100 result = computer_cost return result
Ryan can pack 3 boxes of books with a single roll of packing tape. He uses half a roll of tape for a single box, or 1/4 roll of tape for a small box. For a move, he needs to pack 8 small boxes and 5 large boxes. How many rolls of packing tape will he need in total?
def solve() -> int: num_small_boxes = 8 num_large_boxes = 5 tape_per_small_box = 1/4 tape_per_large_box = 1/2 total_tape_needed = num_small_boxes * tape_per_small_box + num_large_boxes * tape_per_large_box boxes_per_roll = 3 num_rolls_needed = total_tape_needed / boxes_pe...
Nolan solved 75 math problems in one day and Emma solved 45. If the number of problems they solved throughout the week was divided equally among 7 days, how many more problems a day did Nolan solve than Emma?
def solve() -> int: nolan_daily = 75/7 emma_daily = 45/7 difference = nolan_daily - emma_daily result = difference return result
Student: Kevin is planning a road trip with his friends. He estimates that his car consumes 12 liters of gas per 100 kilometers. The gas price is $1.25 per liter. The distance of the trip is 450 kilometers. How much money does Kevin need to spend on gas for the trip?
def solve() -> int: distance = 450 gas_consumption = 12 gas_price = 1.25 total_gas = distance / 100 * gas_consumption total_cost = total_gas * gas_price result = total_cost return result
Jack works at a grocery store and earns $12 an hour. If he works for 8 hours a day for the first 5 days and then for 6 hours a day for every day after that, how much he will earn in 20 days?
def solve() -> int: hourly_wage = 12 first_five_days = 8 after_five_days = 6 total_days = 20 total_hours = first_five_days + (total_days - 5) * after_five_days total_pay = total_hours * hourly_wage result = total_pay return result
Student: At Green Valley middle school there are 480 students in the seventh grade. A third of the students are in the drama club. Of the students in the drama club, three quarters of them participate in the annual play. Of the students that participate in the play, a fourth of them have a speaking role. How many stude...
def solve() -> int: total_7th_grade_students = 480 drama_club_students = total_7th_grade_students / 3 play_participants = drama_club_students * 3 / 4 speaking_role_participants = play_participants * 1 / 4 result = speaking_role_participants return result
Susan weighs twice as much as Jane. Jane weighs 120 lbs. What is the weight of Susan?
def solve() -> int: weight_jane = 120 weight_susan = weight_jane * 2 result = weight_susan return result
-Make sure that each new question uses **different numbers and words** than the original question and the previous questions. Some possible questions are: Mira bought 12 pencils and 8 erasers from the store. She used 3 pencils and 1 eraser for her homework, and she gave 4 pencils and 2 erasers to her friend. How many p...
def solve() -> int: pencils = 12 erasers = 8 pencils = pencils - 3 - 4 erasers = erasers - 1 - 2 total = pencils + erasers result = total return result
John is trying to collect rare comic books. He has collected comics from 80 different series. For every percentage point of the total comic series available, his uncle will give him $1.50. How much will John earn from his uncle?
def solve() -> int: total_comic_series = 80 percentage_point = 1 earnings_per_percentage_point = 1.50 total_earnings = total_comic_series * percentage_point * earnings_per_percentage_point result = total_earnings return result
Marty has a birthday party with 32 guests. To make sure each guest has enough food, he will need to buy 96 hamburgers. How many hamburgers will be left over?
def solve() -> int: leftover_burgers = 96 - 32 result = leftover_burgers return result
Grace is preparing goody bags for a kids' party. Each goody bag contains 6 items and Grace has 72 items in total. If Grace makes 10 goody bags, how many items will be left?
def solve() -> int: items_per_goody_bag = 6 total_items = 72 num_goody_bags = 10 items_left = total_items - (items_per_goody_bag * num_goody_bags) result = items_left return result
An aquarium has 12 small fish and 6 medium fish. Small fish cost $2.50 each and medium fish cost $3 each. How much would it cost to buy all of these fish?
def solve() -> int: small_fish_price_each = 2.5 medium_fish_price_each = 3 num_small_fish = 12 num_medium_fish = 6 total_small_fish_price = small_fish_price_each * num_small_fish total_medium_fish_price = medium_fish_price_each * num_medium_fish total_price = total_small_fish_price + to...
A garden supply store sells flower seeds and fertilizer. There are 30 packets of flower seeds that cost $1 each and 10 bags of fertilizer that cost $4 each. How much does it cost to buy all the flower seeds and fertilizer at once?
def solve() -> int: seed_cost = 1 fertilizer_cost = 4 num_seeds = 30 num_fertilizer_bags = 10 total_seed_cost = seed_cost * num_seeds total_fertilizer_cost = fertilizer_cost * num_fertilizer_bags total_spent = total_seed_cost + total_fertilizer_cost result = total_spent return result...
Student: - Kevin runs a 5-kilometer race in 25 minutes. He drinks a bottle of water that has 500 milliliters of volume and 0.1 grams of sodium per milliliter. He also eats a banana that has 105 calories and 0.4 grams of sodium. How much sodium did he consume and what percentage of his daily recommended intake is that, ...
def solve() -> int: race_distance = 5 race_time = 25 water_volume = 500 water_sodium = 0.1 banana_calories = 105 banana_sodium = 0.4 daily_sodium = 2300 water_sodium_intake = water_volume * water_sodium banana_sodium_intake = banana_sodium total_sodium_intake = water_sod...
A farmer has a field that is 120 feet long and 60 feet wide. How many square feet of land does the farmer have?
def solve() -> int: length = 120 width = 60 total_area = length * width result = total_area return result
In a toy store, there are 1000 different toys. 55% of all the toys are action figures, but only 20% of these action figures are made of metal. How many action figures are not made of metal?
def solve() -> int: toys_total = 1000 action_figures_percentage = 55 metal_action_figures_percentage = 20 action_figures = (action_figures_percentage / 100) * toys_total metal_action_figures = (metal_action_figures_percentage / 100) * action_figures non_metal_action_figures = action_figures...
Mary has $500 that she wants to split between herself and her three friends. If she gives each friend $50, how much money will she have left?
def solve() -> int: total_money = 500 num_friends = 3 money_per_friend = 50 total_money_given = num_friends * money_per_friend money_left = total_money - total_money_given result = money_left return result
Elizabeth needs to embroider 3 blouses in 1/2 of a day. She can embroider 4 blouses an hour and they will all take the same amount of time to make. How many hours did it take her to finish the 3 blouses?
def solve() -> int: result = 0 blouses_to_embroider = 3 time_embroider_1 = 2/8 result = blouses_to_embroider/(time_embroider_1/4) return result
In a library, there are a certain number of books in the science section and 8 more than double that amount in the history section. If there are 45 books total, how many are in the science section?
def solve() -> int: science_books = 45 / (2 + 1 + 8) result = science_books return result
Six times the number of toys that Sarah, Michael, and Jack have is equal to 120. If Sarah has one-third of the number of toys Michael has, and Sarah has 6 toys, how many toys does Jack have?
def solve() -> int: sarah_toys = 6 michael_toys = sarah_toys * 3 jack_toys = (120 - (sarah_toys + michael_toys)) / 6 result = jack_toys return result
At a party, there are 24 guests and each guest wants 2 cupcakes. If a batch of cupcakes makes 12 cupcakes, how many batches should the baker make?
def solve() -> int: guests = 24 cupcakes_per_guest = 2 cupcakes_per_batch = 12 total_cupcakes_needed = guests * cupcakes_per_guest batches_needed = total_cupcakes_needed / cupcakes_per_batch result = batches_needed return result
- Sarah is planning a trip to Hawaii with her friends. She has $1500 in her checking account and a credit card with a 15% annual interest rate. She needs to pay for her flight, which costs $600, and her hotel, which costs $100 per night for 7 nights. She decides to use her checking account to pay for the flight and the...
def solve() -> int: checking_payment = 600 credit_payment = 100 * 7 monthly_interest = 0.15 / 12 credit_balance_1 = credit_payment * (1 + monthly_interest) credit_balance_2 = credit_balance_1 * (1 + monthly_interest) result = credit_balance_2 return result
A train is traveling at a constant speed of 65 mph. How long will it take to travel 455 miles? result =? ? ?
def solve() -> int: distance = 455 speed = 65 time = distance/speed result = time return result
John runs 4 miles every day. How many miles will John have run in 12 days?
def solve() -> int: days = 12 distance = 4 * days result = distance return result
A restaurant is offering a deal on nachos: for every 2 orders of nachos, customers can get a free drink. If 16 orders of nachos are sold, how many free drinks will be given out?
def solve() -> int: orders_of_nachos_sold = 16 free_drinks_per_nachos_pair = 1 total_free_drinks_given_out = orders_of_nachos_sold // 2 * free_drinks_per_nachos_pair result = total_free_drinks_given_out return result
A garden bed is in the shape of an isosceles triangle with a base of 10 meters and a height of 12 meters. If the garden bed is filled with soil to a depth of 20 centimeters, how many cubic meters of soil will be required?
def solve() -> int: base = 10 height = 12 depth_meters = 0.2 area = (base * height) / 2 volume = area * depth_meters result = round(volume, 2) return result
A movie streaming service allows users to watch up to 5 movies per month for $9.99. If each additional movie costs $1.99, what is the cost of watching 7 movies?
def solve() -> int: base_cost = 9.99 extra_cost = 2 * 1.99 total_cost = base_cost + extra_cost result = total_cost return result
Q1: After Ali borrowed $20 from her friend, she had a cake sale and sold 90 cakes for $2 each. If Ali pays back her friend, how much money is left?
def solve() -> int: amount_owed = 20 cakes_sold = 90 cost_per_cake = 2 revenue = cakes_sold * cost_per_cake net_profit = revenue - amount_owed result = net_profit return result
Alex has 7 dollars more than 2/3 as much money as Mandy. Tony has 3 dollars more than half as much money as Alex. If Mandy has 60 dollars, how much money do Alex and Tony have?
def solve() -> int: mandy = 60 alex = (2/3)*mandy + 7 tony = 0.5*alex + 3 result = alex + tony return result
Mary has 3 more dolls than twice the number of toy cars she has. If she has 17 dolls in total, how many toy cars does she have?
def solve() -> int: num_dolls = 17 num_cars = (num_dolls - 3) / 2 result = num_cars return result
A car travels at a speed of 30 km/h for 2 hours and then at 40 km/h for the next 3 hours. What is the average speed of the car for the entire journey?
def solve() -> int: distance_first_leg = 30 * 2 distance_second_leg = 40 * 3 total_distance = distance_first_leg + distance_second_leg total_time = 2 + 3 average_speed = total_distance/total_time result = average_speed return result
Mark and Tom went shopping. Mark bought a shirt for 25 dollars and a pair of pants for 40 dollars. Tom bought a sweater for 45 dollars and a shirt for 20 dollars. If they pay with a 15% discounted gift card, how much do they pay in total?
def solve() -> int: discount_pc = 0.15 total_cost = 25 + 40 + 45 + 20 discounted_cost = total_cost * (1-discount_pc) result = discounted_cost return result
If Peter is twice as old as his brother, who is 10 years younger than their mother, and their mother is 45 years old, how old is Peter?
def solve() -> int: mother_age = 45 brother_age = mother_age - 10 peter_age = 2 * brother_age result = peter_age return result
A coffee shop charges $3 for a small coffee and $4 for a large coffee. If a person orders 2 small coffees and 3 large coffees, how much is the total cost?
def solve() -> int: num_small_coffees = 2 num_large_coffees = 3 price_small_coffee = 3 price_large_coffee = 4 total_small = num_small_coffees * price_small_coffee total_large = num_large_coffees * price_large_coffee total_cost = total_small + total_large result = total_cost return r...
A bakery produces 50 cakes every day. If 20 cakes go stale every day, how many cakes are left at the end of a week if the bakery had 250 cakes at the beginning of the week?
def solve() -> int: cakes_per_day = 50 cakes_stale_per_day = 20 cakes_at_beginning_of_week = 250 cakes_left_per_day = cakes_per_day - cakes_stale_per_day cakes_left_at_end_of_week = cakes_at_beginning_of_week + (cakes_left_per_day * 7) result = cakes_left_at_end_of_week return resu...
A field has 24 cows and bulls combined. If there are 3 times as many cows as bulls, how many cows are there?
def solve() -> int: num_cows = 24 / 4 * 3 result = num_cows return result
Tom, Sam, and Pam collected some stamps for a school project. Tom collected 36 stamps, which was 20% of the total number of stamps. Sam collected 4 more stamps than Pam. How many stamps did Pam collect?
def solve() -> int: total = 36 / 0.2 s_plus_p = total - 36 difference = 4 p = (s_plus_p - difference) / 2 result = p return result
A CD (Certificate of Deposit) pays 3.5% interest, compounded annually. If Sarah buys a CD for $3,000, how much will she have in 5 years?
def solve() -> int: p = 3000 r = 0.035 t = 5 s = p * (1 + r) ** t result = round(s, 2) return result
If a box contains 12 apples and 8 oranges, what percent of the fruit in the box are oranges?
def solve() -> int: total_fruit = 12 + 8 percent_oranges = (8/total_fruit)*100 result = percent_oranges return result
A computer repair technician charges $50 per repair plus $20 per hour of work. If they work 5 hours and repair 3 computers, what is their total earnings?
def solve() -> int: total_earnings = 3*50 + 20*5 result = total_earnings return result
A company's profit increased from $200,000 in year 1 to $275,000 in year 2. What was the percent increase?
def solve() -> int: year1_profit = 200000 year2_profit = 275000 increase = year2_profit - year1_profit percent_increase = (increase / year1_profit) * 100 result = percent_increase return result
Harry filled the gas tank of his car at $3.50 per gallon. If the tank can hold 10 gallons, how much did Harry pay in total?
def solve() -> int: gas_price = 3.50 total_price = gas_price * 10 result = total_price return result
Maya has 7 more apples than Hannah does. If Hannah has 18 apples, how many more apples will Hannah have than Maya if their friend Sarah gives her 14 apples?
def solve() -> int: hannah_apples = 18 mayas_apples = hannah_apples + 7 sarah_apples = 14 hannah_apples_after_sarah = hannah_apples + sarah_apples mayas_apples_after_sarah = mayas_apples more_apples = hannah_apples_after_sarah - mayas_apples_after_sarah result = more_apples ...
Student: Jack has a bank loan of $25000 at 4% annual interest rate compounded monthly. How much interest will he have to pay in 3 years?
def solve() -> int: principal = 25000 interest_rate = 0.04 time = 3 interest = principal * (1 + interest_rate/12)**(12*time) - principal result = interest return result
Possible questions and programs are: Sam bought six packs of juice for his birthday party. Each pack had 12 bottles of juice. He invited 24 friends to the party and gave each of them one bottle. He also drank two bottles himself. How many bottles of juice did he have left?
def solve() -> int: total_bottles = 6 * 12 drank_bottles = 24 + 2 left_bottles = total_bottles - drank_bottles result = left_bottles return result
Kevin is painting his room. He needs 2 cans of paint for the walls and 1 can of paint for the ceiling. Each can of paint costs $12. He also needs a roller, a brush, and a tray. The roller costs $6, the brush costs $4, and the tray costs $3. He has a coupon that gives him 10% off the total purchase. How much does he hav...
def solve() -> int: wall_paint = 2 ceiling_paint = 1 paint_price = 12 roller_price = 6 brush_price = 4 tray_price = 3 discount = 0.1 paint_cost = (wall_paint + ceiling_paint) * paint_price tools_cost = roller_price + brush_price + tray_price total_cost = paint_cost + tools_cost ...
Student: A rectangle has a length of 10 cm and a width of 5 cm. What is the perimeter of the rectangle?
def solve() -> int: length = 10 width = 5 perimeter = 2 * (length + width) result = perimeter return result
A bookstore marked a book up by 20% and is selling it for $24. What was the original price of the book?
def solve() -> int: selling_price = 24 markup_percent = 0.2 original_price = selling_price / (1 + markup_percent) result = original_price return result
-Start each question with 'Question X:' where X is the 1, 2, 3... (total of 10 questions) A car consumes 8 liters of gasoline per 100 kilometers. If the car travels at an average speed of 60 kilometers per hour, how much gasoline will it consume in one day if it runs for 6 hours?
def solve() -> int: hours = 6 minutes = hours * 60 speed = 60 distance_per_minute = speed / 60 distance = distance_per_minute * minutes consumption_rate = 8 gasoline = consumption_rate * distance / 100 result = gasoline return result
Student: A train is moving at a speed of 60 miles per hour. How long will it take for the train to travel 180 miles?
def solve() -> int: speed = 60 distance = 180 time = distance / speed result = time return result
Student: Lisa bought 3 items that cost $2 each. How much did Lisa spend in total?
def solve() -> int: cost = 2 items = 3 total = cost * items result = total return result
Student: Brandon is planning a trip and wants to know how much gas he'll need for the trip. His car gets an average of 28 miles per gallon and the trip is 436 miles long. If the gas costs $2.87 per gallon, how much will Brandon spend on gas for the trip?
def solve() -> int: miles_per_gallon = 28 trip_distance = 436 gas_price = 2.87 gas_needed = trip_distance / miles_per_gallon gas_cost = gas_needed * gas_price result = gas_cost return result
Anna wants to have a pizza party with her friends. She goes to three different pizzerias: Pizzeria A, Pizzeria B, and Pizzeria C. At Pizzeria A, a small pizza costs $10 and a large pizza costs $15. At Pizzeria B, a small pizza costs $12 and a large pizza costs $20. At Pizzeria C, a small pizza costs $8 and a large pizz...
def solve() -> int: pizzeria_a_prices = [10, 15] pizzeria_b_prices = [12, 20] pizzeria_c_prices = [8, 18] cheapest_pizzeria_price = min([pizzeria_a_prices[i]*3 + pizzeria_b_prices[i]*4 + pizzeria_c_prices[i]*7 for i in range(2)]) result = cheapest_pizzeria_price return result
ve and Chris have collected a total of 142 pieces of fruits. Steve collected 64 pieces while Chris collected the rest. How many pieces have Chris collected?
def solve() -> int: fruits = 142 fruits_steve = 64 fruits_chris = fruits - fruits_steve result = fruits_chris return result
A restaurant sold 120 pizzas on Monday, which was twice the number sold on Sunday. How many pizzas did the restaurant sell on Sunday?
def solve() -> int: pizzas_on_monday = 120 ratio_of_pizzas_on_monday_to_sunday = 2 pizzas_on_sunday = pizzas_on_monday // (1 + ratio_of_pizzas_on_monday_to_sunday) result = pizzas_on_sunday return result
A triangle has a base of 10 cm and a height of 6 cm. What is the area of the triangle? What is the base of a similar triangle that has an area of 24 cm^2?
def solve() -> int: base = 10 height = 6 area = (base * height) / 2 new_base = (24 * 2) / 6 result = area, new_base return result
Student: Eliana makes bracelets and sells them online. She charges $8 for each bracelet and pays $3 for the materials. She also pays a $5 monthly fee for her website. How many bracelets does she need to sell in 6 months to break even?
def solve() -> int: bracelet_price = 8 material_cost = 3 monthly_fee = 5 months = 6 total_cost = (bracelet_price * months) + (material_cost * months) + (monthly_fee * months) break_even_number = total_cost / bracelet_price result = break_even_number return result
A basketball player takes a shot and the ball ricochets off the rim. The ball bounces out in a diameter six times as far as the height from which it was shot. If the ball was shot from a height of nine feet, what was the radius of the bounce in feet?
def solve() -> int: height = 9 diameter = height * 6 radius = diameter / 2 result = radius return result
Rachel can swim 50 meters in 40 seconds. How far can she swim in 10 minutes if she takes two 1-minute breaks?
def solve() -> int: swim_distance = 50 swim_time = 40 break_time = 1 total_breaks = 2 total_time = 10 * 60 swim_time_without_breaks = swim_time * (total_time // (swim_time + break_time)) swim_distance_without_breaks = swim_distance * (total_time // (swim_time + break_time)) ...
A bakery uses 120 eggs to make 40 cakes. How many eggs are needed for 60 cakes?
def solve() -> int: eggs_per_cake = 3 cakes_1 = 40 cakes_2 = 60 eggs_1 = eggs_per_cake*cakes_1 eggs_2 = eggs_per_cake*cakes_2 result = eggs_2 return result
A bookstore sells books at a regular price of $25. They offer a 15% discount on all books in a sale. The store sold 20 books during the sale. How much money did the store make?
def solve() -> int: regular_price = 25 discount = 0.15 sale_price = regular_price * (1-discount) num_books = 20 total_revenue = num_books * sale_price result = total_revenue return result
In a classroom, there are 30 students and each student has a backpack. If there are 50 backpacks in the classroom, how many students have two backpacks?
def solve() -> int: num_students = 30 num_backpacks = 50 num_double_backpacks = num_backpacks - num_students result = num_double_backpacks return result
Q4: Simon earns $800 each month. He spends $200 on food and $100 on rent. How much money does he have left?
def solve() -> int: money_earned = 800 expense_food = 200 expense_rent = 100 result = money_earned - expense_food - expense_rent return result
Possible questions and programs are: Alice has 15 red balls. She has 5 more yellow balls than red balls. Alice has half as many green balls as yellow balls. How many balls does Alice have in total?
def solve() -> int: red = 15 yellow = red + 5 green = yellow // 2 total = red + yellow + green result = total return result
A stadium can hold 60,000 people. If tickets cost $50 each, how much money will the stadium make if it's completely sold out?
def solve() -> int: capacity = 60000 ticket_price = 50 total_revenue = capacity*ticket_price result = total_revenue return result