question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A group of 8 cyclists rode 320km. If each cyclist wants to complete 60km, how many more kilometres does each person need to ride?
def solve() -> int: num_cyclists = 8 total_distance = 320 distance_per_cyclist = 60 distance_completed = num_cyclists * distance_per_cyclist remaining_distance = total_distance - distance_completed distance_needed_per_cyclist = remaining_distance / num_cyclists result = distance_ne...
Jenny wants to buy 3 packages of candies that have 6 candies in each package. How many candies will Jenny buy in total?
def solve() -> int: number_of_packages = 3 number_of_candies = number_of_packages*6 result = number_of_candies return result
Student: A pizza parlor sells slices of pizza for $2.75 each. The parlor owner pays $52 for 15 pizzas. How much profit does the parlor owner make selling each slice of pizza?
def solve() -> int: price = 2.75 cost = 52 / 15 slices = 8 profit = price - cost result = profit return result
Hermoine has a rectangular garden with a length of 15 meters and a width of 10 meters. She wants to add 50 cm of soil to her garden. How much soil does she need in cubic meters?
def solve() -> int: new_length = 15 + 0.5*2 new_width = 10 + 0.5*2 new_area = new_length * new_width new_soil = new_area * 0.5 result = new_soil return result
Mia has four times as many stickers as Nina. 3/5 of Mia's stickers are animal-themed. If Nina has 30 animal-themed stickers, how many stickers does Mia have?
def solve() -> int: mia_animal = 30 * 4 mia_stickers = mia_animal / (3/5) result = mia_stickers return result
A school has 500 students, 40% of whom are girls. How many boys are in the school?
def solve() -> int: total_students = 500 girls_percent = 40 boys_percent = 100 - girls_percent girls = (girls_percent/100) * total_students boys = (boys_percent/100) * total_students result = boys return result
If two triangles are similar, and angle A of the first triangle measures 40 degrees, what is the measure of angle A of the second triangle?
def solve() -> int: angle_A = 40 ratio = 1 result = angle_A * ratio return result
A car travels at a constant speed of 60 km/h for 2 hours, then increases its speed by 10 km/h every hour until it reaches 100 km/h. It then maintains this speed for the rest of the journey. How long does it take to travel 500 km in total?
def solve() -> int: time_60 = 2 time_70 = round(60 / 70, 2) time_80 = round(60 / 80, 2) time_90 = round(60 / 90, 2) time_100 = round((500 - 240) / 100, 2) total_time = time_60 + time_70 + time_80 + time_90 + time_100 result = total_time return result
Emily bought 10 books for $8 each and sold them for $15 each. She gave 2 to her friends. How much profit did she make?
def solve() -> int: book_cost = 8 book_sell = 15 num_books = 10 books_given = 2 total_cost = book_cost*num_books total_sell = book_sell*(num_books-books_given) profit = total_sell - total_cost result = profit return result
A bakery sells 4 cakes and 6 cupcakes. How many desserts are there in total?
def solve() -> int: cakes = 4 cupcakes = 6 total_desserts = cakes + cupcakes result = total_desserts return result
Student: 10. Jonathan is saving up for a bike he wants to buy. He needs $590 to purchase it. He wants to have enough money saved in 1.5 months. If he makes $1,000 every two weeks, how much money should he save per paycheck?
def solve() -> int: goal = 590 paycheck = 1000 time_frame = 1.5 amount_needed = goal / time_frame amount_saved = amount_needed / 2 result = amount_saved return result
If one busload of 40 students is enough to fill a theater with 400 seats, how many busloads would be needed to fill a theater with 2000 seats?
def solve() -> int: totalSeats = 2000 busStudents = 40 numberBusloads = totalSeats / busStudents result = numberBusloads return result
A company's profits tripled from the first year to the second year. If their profits were $50,000 in the first year, how much profit did they make in the second year?
def solve() -> int: first_year_profit = 50000 second_year_profit = first_year_profit * 3 result = second_year_profit return result
A bus can hold 40 passengers. On a trip, the bus is 3/4 full. How many passengers are on the bus?
def solve() -> int: occupancy = 3/4 passengers = occupancy * 40 result = passengers return result
Q10: Tina has an array of numbers: [1, 8, 9, 14, 17, 19, 27]. She takes the difference between each consecutive number and multiplies the resulting number by 2. What is the sum of the result numbers?
def solve() -> int: arr = [1, 8, 9, 14, 17, 19, 27] res_arr = [] for i in range(len(arr) - 1): diff = arr[i+1] - arr[i] res_arr.append(diff*2) total_res = sum(res_arr) result = total_res return result
The perimeter of a square is 48 meters. What is the area of the square?
def solve() -> int: perimeter = 48 s = perimeter / 4 area = s * s result = area return result
Student: Tom is designing a logo for a client. He charges $50 per hour and spends 3 hours on the logo. He also has to pay $10 for software used in the project. How much does he earn from the project?
def solve() -> int: hourly_rate = 50 hours_spent = 3 software_cost = 10 total_charge = hourly_rate * hours_spent profit = total_charge - software_cost result = profit return result
A circular pool has a diameter of 10 meters. A rectangular deck surrounds the pool with a width of 2 meters. What is the area of the deck?
def solve() -> int: r = 5 l = 2*(r+2) w = 2*(r+2) area = l*w result = area return result
If Mike received three times as many votes as Anna, and together they received 120 votes, how many votes did Anna receive?
def solve() -> int: result = 30 return result
A company sells square-shaped carpet tiles. If each tile is 2 feet by 2 feet, how many tiles are needed to cover a rectangular area of 16 feet by 10 feet?
def solve() -> int: length_of_tile = 2 width_of_tile = 2 area_of_tile = length_of_tile * width_of_tile length_of_area = 16 width_of_area = 10 area_of_area = length_of_area * width_of_area number_of_tiles = area_of_area / area_of_tile result = number_of_tiles return res...
A boat travels 65 miles in 3 hours and 10 minutes. What is its speed in miles per hour?
def solve() -> int: distance = 65 time_in_hrs = 3+(10/60) speed_in_mph = distance/time_in_hrs result = speed_in_mph return result
A rectangle with a perimeter of 48cm has a length that is double its width. What is the length of the rectangle?
def solve() -> int: perimeter = 48 sum_length_width = perimeter / 2 width = sum_length_width / 3 result = width * 2 return result
Jane's flower shop sells 45 roses a day. If she has to sell 540 roses for Valentine's Day, how many days before Valentine's Day should she start ordering roses?
def solve() -> int: roses = 540 perday = 45 days = roses / perday result = days return result
Student: Tom runs 4 km in 20 minutes. How long will it take him to run 8 km?
def solve() -> int: distance = 8 time = 20 speed = distance / time time_to_run_8km = distance / speed result = time_to_run_8km return result
A supermarket had 720 customers on Saturday. On Sunday,it had 1.5 times as many customers as on Saturday. How many total customers did the supermarket have over the weekend?
def solve() -> int: customers_saturday = 720 customers_sunday = 1.5 * customers_saturday total_customers = customers_saturday + customers_sunday result = total_customers return result
Lisa buys a sandwich for $7.00 and adds a side of chips for $1.50 more. If she eats this same meal every weekday for a month, how much does she spend on lunch?
def solve() -> int: sandwich_price = 7.00 chips_price = 1.50 days_in_month = 30 total_cost = (sandwich_price + chips_price) * days_in_month result = total_cost return result
In Jung’s neighborhood, there are 63 fences on one side of the main road passing through the neighborhood and the number of fences on the other side of the road is five times as many. How many fences are in Jung's neighborhood?
def solve() -> int: side1_fences = 63 side2_fences = side1_fences * 5 neighborhood_fences = side1_fences + side2_fences result = neighborhood_fences return result
Katie and Liam are competing in a talent show. Katie's act lasted 2 minutes longer than Liam's and she has a score of 95. Liam's act lasted X minutes and he needs a score of 97 to be ahead of Katie. How many minutes did Liam's act last?
def solve() -> int: x = 97 - 95 result = x + 2 return result
In three years, Alisa will be 4 times as old as Peter. If Peter is currently 7 years old, how old is Alisa?
def solve() -> int: peter_age = 7 alisa_age_in_three_years = 4 * peter_age alisa_age = alisa_age_in_three_years - 3 result = alisa_age return result
At 9am on a cloudy day, Jerry set up an empty bucket outside and it started raining at his house. For the first 5 hours, the rain had a rate of 2 inches per hour. It then rained at 1 inch per hour until the rest of the day. If the bucket is 25 inches tall, at what time will the bucket be filled with rainwater?
def solve() -> int: totalwater = 0 hour = 1 while hour <= 5: totalwater += 2 hour += 1 while hour <= 8: totalwater += 1 hour += 1 if totalwater > 25: result = 7 else: result = 7 + (25-totalwater) return result
A toy store has a 20% discount on all toys. If Jessica paid $30 for a stuffed animal, how much did she save?
def solve() -> int: price = 30 discount = 0.2 saved_amount = price * discount result = saved_amount return result
Teacher Lisa passes out 30 sheets of paper to her class, but one student misplaces their sheet. The next day, Lisa passes out 3 more sheets of paper than the previous day. How many sheets of paper has she passed out over the two days?
def solve() -> int: num_sheets_day1 = 30 num_sheets_day2 = num_sheets_day1 - 1 + 3 total_sheets = num_sheets_day1 + num_sheets_day2 result = total_sheets return result
If a car travels at twice the speed of a bike, and it takes the bike 2 hours to travel 60 miles, how long, in hours, will it take the car to travel 180 miles?
def solve() -> int: bike_speed = 60/2 car_speed = bike_speed * 2 car_time = 180/car_speed result = car_time return result
Emma started with 50 pens and trades 3 of them for 6 pencils with Michael. Michael started with 70 pens and trades 10 of them for 20 markers with Emma. How many writing instruments were traded in total between Emma and Michael?
def solve() -> int: emma_pens = 50 michael_pens = 70 emma_pens -= 3 emma_pencils = 6 michael_pens -= 10 michael_markers = 20 total_traded = emma_pencils + michael_markers result = total_traded return result
In a museum, there are 120 paintings. 65% of the paintings are modern art. How many paintings are not modern art paintings in the museum?
def solve() -> int: total_paintings = 120 percent_modern_art = 65 modern_art_paintings = (percent_modern_art / 100) * total_paintings non_modern_art_paintings = total_paintings - modern_art_paintings result = non_modern_art_paintings return result
In her ice cream shop, Lisa sells chocolate ice cream and vanilla ice cream. A scoop of chocolate ice cream costs $3 and a scoop of vanilla ice cream costs $2. If Lisa sold 12 scoops of chocolate ice cream and 8 scoops of vanilla ice cream, how much money did she make from these sales?
def solve() -> int: chocolate_price = 3 vanilla_price = 2 chocolate_scoops = 12 vanilla_scoops = 8 chocolate_sales = chocolate_price * chocolate_scoops vanilla_sales = vanilla_price * vanilla_scoops total_sales = chocolate_sales + vanilla_sales result = total_sales ...
-Possible new questions and programs: Lila has four times more stickers than Aria and seven times more than Bella. If Lila has 28 stickers, how many stickers do Aria and Bella have together?
def solve() -> int: lila = 28 aria = lila / 4 bella = lila / 7 total = aria + bella result = total return result
Jeff went grocery shopping with a $50 budget. He bought a pack of apples for $7.50 and a pack of tomatoes for $2.50. If Jeff spent 95% of his budget, how much money did he have left?
def solve() -> int: budget = 50 priceApples = 7.5 priceTomatoes = 2.5 percentageSpent = 95 totalSpent = priceApples + priceTomatoes totalRemain = (budget * percentageSpent) / 100 moneyLeft = totalRemain - totalSpent result = moneyLeft return result
Anna can earn $8 per hour when she sells lemonade and $10 per hour when she sells cookies. If she sells lemonade for 4 hours and cookies for 3 hours, and also gets a $5 tip from a generous customer, how many dollars will Anna earn?
def solve() -> int: lemonade_rate = 8 cookie_rate = 10 tip = 5 lemonade_hours = 4 cookie_hours = 3 lemonade_earnings = lemonade_rate * lemonade_hours cookie_earnings = cookie_rate * cookie_hours total_earnings = lemonade_earnings + cookie_earnings + tip result = total_earnings re...
Emily starts a new job with a salary of $40,000 per year. If she is paid bi-weekly, what is her gross pay for one pay period?
def solve() -> int: annual_salary = 40000 biweekly_pay = annual_salary / 26 result = biweekly_pay return result
A clothing store offers a 30% discount for all clearance items. If a clearance shirt is originally $25, how much does the customer pay with the discount applied?
def solve() -> int: original_price = 25 discount_percent = 30 discount_amount = original_price * (discount_percent / 100) final_price = original_price - discount_amount result = final_price return result
Randell is making tacos for 12 people. The recipe requires 4 tortillas per person. How many tortillas will Randell need in total?
def solve() -> int: no_of_people = 12 no_of_tortillas_per_person = 4 total_no_of_tortillas = no_of_people * no_of_tortillas_per_person result = total_no_of_tortillas return result
If the cost of a pack of pencils is $5 and the number of packs bought is twice the number of students in a class, calculate the total cost for a class of 20 students.
def solve() -> int: num_students = 20 num_packs = 2 * num_students cost_per_pack = 5 total_cost = num_packs * cost_per_pack result = total_cost return result
Henry is a tailor who needs to use 2 meters of cloth for each suit he makes. He has 50 meters of cloth in stock. If every meter of cloth is used to make a suit, how many suits can Henry make?
def solve() -> int: cloth_in_stock = 50 cloth_per_suit = 2 suits = cloth_in_stock // cloth_per_suit result = suits return result
Possible sample questions and Python programs: Bob has 4 pens, 5 pencils, and 6 erasers. He wants to share them equally with his two friends Alice and Charlie. How many items does each person get?
def solve() -> int: total_items = 4 + 5 + 6 items_per_person = total_items / 3 result = items_per_person return result
At a party, there are 90 guests who are either wearing white shirts or blue shirts. The host decides to invite 8 more guests who are wearing blue shirts. If there were 50 guests wearing white shirts, how many guests were originally wearing blue shirts?
def solve() -> int: white_shirts = 50 total_guests = 90 additional_blue_shirts = 8 blue_shirts = total_guests - white_shirts original_blue_shirts = blue_shirts - additional_blue_shirts result = original_blue_shirts return result
A local bakery was selling cupcakes and muffins for a fundraiser. They baked 240 cupcakes and 360 muffins. They sold each cupcake for $1.25 and each muffin for $0.75. They also spent $120 on ingredients and $80 on packaging. How much money did they raise?
def solve() -> int: cupcakes = 240 cupcake_price = 1.25 muffins = 360 muffin_price = 0.75 sales = (cupcakes * cupcake_price) + (muffins * muffin_price) ingredients = 120 packaging = 80 expenses = ingredients + packaging raised = sales - expenses result = raised return result...
A group of 8 friends went out for dinner. The total bill was $160. If they each paid an equal amount, how much did they each pay?
def solve() -> int: per_person = 160/8 result = per_person return result
A fruit seller has 15 apples and 30 oranges. If he sells 5 apples and 10 oranges, how many fruits are left?
def solve() -> int: apples_left = 15-5 oranges_left = 30-10 total_fruits_left = apples_left + oranges_left result = total_fruits_left return result
John has 2 aquariums. Each aquarium holds 50 gallons of water, and each gallon has 20 fish. How many fish can all the aquariums hold?
def solve() -> int: aquariums = 2 gallonsPerAquarium = 50 fishPerGallon = 20 totalFish = aquariums * gallonsPerAquarium * fishPerGallon result = totalFish return result
Jenna wanted to buy a house, but found out her monthly payments would be higher than she expected. She determined that she could afford $1,300 in monthly payments. With an annual interest rate of 4%, how much money can she borrow?
def solve() -> int: payment = 1300 rate = 0.04 time = 12 total_payment = payment * time principal = total_payment / (1 + rate) result = principal return result
Student: In a store, the price of an item was $20, but now it's on sale for 10% off. What's the new price of the item?
def solve() -> int: price = 20 discount = 0.1 new_price = price * (1 - discount) result = new_price return result
A slippery caterer added a service charge to the bill without informing the customer. If a customer's total bill was $800, with a 20% tax rate, and they requested catering for 50 people at $10 per person, how much was the service charge?
def solve() -> int: num_people = 50 cost_per_person = 10 subtotal = num_people * cost_per_person tax_rate = 0.20 total_bill = subtotal + (subtotal * tax_rate) service_charge = total_bill - 800 result = service_charge return result
Emma bought 3 pack of notebooks for $3. She wants to share each pack with her 4 friends. How much should each friend pay?
def solve() -> int: no_packs = 3 cost_packs = 3 no_friend = 4 cost_each_packs = cost_packs / no_packs cost_each_friend = cost_each_packs / no_friend result = cost_each_friend return result
Student: 7. Twenty students need to share the cost of a field trip. If the ticket costs 500 dollars, how much money should each student pay?
def solve() -> int: students = 20 ticket = 500 amount = ticket / students result = amount return result
A florist bought twice as many roses as lilies. If the florist bought 40 lilies, how many roses did they buy?
def solve() -> int: lilies = 40 roses = lilies * 2 flowers = lilies + roses result = flowers return result
Possible math questions and python programs: - Maya's grade on a history test is 15. Ben got 5 more than Maya while Leah got 4 less than Ben. If the history test has 25 points in total, how many points did Leah lose?
def solve() -> int: maya = 15 ben = maya + 5 leah = ben - 4 max_score = 25 lost = max_score - leah result = lost return result
Student: Rachel's week consists of 56 hours. She spends 8 hours at work each day, 7 hours sleeping each night, and 4 hours every day on household chores. How many hours does Rachel have left for leisure activities?
def solve() -> int: hours_in_week = 56 hours_at_work = 8 hours_sleeping = 7 hours_household_chores = 4 total_hours_spent = (hours_at_work * 7) + (hours_sleeping * 7) + (hours_household_chores * 7) hours_left_for_leisure = hours_in_week - total_hours_spent result = hours_left_for_leisure ...
James had $117 and he bought 6 drinks. Each drink cost $3.50. How much money does James have left after buying the drinks?
def solve() -> int: money = 117 drink_num = 6 cost_each = 3.50 total_cost = drink_num * cost_each result = money - total_cost return result
Amy has 24 pieces of candy. 3/4 of the candy are lollipops and the rest are chocolate bars. How many lollipops does Amy have?
def solve() -> int: candy = 24 groups = [3/4, 1/4] amysLollipops = 0 for group in groups: totalCandy = candy * group totalCandy = int(totalCandy) if group == 3/4: amysLollipops = totalCandy else: pass result = amysLollipops return res...
There are 18 students on the soccer team. Out of these 18 people, 5 are injured and can not practice. How many students are able to practice soccer?
def solve() -> int: total_students = 18 injured_students = 5 practicing_students = total_students - injured_students result = practicing_students return result
Matt is saving money for a bike that costs $120. He earns $15 every week from doing chores and saves half of it. He also gets $10 every month from his allowance and saves all of it. How many weeks will it take him to save enough money for the bike?
def solve() -> int: money_from_chores = 15 / 2 money_from_allowance = 10 money_per_month = money_from_chores * 4 + money_from_allowance months_needed = 120 / money_per_month weeks_needed = months_needed * 4 result = weeks_needed return result
Out of a total of 900 people, 270 strongly support raising the minimum wage. How many people do not support raising the minimum wage?
def solve() -> int: x = 900 y = 0.3 support = x * y not_support = x - support result = not_support return result
Tom works as a mechanic and his tools are in the basement of his shop. He goes down the stairs to the basement 12 times a day to get his tools and back up 10 times a day to work on cars. How many flights of stairs does Tom take in a day?
def solve() -> int: num_down = 12 num_up = 10 flights_per_trip = 2 total_flights = (num_down + num_up) * flights_per_trip result = total_flights return result
A store bought 300 notebooks for $900. They sold them all for $4 each. What is the store's profit?
def solve() -> int: notebook_cost = 900/300 selling_price = 4 profit_per_notebook = selling_price - notebook_cost total_profit = profit_per_notebook * 300 result = total_profit return result
A box has 24 cookies, 10 of which are chocolate. What percentage of the cookies are chocolate?
def solve() -> int: total_cookies = 24 chocolate_cookies = 10 percentage_chocolate = (chocolate_cookies/total_cookies) * 100 result = percentage_chocolate return result
A man travelled a distance of 150 km. He travelled for the first 60 km at a speed of 40 km/hour and the remaining distance at a speed of 60 km/hour. What was his average speed for the journey?
def solve() -> int: distance = 150 first_distance = 60 second_distance = distance - first_distance first_speed = 40 second_speed = 60 total_time = first_distance / first_speed + second_distance / second_speed average_speed = distance / total_time result = average_speed return result
Raul, Mike, and Marcus have a total of $22 in their wallets. Raul has $6 more than Mike and Marcus has 7 times less than Raul. How much money does Marcus have?
def solve() -> int: money_mike = 22 / 3 money_raul = money_mike + 6 money_marcus = money_raul * (1/7) result = money_marcus return result
Student: There are 25 more dogs than cats, and 4 times as many cats as hamsters. If there are 140 animals in total, how many hamsters are there?
def solve() -> int: dogs = 0 cats = 0 hamsters = 0 total_animals = 140 cats = total_animals / 5 dogs = cats + 25 hamsters = cats / 4 result = hamsters return result
A bag contains 300 balls. If 7/20 of the balls are white, 1/4 of the remainder are blue and the rest are red, how many red balls are in the bag?
def solve() -> int: bag = 300 white = bag * 7/20 remaining = bag - white blue = remaining * 1/4 red = remaining - blue result = red return result
Mark used to buy 4 shirts for $15 each. The price increased by 20% so he only buys 3 now. How much money does he save per day compared to what he used to spend?
def solve() -> int: old_price = 15 new_price = old_price * 1.2 num_shirts_old = 4 num_shirts_new = 3 total_cost_old = old_price * num_shirts_old total_cost_new = new_price * num_shirts_new savings_per_day = total_cost_old - total_cost_new result = savings_per_day ...
A bookstore sells books for $15 each. If John bought 3 books, how much did he pay in total?
def solve() -> int: books_bought = 3 book_price = 15 total_cost = books_bought * book_price result = total_cost return result
Chloe wants to buy some shoes. She has $100 to spend. If each pair of shoes costs $25, how many pairs of shoes can she buy and how much money will she have left over?
def solve() -> int: shoe_price = 25 total_money = 100 num_shoes = total_money // shoe_price money_left = total_money % shoe_price result = f'<<<Chloe can buy {num_shoes} pairs of shoes and she will have ${money_left} left over.>>>' return result
At a stationery store, Max is selling his $2.00 pencils and $4.00 notebooks at 20% off. If he sells 100 pencils and 50 notebooks, how much money did he make?
def solve() -> int: pencil_price = 2.00 notebook_price = 4.00 discount = 0.20 pencil_discounted_price = pencil_price - (pencil_price * discount) notebook_discounted_price = notebook_price - (notebook_price * discount) pencil_quantity = 100 notebook_quantity = 50 pencil_tot...
Matt collected shells at the beach. On Monday he found 25 shells. On Tuesday he found only a fifth as many shells as he did on Monday. On Wednesday he found six times as many shells as he did on Tuesday, but his little cousin accidentally threw 2 of them in the ocean. How many shells did Matt have in total after the th...
def solve() -> int: monday_shells = 25 tuesday_shells = monday_shells / 5 wednesday_shells = tuesday_shells * 6 - 2 total_shells = monday_shells + tuesday_shells + wednesday_shells result = total_shells return result
In May, Michael spent 84 hours painting his house. If he plans to paint 7 hours per day this week, how many hours less will he spend painting his house?
def solve() -> int: total_hours = 84 hours_per_day = 7 hours_this_week = hours_per_day * 7 hours_less = total_hours - hours_this_week result = hours_less return result
If Henry runs 5 miles every hour, how many miles will he run in 8 hours?
def solve() -> int: miles_per_hour = 5 hours = 8 total_miles = miles_per_hour * hours result = total_miles return result
A sports store offers free shipping for a minimum purchase of $75. Jake bought 2 basketballs for $24.99 each, 1 football for $34.99, and 4 pairs of socks for $9.99 each. How much more worth of sports equipment should he buy to avail of the free shipping?
def solve() -> int: basketball_price = 24.99 football_price = 34.99 socks_price = 9.99 basketball_quantity = 2 football_quantity = 1 socks_quantity = 4 total_cost = (basketball_price * basketball_quantity) + (football_price * football_quantity) + (socks_price * socks_quantity) ...
Student: The area of a rectangle is 80 square meters. If the length of the rectangle is 16 meters, what is the width of the rectangle?
def solve() -> int: area = 80 length = 16 width = area / length result = width return result
Student: If the cost of one shirt is $15, and you buy 5 shirts, how much do you have to pay?
def solve() -> int: cost_of_one_shirt = 15 number_of_shirts = 5 total_cost = cost_of_one_shirt * number_of_shirts result = total_cost return result
For every hour of work, Tyler gets paid $35 and $450 for working for 30 hours in a week. How much did he earn last week if he worked 50 hours altogether?
def solve() -> int: hourly_rate = 35 weekly_salary = 450 hours_worked = 50 hourly_earnings = hourly_rate * hours_worked weekly_earnings = weekly_salary + hourly_earnings result = weekly_earnings return result
A company had a profit margin of 20%. If its revenue was $500,000, what was the profit of the company?
def solve() -> int: revenue = 500000 profit_margin = 0.2 profit = revenue*profit_margin result = profit return result
A teacher needs to distribute 120 books among 20 students. How many books will each student get, assuming the books are shared equally?
def solve() -> int: num_books = 120 num_students = 20 books_per_student = num_books // num_students result = books_per_student return result
arah purchased 18 bags of potato chips at 5 dollars per bag, 12 packages of cheese for 4 dollars each, and 8 boxes of cookies at $2 per box. How much money was her total bill?
def solve() -> int: chips_buy = 18 chips_cost = 5 cheese_buy = 12 cheese_cost = 4 cookies_buy = 8 cookies_cost = 2 total_bill = (chips_buy * chips_cost) + (cheese_buy * cheese_cost) + (cookies_buy * cookies_cost) result = total_bill return result
Tim is at his friend's house warming party, where he learns that he is 5 years older than his friend's younger brother. His friend's younger brother is 10 years younger than their father. If their father is 55, how old is Tim?
def solve() -> int: father_age = 55 younger_brother_age = father_age - 10 tim_age = younger_brother_age + 5 result = tim_age return result
Rachel purchased 80 books for $480. She sold 30 of them for $6 at the bookstore, 20 were sold to a library for $12 each. If the remainder were sold for $10 each. How much profit did Rachel make?
def solve() -> int: books_purchased = 80 total_cost = 480 books_sold_bookstore = 30 price_bookstore = 6 books_sold_library = 20 price_library = 12 books_sold_remainder = books_purchased - books_sold_bookstore - books_sold_library price_remainder = 10 total_revenue...
Kim has a coupon that gives her 25% off any purchase at a bookstore. She buys a book that costs $12 and a magazine that costs $4. How much does she pay after using the coupon?
def solve() -> int: total = 12 + 4 discount = total * 0.25 final = total - discount result = final return result
Jack has $50, and he wants to buy a Total of 4 items priced at $7 each. How much money does Jack have left if he spends all his money?
def solve() -> int: initial_money = 50 item_cost = 7 num_items = 4 total_cost = item_cost * num_items remaining_money = initial_money - total_cost result = remaining_money return result
Anna makes 8 bracelets and 6 necklaces every day for the first 3 days of the month. She sells each bracelet for $5 and each necklace for $8. For the next 3 days, she makes 10 bracelets and 4 necklaces every day. She sells each bracelet for $6 and each necklace for $7. For the rest of the month, she makes and sells no j...
def solve() -> int: first_three_days = (8 * 5 + 6 * 8) * 3 next_three_days = (10 * 6 + 4 * 7) * 3 rest_of_the_month = 0 result = first_three_days + next_three_days + rest_of_the_month return result
Rachel has $20 more worth of earrings than Sarah has. If Sarah has 8 earrings, and each earring is worth $2, how many earrings does Rachel have?
def solve() -> int: sarah_earrings = 8 earring_price = 2 sarah_worth = sarah_earrings * earring_price rachel_worth = sarah_worth + 20 rachel_earrings = rachel_worth / earring_price result = rachel_earrings return result
If a roll of tape can wrap four gifts, and David uses it to wrap two gifts and fix a tear in his shirt, what percentage of tape is left?
def solve() -> int: roll_of_tape = 1 gifts_wrapped = 2 tear_fixed = 1 total_gifts = gifts_wrapped + tear_fixed tape_used = total_gifts / 4 tape_left = roll_of_tape - tape_used percentage_left = tape_left / roll_of_tape * 100 result = percentage_left return result
Student: Mia and Noah want to make some bracelets for their friends. They need 8 beads for each bracelet, and they have 40 beads in total. They also need some string, which costs $0.50 for each meter. They can make one bracelet with 0.2 meters of string. How much money will they need to spend on string for all the brac...
def solve() -> int: beads = 40 bracelets = beads // 8 string_per_bracelet = 0.2 string_total = string_per_bracelet * bracelets cost_per_meter = 0.5 cost_total = cost_per_meter * string_total result = cost_total return result
Student: Ryan bought a pack of 100 stickers for $10. He gave 20 stickers to his friends and sold the rest for $0.2 each. How much money did he make or lose?
def solve() -> int: pack_cost = 10 pack_size = 100 given = 20 sold = pack_size - given price = 0.2 revenue = sold * price profit = revenue - pack_cost result = profit return result
Ella has 12 pencils. She borrowed 3 pencils from her friend, and then gave half of her pencils to another friend. She then lost 2 pencils on her way home. How many pencils will she have left?
def solve() -> int: total_pencils = 12 + 3 pencils_to_friend = total_pencils // 2 total_pencils = total_pencils - pencils_to_friend total_pencils = total_pencils - 2 result = total_pencils return result
John has a weekly house cleaning service for $50. If he adds laundry service, it will cost an additional $20 per week. The dishwashing service costs $5 less per week than the laundry service. If John adds laundry service and the dishwashing service, what will his total weekly payment be?
def solve() -> int: cleaning_service = 50 laundry_service = 20 dishwashing_service = laundry_service - 5 total_payment = cleaning_service + laundry_service + dishwashing_service result = total_payment return result
The perimeter of a rectangle is 40. If the length is 10, what is the width?
def solve() -> int: perimeter = 40 length = 10 width = (perimeter - 2 * length) / 2 result = width return result
Student: There are 25 students in a class. If 60% of them are girls, how many boys are in the class?
def solve() -> int: total_students = 25 percentage_girls = 0.6 num_girls = total_students * percentage_girls num_boys = total_students - num_girls result = num_boys return result
A baker spent $100 on ingredients to make 12 cakes. If they sell each cake for $15, how much profit will they make after selling all the cakes?
def solve() -> int: cost = 100 cakes = 12 price = 15 revenue = cakes * price profit = revenue - cost result = profit return result
Sophie acquires 6 dogs for $200 each and 9 cats for $100 each. She also has to pay $20 for each animal as registration fee. What is the total amount she spends on the animals? Samantha is a chef and wants to make cupcakes. She needs 120 cups of flour. Each bag of flour has 6 cups inside. How many bags of flour does she...
def solve() -> int: dogs = 6 cats = 9 dog_price = 200 cat_price = 100 registration_fee = 20 total_dog_cost = dogs * dog_price total_cat_cost = cats * cat_price total_registration_fee = (dogs + cats) * registration_fee total_cost = total_dog_cost + total_cat_cost + total_reg...
Mike is planning to build a deck in his backyard. He can choose between two lumber stores. The first store offers pressure-treated wood for $5 per square foot while the second store offers composite wood for $7 per square foot. If Mike needs to build a deck that measures 10 feet by 20 feet, which type of wood should he...
def solve() -> int: length = 10 width = 20 area = length * width pressure_treated_cost = area * 5 composite_cost = area * 7 if pressure_treated_cost < composite_cost: cheaper_wood = "pressure-treated" else: cheaper_wood = "composite" result = f'Mi...