question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Emma's headphones can play music for up to 20 hours on a fully charged battery. She has already used them for 8 hours and will be traveling by plane for 6 hours. How many hours of battery life will Emma's headphones have left after her flight?
def solve() -> int: battery_life = 20 used_hours = 8 travel_hours = 6 remaining_hours = battery_life - used_hours - travel_hours result = remaining_hours return result
Sarah is currently 18. 4 years ago, she was half the age of Mia. If Mia's twin brother is 10 years older than Mia, how old is Mia's twin brother?
def solve() -> int: sarah_age = 18 mia_age = (sarah_age - 4) * 2 twin_brother_age = mia_age + 10 result = twin_brother_age return result
If there are 2 more cups than saucers on the table, and there are 10 saucers. How many plates are on the table?
def solve() -> int: saucers = 10 cups = saucers + 2 total_plates = cups + saucers result = total_plates return result
A math test has 40 questions. If each correct answer is worth 5 points and each incorrect answer is worth -2 points, and a student answered 25 questions correctly and 5 questions incorrectly, what is the student's score?
def solve() -> int: correct = 25*5 incorrect = 5*(-2) score = correct + incorrect result = score return result
If a student buys a case of pencils that lasts for 6 months and the case costs $12, how much would that student spend on pencils in a year?
def solve() -> int: pencils_per_month = 1/6 * 12 pencils_per_year = pencils_per_month * 12 cost_per_year = pencils_per_year * 12 result = cost_per_year return result
A car can go 25 miles with 1 gallon of gas. If the car has a 12-gallon gas tank, how far can it travel without refueling?
def solve() -> int: miles_per_gallon = 25 gas_tank = 12 total_miles = miles_per_gallon * gas_tank result = total_miles return result
A company has 2500 employees and wants to hire 20 more. If the company has a budget to give each employee a salary of $70,000 per year, what will be the new annual payroll?
def solve() -> int: num_employees = 2500 new_employees = 20 total_employees = num_employees + new_employees salary_per_employee = 70000 annual_payroll = total_employees * salary_per_employee result = annual_payroll return result
In a class of 30 students, 20% are proficient in French and are also interested in traveling. 50% of the students are proficient in French. What are the odds that a randomly selected student is proficient in French and interested in traveling?
def solve() -> int: total_students = 30 proficient_in_french = total_students * 0.5 proficient_in_french_and_interested = proficient_in_french * 0.2 odds = proficient_in_french_and_interested / total_students result = odds return result
A dance group's performers each receive $15 per show. If there are 8 performers and they earned $240, how many shows did they perform in?
def solve() -> int: num_performers = 8 earnings_per_show = 15 total_earnings = 240 num_shows = total_earnings / (num_performers * earnings_per_show) result = num_shows return result
A car drives at a constant speed of 60 miles per hour for 2 hours. How many miles did the car travel in those 2 hours?
def solve() -> int: speed = 60 time = 2 distance = speed * time result = distance return result
A cake requires 3 eggs, 2 cups of flour, 1 cup of milk, and 0.5 cups of oil. If one egg costs $0.15, one cup of flour costs $0.20, one cup of milk costs $0.25, and one cup of oil costs $0.50, what is the cost, in dollars, to bake 5 cakes?
def solve() -> int: egg_cost = 3 * 0.15 flour_cost = 2 * 0.20 milk_cost = 1 * 0.25 oil_cost = 0.5 * 0.50 cake_cost = egg_cost + flour_cost + milk_cost + oil_cost result = cake_cost * 5 return result
A school has 500 students. 60% of them are boys and the rest are girls. If they need to form equal groups of boys and girls, how many groups can they form?
def solve() -> int: total_students = 500 boys_percent = 60 boys = int(total_students * (boys_percent/100)) girls = total_students - boys num_groups = min(boys, girls) result = num_groups return result
A year ago, Mark was only a fifth as old as Peter. If Peter is currently 45 years old, how old is Mark now?
def solve() -> int: peter_age = 45 mark_age = (peter_age - 1) / 5 result = mark_age return result
John wants to save money on his commute to work. He is debating whether to buy a hybrid car or a gas-powered car. The hybrid car gets 50 miles per gallon and costs $30,000. The gas-powered car gets 30 miles per gallon and costs $20,000. Gas costs $3 per gallon. If John drives 1,000 miles per month to get to work, which...
def solve() -> int: hybrid_mpg = 50 hybrid_cost = 30000 gas_mpg = 30 gas_cost = 20000 gas_price = 3 monthly_miles = 1000 hybrid_gas_cost = monthly_miles / hybrid_mpg * gas_price hybrid_total_cost = hybrid_cost + hybrid_gas_cost gas_gas_cost = monthly_miles / gas_mpg * gas_p...
ally sold tickets for a concert. Each ticket cost $20. She sold 15 tickets and made some profit. If her total profit was $75, what was the cost of each ticket?
def solve() -> int: tickets_sold = 15 total_profit = 75 ticket_cost = (total_profit/tickets_sold) - 20 result = ticket_cost return result
Brad has 25 trees in his garden; Lisa has 5 trees. If Lisa plants 3 trees every day and Brad doesn't plant any new trees, in how many days will Lisa have the same number of trees as Brad does now?
def solve() -> int: brad_trees = 25 lisa_trees = 5 daily_growth = 3 days = (brad_trees - lisa_trees) / daily_growth result = days return result
It takes a truck 10 hours to travel from Portland to Phoenix at a speed of 55 mph. Once the truck gets to Phoenix it takes an additional 5 hours to reach its destination in Las Vegas. What is the total time for the trip?
def solve() -> int: speed = 55 time_in_hours_portland_phoenix = 10 time_in_hours_phoenix_las_vegas = 5 total_time = time_in_hours_portland_phoenix + time_in_hours_phoenix_las_vegas result = total_time return result
Ellie earned $100 for a part-time job. Her employer deducted 15% for tax and $10 for uniform. How much did she take home?
def solve() -> int: income = 100 tax_percentage = 0.15 uniform_fee = 10 tax_amount = income * tax_percentage take_home_pay = income - tax_amount - uniform_fee result = take_home_pay return result
Possible new questions: Mason wants to save money for a new bike that costs $120. He has $20 in his piggy bank already and decides to do some chores around the house to earn more. He gets paid $5 for each chore he completes. He does 3 chores on Monday, 2 chores on Tuesday, 4 chores on Wednesday, 1 chore on Thursday, an...
def solve() -> int: piggy_bank = 20 bike_cost = 120 chore_pay = 5 monday_chores = 3 tuesday_chores = 2 wednesday_chores = 4 thursday_chores = 1 friday_chores = 2 week_chores = monday_chores + tuesday_chores + wednesday_chores + thursday_chores + friday_chores week_earnings = week...
The cost of a box of chocolates is $15. If the sales tax is 8%, what is the total amount John has to pay for the chocolates?
def solve() -> int: chocolates_cost = 15 sales_tax = 0.08 * chocolates_cost total_cost = chocolates_cost + sales_tax result = total_cost return result
Samantha had some toys, and she gave 4 of them to Jake. Now, Samantha has 6 times more toys than Jake. If Jake had 3 toys at first, how many toys did Samantha have at first? Alex has 8 apples. Brian gives Alex triple the number of apples he has. Alex then gives Brian back two-thirds plus 1 of his new total. How many ap...
def solve() -> int: samantha_toys = 0 jake_toys = 0 jake_toys = 3 samantha_toys = jake_toys + 4 jake_toys += 4 samantha_toys = 6 * jake_toys result = samantha_toys return result
At the Widget Factory, Sam can assemble 1 widget every 10 minutes. Dave can help assemble widgets when he doesn't have anything else to do. When they work together, it takes them 25 minutes to assemble 4 complete widgets. This morning, Sam and Dave have been putting together widgets for 4 hours before lunch break. How ...
def solve() -> int: time_taken = 4 * 60 widgets_per_sam_and_dave = 4 * 4 time_for_one_widget_by_sam_and_dave = 25/widgets_per_sam_and_dave widgets_completed = time_taken/time_for_one_widget_by_sam_and_dave result = widgets_completed return result
A rectangle has a length of 15 cm and width of 10 cm. What is the area of the rectangle in square centimeters?
def solve() -> int: length = 15 width = 10 area = length * width result = area return result
Emma is making burgers. She needs to use 5 patties for every 6 buns. She has 36 patties. How many buns should she buy?
def solve() -> int: number_of_patties = 36 patties_per_buns = 5 buns = number_of_patties / patties_per_buns result = buns return result
The circumference of a circle is 62.8 cm. What is the diameter of the circle?
def solve() -> int: circumference = 62.8 pi = 3.14159 diameter = circumference / pi result = diameter return result
Tom spends 1 hour reading a novel and twice as long writing a review. Then he drives to the bookstore which is 3 miles away. If he drives at 15 miles per hour, how much time does he spend reading, writing a review, and driving to the bookstore? The cost of a single slice of pizza is $2.50, while a whole pizza with 8 sl...
def solve() -> int: reading_time = 1 writing_time = 2 * reading_time distance = 3 speed = 15 driving_time = distance / speed total_time = reading_time + writing_time + driving_time slice_cost = 2.5 whole_pizza_cost = 18 cost_saved = 8 * slice_c...
A man drove half of the distance on a straight road with a velocity of 30 km/h, and the other half with a velocity of 60 km/h. What is his average speed on the entire journey?
def solve() -> int: distance = 2 time_taken_at_30kmph_speed = 0.5 / 30 time_taken_at_60kmph_speed = 0.5 / 60 total_time = time_taken_at_30kmph_speed + time_taken_at_60kmph_speed average_speed = distance / total_time result = average_speed return result
Emma had 48 pencils and gave away half of them. How many pencils did Emma have left?
def solve() -> int: pencils_emma = 48 pencils_given = pencils_emma/2 result = pencils_emma - pencils_given return result
Emily, the delivery driver, can drive at a speed of 50 miles per hour if she is driving an empty truck, but she drives at a speed of 35 miles per hour if she is driving a fully loaded truck. If Emily takes a 5-part journey, first driving the loaded truck for 200 miles, then driving the empty truck for 100 miles, then d...
def solve() -> int: empty_truck_speed = 50 loaded_truck_speed = 35 distance_loaded1 = 200 distance_empty1 = 100 distance_loaded2 = 150 distance_empty2 = 50 distance_loaded3 = 50 time_loaded1 = distance_loaded1 / loaded_truck_speed time_empty1 = distance_empty1 / empty_truck...
Laura has 80 stickers. She wants to divide them equally among herself and 7 of her friends. How many stickers will each person get?
def solve() -> int: stickers = 80 friends = 8 each_person = stickers // friends result = each_person return result
There are 25 questions in an exam. If a student gets 4 points for each correct answer and loses 1 point for each incorrect answer, and leaves 5 questions blank, what is the student's score in the exam?
def solve() -> int: num_of_questions = 25 points_per_correct_answer = 4 points_per_incorrect_answer = -1 num_of_blank_questions = 5 num_of_correct_answers = 15 num_of_incorrect_answers = num_of_questions - num_of_blank_questions - num_of_correct_answers score = num_of_correct_answers * point...
Mary went to the restaurant and ordered pizza, pasta, and salad. The restaurant charges $15 for a pizza and $20 for a pasta. Mary’s bill was four times the cost of a pizza. What did Mary pay for the salad?
def solve() -> int: pizza_cost = 15 pasta_cost = 20 mary_bill = 4 * pizza_cost salad_cost = mary_bill - (pizza_cost + pasta_cost) result = salad_cost return result
A store is having a sale where everything is 20% off. If Andrew wants to buy a $60 jacket, how much will he pay during the sale?
def solve() -> int: original_price = 60 discount_percentage = 0.2 discount_amount = original_price * discount_percentage sale_price = original_price - discount_amount result = sale_price return result
Farmer John's tractor can till an acre of land in 6 hours while his son can till an acre in 8 hours. How many hours would it take for the two of them to till 3 acres together?
def solve() -> int: tractor_rate = 1/6 son_rate = 1/8 total_rate = tractor_rate + son_rate total_acres = 3 total_time = total_acres / total_rate result = total_time return result
A company sold 350 tickets for a concert. The tickets were priced at $25 for adults and $10 for children. If the company earned $8400 from the ticket sales, how many adult tickets and how many children tickets were sold?
def solve() -> int: total_tickets = 350 adult_price = 25 child_price = 10 total_money = 8400 adult_tickets = ((total_money/total_tickets) - ((total_tickets-(350*.6))*child_price))/(adult_price - child_price) child_tickets = total_tickets - adult_tickets result = adult_tickets, child_tickets ...
A fruit stand sells apples for $0.35 each and oranges for $0.50 each. If they sell 20 apples and 15 oranges in one day, how much money did they make that day?
def solve() -> int: apple_sales = 20*0.35 orange_sales = 15*0.5 total_sales = apple_sales+orange_sales result = total_sales return result
Alex had 7.5 hours to travel, but his flight was delayed by 1 hour and 15 minutes. How long did Alex spend traveling?
def solve() -> int: total_travel_time = 7.5 delay_time = 1.25 actual_travel_time = (total_travel_time * 60) - delay_time result = actual_travel_time return result
Lisa bought 2 pairs of shorts that cost $25 each, and 3 t-shirts that cost $18 each. If the sales tax is 7%, how much did she spend in total?
def solve() -> int: cost_shorts = 25*2 cost_shirts = 18*3 subtotal = cost_shorts + cost_shirts tax = subtotal*0.07 total_cost = subtotal + tax result = f'<<<{total_cost}>>>' result = total_cost return result
Some possible math questions and programs are: Mia has 15 stickers. She gives 4 to Leo and 3 to Zoe. How many stickers does she have left?
def solve() -> int: mia = 15 leo = 4 zoe = 3 mia = mia - leo - zoe result = mia return result
Anna sells lemonade for $0.5 per cup. She spends $10 on ingredients and cups every week. She sells an average of 15 cups per day from Monday to Friday, and 25 cups per day on Saturday and Sunday. How much profit does she make in a week?
def solve() -> int: daily_income = 0.5 * 15 weekend_income = 0.5 * 25 weekly_income = (daily_income * 5) + (weekend_income * 2) weekly_profit = weekly_income - 10 result = weekly_profit return result
Tim has 10 CDs, and each CD has 12 songs. If he wants to listen to all the songs once, how many songs will he listen to in total?
def solve() -> int: cds = 10 songs_per_cd = 12 total_songs = cds * songs_per_cd result = total_songs return result
Student: A regular hexagon has a side length of 5 meters. What is the perimeter of the hexagon?
def solve() -> int: side = 5 sides = 6 perimeter = side * sides result = perimeter return result
Student: A bakery has 56 cupcakes. If they sold 15 cupcakes in the morning and 23 cupcakes in the afternoon. How many cupcakes are left in the bakery?
def solve() -> int: cupcakes_in_bakery = 56 cupcakes_sold_morning = 15 cupcakes_sold_afternoon = 23 total_cupcakes_sold = cupcakes_sold_morning + cupcakes_sold_afternoon cupcakes_left_in_bakery = cupcakes_in_bakery - total_cupcakes_sold result = cupcakes_left_in_bakery return result
Ryan takes a taxi to work every day. The taxi ride costs $15. If Ryan works 5 days a week and takes a two-week vacation, how much money will he spend on taxi rides in a year?
def solve() -> int: rides_per_week = 5 weeks_per_year = 50 cost_per_ride = 15 total_rides = rides_per_week * weeks_per_year - 10 total_cost = total_rides * cost_per_ride result = total_cost return result
Sarah works at a coffee shop for 7 hours a day at a rate of $9 per hour. She used 3/7 of her earnings from last week to buy a new espresso machine. She then spent 4/9 of her remaining money on coffee beans. How much money is left from her earnings last week?
def solve() -> int: hours_per_day = 7 rate_per_hour = 9 earnings_last_week = hours_per_day * rate_per_hour * 7 money_spent_on_espresso_machine = earnings_last_week * 3/7 money_remaining_after_espresso_machine = earnings_last_week - money_spent_on_espresso_machine money_spent_on_coffee_beans = mo...
At a party, there are 10 guests and each guest drinks a different amount of soda. One guest drinks half of all the soda. Another guest drinks 12 cans of soda, and the remaining 8 guests drink the rest of the soda equally. If there are 5 cans of soda left, how many cans of soda were originally at the party?
def solve() -> int: guests = 10 half_soda_guest = 1 soda_per_guest = 12 total_soda = (guests - 2) * soda_per_guest + 5 result = total_soda return result
A restaurant served 50 guests yesterday and five times as many today. How many guests should be served tomorrow?
def solve() -> int: yesterday = 50 today = 5 * yesterday tomorrow = 2 * today result = tomorrow return result
A delivery service has 5 drivers and each driver can deliver 20 packages per day. However, only 3 drivers are available today. If the service got an order for 60 packages, how many days will the 3 drivers need to complete the delivery?
def solve() -> int: packages_per_day_per_driver = 20 num_drivers = 3 num_packages = 60 total_packages_per_day = packages_per_day_per_driver * num_drivers days_needed = num_packages / total_packages_per_day result = days_needed return result
Tim has 80 stickers. He gave half of his stickers to his friend Tom and then received 20 stickers as gifts. If he gave away 25% of his total stickers to his sister, how many stickers does he have left?
def solve() -> int: stickers = 80 stickers_given = 0.5 * stickers stickers_left = stickers - stickers_given stickers_left += 20 stickers_given_to_sister = 0.25 * (stickers_given + stickers_left) stickers_left -= stickers_given_to_sister result = stickers_left return result
A recipe requires 6 tablespoons of butter and 4 tablespoons of sugar. If you want to make half of the recipe, how many tablespoons of each ingredient do you need?
def solve() -> int: butter = 6 sugar = 4 ratio = 1/2 butter_needed = butter*ratio sugar_needed = sugar*ratio result = "To make half of the recipe, you need " + str(butter_needed) + " tablespoons of butter and " + str(sugar_needed) + " tablespoons of sugar." return result
A classroom has 30 students and 14 of them are girls. If 3 more boys join the class, what percentage of the class are boys?
def solve() -> int: boys = 30 - 14 + 3 percentage = (boys/30) * 100 result = percentage return result
Tom filled five water bottles of equal capacity with a total volume of 30 liters. He then drank from 3 water bottles. How much water was left?
def solve() -> int: total_volume = 30 num_bottles = 5 drank_bottles = 3 volume_per_bottle = total_volume / num_bottles drank_volume = volume_per_bottle * drank_bottles remaining_volume = total_volume - drank_volume result = remaining_volume return result
If three more cakes are baked to the eight cakes already made, the number of cakes will be 2/5 the number of cakes in the bakery. How many cakes are in the bakery?
def solve() -> int: cakes_baked = 8 more_cakes = 3 total_cakes = cakes_baked + more_cakes bakery_cakes = total_cakes * 5 / 2 result = bakery_cakes return result
A vending machine has three types of snacks: candy bars, chips, and popcorn. Candy bars cost $2 each, chips cost $1 each, and popcorn costs $3 per bag. If Jane bought 4 candy bars, 5 bags of popcorn, and 6 chips, how much did Jane spend in total?
def solve() -> int: total = 0 total = total + 4 * 2 total = total + 5 * 3 total = total + 6 * 1 result = total return result
Mary is buying flowers and a gift for her friend's birthday. The flowers are $15 and the gift is $40. How much will she spend with a 20% tip for the florist and a 12% gratuity for the gift shop salesperson?
def solve() -> int: flowers_price = 15 gift_price = 40 tip_percentage = 20 gratuity_percentage = 12 tip_amount = (flowers_price * tip_percentage) / 100 gratuity_amount = (gift_price * gratuity_percentage) / 100 total_amount = flowers_price + gift_price + tip_amount + gratuity_...
Possible new questions: Tom had 12 chocolates in a box. He ate 3 of them and gave 2 to his friend. Then he bought another box of chocolates that had 8 pieces. He ate 4 of them and gave 1 to his friend. How many chocolates does Tom have left in total?
def solve() -> int: chocolates = 12 chocolates = chocolates - 3 - 2 chocolates = chocolates + 8 chocolates = chocolates - 4 - 1 result = chocolates return result
Possible math questions and programs: Aisha has 24 marbles that she wants to divide equally among 8 friends. If she gives 2 marbles to her brother first, how many marbles will each friend get?
def solve() -> int: marbles_left = 24 - 2 marbles_per_friend = marbles_left // 8 result = marbles_per_friend return result
A train covers a distance of 145 km in 1.5 hours. What is its speed in KM/H?
def solve() -> int: distance = 145 time = 1.5 speed = distance / time result = speed return result
Roger has to travel a distance of 200km. If he travels at 60km/h for the first 100km and at 80km/h for the rest of the journey, what is his average speed for the trip?
def solve() -> int: distance_1 = 100 distance_2 = 100 speed_1 = 60 speed_2 = 80 time_1 = distance_1 / speed_1 time_2 = distance_2 / speed_2 total_time = time_1 + time_2 average_speed = distance_1 + distance_2 / total_time result = average_speed return...
There are 36 students in a classroom. Of this number, 18 are boys and the other half are girls. How many more girls need to join the class so that there is an equal number of boys and girls in the class?
def solve() -> int: nb_students = 36 nb_boys = 18 nb_girls = nb_students - nb_boys nb_additional_girls_needed = nb_boys - nb_girls result = nb_additional_girls_needed return result
A train travels 500 km in 5 hours. What is its average speed in m/s?
def solve() -> int: distance_km = 500 time_hours = 5 distance_m = distance_km * 1000 time_seconds = time_hours * 3600 speed_m_per_second = distance_m / time_seconds result = speed_m_per_second return result
Lucy has 16 stickers, and she wants to divide them equally among her 4 friends. However, she realizes that she has 2 extra stickers that she cannot divide. She decides to give one extra sticker to the friend who has the least number of stickers, and the other extra sticker to the friend who has the most number of stick...
def solve() -> int: stickers_per_friend = 16 // 4 stickers_least = stickers_per_friend + 1 stickers_most = stickers_per_friend + 1 stickers_other = stickers_per_friend result = [stickers_least, stickers_most, stickers_other, stickers_other] return result
Jake is collecting stickers for his album. He has 300 stickers and each page of the album can hold 24 stickers. How many pages does he need to fill his album and how many stickers will he have left?
def solve() -> int: pages = (300 + 23) // 24 leftover_stickers = 300 - pages * 24 result = (pages, leftover_stickers) return result
Each small box has 6 small packets of chocolates. There are 30 small boxes. Each small packet contains 10 chocolates. How many chocolates are there in all of the 30 small boxes combined?
def solve() -> int: small_boxes = 30 packets_in_small = 6 chocolates_in_packet = 10 total_packets = small_boxes * packets_in_small total_chocolates = total_packets * chocolates_in_packet result = total_chocolates return result
Jack is moving from San Francisco, which has 884,363 people, to San Diego, which has 418,343 fewer people. What is the total population of San Francisco and San Diego?
def solve() -> int: sf_population = 884363 sd_population = sf_population - 418343 total_population = sf_population + sd_population result = total_population return result
Emily works out for 70% the number of hours that Jake works out in a week. Their friend, Josh, works out for twice the combined total number of hours both Emily and Jake take during their workouts. If Jake works out for 22 hours in a week, how many hours does Josh work out for?
def solve() -> int: jake_hours = 22 emily_hours = jake_hours * 0.7 total_hours = jake_hours + emily_hours josh_hours = total_hours * 2 result = josh_hours return result
In a theater, there are rows of seats and balcony seats. If there are 150 seats in total and 2/5 of them are balcony seats, how many rows of seats are there?
def solve() -> int: total_seats = 150 balcony_seats = (2/5) * total_seats rows_of_seats = total_seats - balcony_seats result = rows_of_seats return result
A school has 240 students and 12 teachers. The school wants to divide the students into equal groups and assign one teacher to each group. How many students will be in each group?
def solve() -> int: group_size = 240 / 12 result = group_size return result
At a restaurant, there are four times as many forks as spoons. If there are 80 utensils total, how many spoons are there?
def solve() -> int: result = 16 return result
A rectangular box has a width of 4 meters, a length of 6 meters, and a height of 3 meters. What is the volume of the box?
def solve() -> int: length = 6 width = 4 height = 3 volume = length * width * height result = volume return result
Kate has $400 saved up. She uses 20% of it to buy groceries and spends the other 80% of it on a week-long vacation. If the vacation costs $360, how much did Kate spend on groceries?
def solve() -> int: grocery_cost = 400 * 0.2 vacation_cost = 400 - grocery_cost difference = 360 - vacation_cost result = grocery_cost - difference return result
Daniel is collecting stickers for his album. He needs 120 stickers to complete the album. He has 50 stickers already and he buys 10 stickers every day. How many days will it take him to complete the album?
def solve() -> int: needed = 120 current = 50 daily = 10 days = 0 while current < needed: current = current + daily days = days + 1 result = days return result
A restaurant has 60 seats, where the number of tables and booths is equal. How many seats are at the bar if there are 20 booths?
def solve() -> int: total_seats = 60 number_of_booths = 20 number_of_tables = number_of_booths number_of_seats_at_bar = total_seats - (number_of_booths + number_of_tables) result = number_of_seats_at_bar return result
Ivy is 5 times as fast as her snail while Jake is 4 times as fast as Ivy. If Ivy can run 10m in 20s, what is the time difference between Jake and Ivy's snail to run 40m?
def solve() -> int: i = 10 / 20 s = i / 5 j = 4 * i diff = (40 / s) - (40 / j) result = diff return result
A train travels 360 miles in 6 hours. How many miles would it travel in 8 hours?
def solve() -> int: distance_1 = 360 time_1 = 6 time_2 = 8 distance_2 = distance_1 * time_2 / time_1 result = distance_2 return result
Joan had 2 pounds of walnuts. Peter had 6 ounces less than 1.5 pounds of walnuts. How many more ounces of walnuts did Joan have than Peter?
def solve() -> int: walnuts_weight_joan = 2 walnuts_weight_peter = 1.5 - 0.375 ounces_joan = walnuts_weight_joan * 16 ounces_peter = walnuts_weight_peter * 16 difference_ounces = ounces_joan - ounces_peter result = difference_ounces return result
A car travels at a constant speed of 60 km/h for the first 2 hours of a trip, then slows down to 40 km/h for the next hour, then speeds up to 80 km/h for the last hour. What is the average speed of the car for the entire trip?
def solve() -> int: result = 240 / 4 return result
Sarah wants to make a batch of brownies. She needs 2 cups of flour, 1 cup of sugar, 3/4 cup of oil, and 3 eggs. She also needs to preheat the oven to 350 degrees Fahrenheit for 10 minutes. If each ingredient costs $2 and Sarah's labor is valued at $15 per hour, how much will it cost for her to make brownies?
def solve() -> int: cups_of_flour = 2 cups_of_sugar = 1 cups_of_oil = 0.75 eggs = 3 cost_of_ingredients_per_unit = 2 preheat_oven_temp = 350 preheat_oven_time = 10 labor_cost_per_hour = 15 total_cost_of_ingredients = (cups_of_flour + cups_of_sugar + cups_of_oil + eggs) * cost_of_ingr...
Student: Sam had 30 pencils in his box. He used 2 pencils every day for school. He also bought 3 new pencils every week. How many pencils did he have left after 4 weeks?
def solve() -> int: pencils_in_box = 30 pencils_used_per_day = 2 pencils_bought_per_week = 3 total_pencils_used = pencils_used_per_day * 7 * 4 total_pencils_bought = pencils_bought_per_week * 4 result = pencils_in_box + total_pencils_bought - total_pencils_used return result
24 people went to a restaurant and shared the bill equally. If they paid a total of $480, what was the cost per person?
def solve() -> int: people = 24 total_bill = 480 cost_per_person = total_bill / people result = cost_per_person return result
Student: Lisa has a rectangular garden which is 12 feet by 18 feet. She wants to put a stone border around the garden that is two stones wide. If each stone is 1 foot by 2 feet, how many stones does Lisa need?
def solve() -> int: garden_length = 12 garden_width = 18 stone_length = 1 stone_width = 2 garden_area = garden_length * garden_width stone_area = stone_length * stone_width border_width = 2 * stone_width outer_length = garden_length + 2 * border_width outer_width = garden_wid...
A car travels 180 km in 2 hours 20 minutes. Find the average speed of the car in km/hour.
def solve() -> int: time_in_hours = 2 + 20/60 distance = 180 speed = distance/time_in_hours result = speed return result
In a sports team there are 18 players with the same height. Every year, the average height of new players decreases by 4 cm. What is the average height of the new players?
def solve() -> int: players = 18 decrease = 4 average_new = (18*decrease)/players result = average_new return result
If a recipe calls for 2 cups of flour for 12 cupcakes, how many cups of flour do we need for 36 cupcakes?
def solve() -> int: cups_of_flour_for_12 = 2 cupcakes_needed = 36 cups_of_flour_needed = (cups_of_flour_for_12 / 12) * cupcakes_needed result = cups_of_flour_needed return result
Jack has 400 liters of water for his garden, how many gallons of water does he have?
def solve() -> int: liters_per_gallon = 3.785 liters = 400 gallons = liters / liters_per_gallon result = gallons return result
Blake originally squatted 150 kg. After months of training, he doubled his strength. He then decided to focus on core exercises and further increased his strength by 30%. How much weight can he squat now?
def solve() -> int: original_weight = 150 doubled_weight = original_weight * 2 increased_weight = doubled_weight * 1.3 result = increased_weight return result
Ethan invested in four different stocks. The stocks have the following prices: $50, $100, $75, and $25 per share. How much did Ethan spend in total on the stocks?
def solve() -> int: stock1_price = 50 stock2_price = 100 stock3_price = 75 stock4_price = 25 total_spent = stock1_price + stock2_price + stock3_price + stock4_price result = total_spent return result
A football field is 160 feet wide and 360 feet long. What is the perimeter of the football field?
def solve() -> int: width = 160 length = 360 perimeter = 2*width + 2*length result = perimeter return result
A small company produces 8 types of coffee beans. The company wants to test the quality of each type, but uses only 4 testers to do so. Each tester can try at most one type of coffee. How many ways can the tests be conducted?
def solve() -> int: types_of_coffee = 8 number_of_testers = 4 test_combinations = types_of_coffee**number_of_testers result = test_combinations return result
A bookstore is selling novels for $12.99 each. It costs $5.25 to print each novel, and the money from the novels will be used to buy pens, which cost $0.79 each. How many novels must be sold to buy 50 pens?
def solve() -> int: novel_price = 12.99 printing_cost = 5.25 pen_price = 0.79 pens_needed = 50 total_pen_cost = pens_needed * pen_price profit_per_novel = novel_price - printing_cost novels_needed = total_pen_cost / profit_per_novel result = round(novels_needed) ...
Possible math questions and programs: Abby collects 3 stamps every Monday, 2 stamps every Tuesday, and 1 stamp every Wednesday. She stops collecting stamps when she has 50 stamps in total. How many weeks did it take her to reach her goal?
def solve() -> int: stamps = 0 weeks = 0 days = 0 while stamps < 50: days += 1 if days > 7: days = 1 weeks += 1 if days == 1: stamps += 3 elif days == 2: stamps += 2 elif days == 3: stamps += 1 result = weeks return...
Lily has 36 stickers. She gives 4 stickers to each of her 6 friends, and keeps the rest for herself. How many stickers does she have left?
def solve() -> int: stickers_given = 6 * 4 stickers_left = 36 - stickers_given result = stickers_left return result
The price of a pencil is $1.25, and the price of a pen is $2.50. Ned bought 4 pencils and 2 pens. How much did he spend?
def solve() -> int: pencil_cost = 1.25 pen_cost = 2.50 n_pencils = 4 n_pens = 2 total_cost = (n_pencils * pencil_cost) + (n_pens * pen_cost) result = total_cost return result
If a restaurant offers a 15% discount on the total bill, and the bill comes out to be $45.50, what is the final amount after the discount is applied?
def solve() -> int: bill = 45.50 discount_rate = 0.15 discount_amount = bill * discount_rate final_amount = bill - discount_amount result = final_amount return result
Mark is trying to finish a research paper before a deadline. He has already written 2,500 words but realizes he is only a quarter of the way there. If he needs to write 10,000 words, how many more words does he need to write?
def solve() -> int: words_written = 2500 percent_remaining = 0.75 total_words = 10000 words_remaining = (total_words * percent_remaining) - words_written result = words_remaining return result
In a pizza-making competition, 90% of the 50 pepperoni pizzas made it to the final round, half the 30 veggie pizzas made it to the final round, 1/4th of the 60 cheese pizzas made it to the final round, and 1/5th of the 40 Hawaiian pizzas made it to the final round. How many pizzas made it to the final round?
def solve() -> int: pepperoni_pizzas = 50 veggie_pizzas = 30 cheese_pizzas = 60 hawaiian_pizzas = 40 pepperoni_final = 0.9 * pepperoni_pizzas veggie_final = 0.5 * veggie_pizzas cheese_final = 0.25 * cheese_pizzas hawaiian_final = 0.2 * hawaiian_pizzas total_final = pepperon...
When Maya turned 6, her hamster was born. Her baby brother, who is exactly half of her age, loves the hamster. How old is the hamster now, on the day of Maya's 12th birthday?
def solve() -> int: maya_age = 12 baby_brother_age = maya_age / 2 hamster_age = maya_age - 6 + baby_brother_age result = hamster_age return result
Some possible new questions are: A box of chocolates contains 20 pieces, each with a different filling. The price of the box is $18, but there is a 10% discount if you buy two or more boxes. How much do you save, per piece, in cents, by buying two boxes instead of one?
def solve() -> int: original_price = 18 / 20 discounted_price = 18 * 0.9 / 20 savings = (original_price - discounted_price) * 100 result = savings return result
Noah has 18 stickers and wants to share them equally with his 3 friends. How many stickers will each person get?
def solve() -> int: stickers_per_person = 18 / 4 result = stickers_per_person return result
Sam has 6 times as many marbles as Jane. Sam then loses 18 marbles in a game. If Jane has 3 marbles, how many does Sam have left?
def solve() -> int: sam = 6 * 3 jane = 3 sam = sam - 18 result = sam return result