question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A square's area is 36 square units. What is the diagonal of the square?
def solve() -> int: area = 36 side_length = area ** 0.5 diagonal = side_length * 2 ** 0.5 result = diagonal return result
Student: A cyclist made a journey of 200 km at an average speed of 40 km/h. If he returns home at an average speed of 30 km/h, what is his average speed for the entire journey?
def solve() -> int: distance = 200 speed_out = 40 speed_back = 30 time_out = distance / speed_out time_back = distance / speed_back total_time = time_out + time_back total_distance = distance * 2 result = total_distance / total_time return result
A jar has 7/18 of green jelly beans and the rest are yellow. How many yellow jelly beans are in the jar?
def solve() -> int: total_jelly_beans = 1 green_fraction = 7 / 18 yellow_fraction = total_jelly_beans - green_fraction yellow_jelly_beans = yellow_fraction * 18 result = round(yellow_jelly_beans) return result
Elizabeth spends time every day studying new recipes. The first day of the week she studies for 10 minutes. Each of the following days she studies three times as much as the day before. After the 7th day, Elizabeth feels confident in her cooking skills and stops studying. How much time did Elizabeth study new recipes t...
def solve() -> int: day1 = 10 day2 = day1 * 3 day3 = day2 * 3 day4 = day3 * 3 day5 = day4 * 3 day6 = day5 * 3 day7 = day6 * 3 total_time = day1 + day2 + day3 + day4 + day5 + day6 + day7 result = total_time return result
A group of 24 students was divided into 3 teams. Each team has the same number of students. How many students are in each team?
def solve() -> int: total_students = 24 num_teams = 3 students_per_team = total_students // num_teams result = students_per_team return result
Anna has 25 plants that require 2 liters of water per day, and the cost of water is ten cents per liter. How much does Anna spend on water in the month of February?
def solve() -> int: plants = 25 water_per_plant = 2 days_in_february = 28 cost_per_liter = 0.1 total_water = plants * water_per_plant * days_in_february total_cost = total_water * cost_per_liter result = total_cost return result
A rectangle has length 6 cm and width 4 cm. A square is cut from the rectangle such that the remaining area of the rectangle is half the area of the original rectangle. What is the side length of the square?
def solve() -> int: length = 6 width = 4 original_area = length * width remaining_area = original_area / 2 square_side = (remaining_area)**0.5 result = square_side return result
Student: A bookshelf has 100 books. If 2/5 of the books are non-fiction and 3/7 of the remaining books are fiction, how many books are non-fiction and how many are fiction?
def solve() -> int: total_books = 100 non_fiction_fraction = 2/5 fiction_fraction = 3/7 non_fiction_books = total_books * non_fiction_fraction remaining_books = total_books - non_fiction_books fiction_books = remaining_books * fiction_fraction other_books = total_books - fiction_books - n...
An engineering firm charges $75 per hour for their services. If they work for a total of 40 hours on a project, how much will they charge the client for their services?
def solve() -> int: rate_per_hour = 75 hours_worked = 40 total_cost = rate_per_hour * hours_worked result = total_cost return result
A pizza maker can make 7 pizzas in 30 minutes. From Monday to Thursday, the pizza maker works for 4 hours each day, and on Friday, he works for 6 hours. How many pizzas can the pizza maker make in a week?
def solve() -> int: pizzas_per_hour = 7 / 0.5 pizzas_per_day = pizzas_per_hour * 4 pizzas_on_friday = pizzas_per_hour * 6 pizzas_in_a_week = pizzas_per_day * 4 + pizzas_on_friday result = pizzas_in_a_week return result
Alex drove 320 miles in 5 hours. If he drives at the same speed, how many hours will it take him to drive 480 miles?
def solve() -> int: distance1 = 320 time1 = 5 speed1 = distance1/time1 distance2 = 480 time2 = distance2/speed1 result = time2 return result
Mark is a farmer. He has 150 animals on his farm that are either chickens or cows. If there are twice as many cows as chickens, how many cows does he have?
def solve() -> int: chickens = 0 cows = 0 chickens = 150 / 3 cows = 2 * chickens result = cows return result
In a class of 50 students, 60% of them are female. How many male students are there?
def solve() -> int: total_students = 50 female_students = total_students * 0.6 male_students = total_students - female_students result = male_students return result
Raj is x years older than Sid. After 4 years, their combined age will be 52 years. After 10 years, their combined age will be 68 years. Determine their current ages.
def solve() -> int: combined_age_difference = 16 age_difference = 6 combined_age_sum = 120 sid_current_age = (combined_age_sum - combined_age_difference) / 2 raj_current_age = sid_current_age + age_difference result = (sid_current_age, raj_current_age) return result
A family drove for 4 hours at a speed of 65 miles per hour. If they took a 30 minute break for gas, how far did they travel?
def solve() -> int: time_driving = 4 speed = 65 distance = time_driving * speed break_time = 0.5 result = distance return result
At a movie theater, adult tickets cost $8 each and children tickets cost $5 each. If a family of 4 people went to the movies and paid a total of $32, how many adults and how many children were in the family?
def solve() -> int: costPerAdult = 8 costPerChild = 5 totalFamCost = 32 totalNumTickets = totalFamCost / (costPerAdult + costPerChild) numAdults = totalNumTickets * (costPerAdult / (costPerAdult + costPerChild)) numChildren = totalNumTickets * (costPerChild / (costPerAdult + costPerChild)) ...
Student: Lily has a square garden with a perimeter of 32 feet. What is the area of her garden?
def solve() -> int: perimeter = 32 side_length = perimeter / 4 area = side_length ** 2 result = area return result
A car travels 120 km in 2 hours. What is the average speed of the car in km/h?
def solve() -> int: distance_travelled = 120 time_taken = 2 average_speed = distance_travelled / time_taken result = average_speed return result
Adam receives a loan of $15,000 at a yearly interest rate of 8.5%. If he needs to repay the loan in 3 years with equal payments every year, what will be his annual payment?
def solve() -> int: loan_amount = 15000 interest_rate = 0.085 num_years = 3 annual_interest_rate = interest_rate / num_years annual_payment = loan_amount * (annual_interest_rate / (1 - (1 + annual_interest_rate) ** (-num_years))) result = annual_payment return result
Marcus can solve 40 math problems in 60 minutes. At this rate, how long will he take to solve 120 math problems?
def solve() -> int: solved_problems = 40 total_duration = 60 total_problems = 120 time_per_problem = total_duration / solved_problems total_time = time_per_problem * total_problems result = total_time return result
Student: The hypotenuse of a triangle is 26 cm and one of the legs is 10 cm. How long is the other leg?
def solve() -> int: hypotenuse = 26 leg1 = 10 leg2 = ((hypotenuse ** 2) - (leg1 ** 2)) ** 0.5 result = leg2 return result
A toy store has 4000 units of a certain toy in stock. It wants to increase the price of the toy by 20%. However, it knows that if it increases the price by more than 15%, it will lose some customers. If the store expects to lose 5% of its customers if it increases the price by 20%, how many units of the toy it needs to...
def solve() -> int: num_units = 4000 price_before = 10 price_increase = 0.2 price_after = price_before * (1 + price_increase) discount_rate = 0.15 num_customers_before = 10000 num_customers_after = num_customers_before * (1 - 0.05) sales_volume_after = num_customers_after * discount_rate...
Student: 7. Samuel wanted to lay a pathway in his garden. He needed to buy 80 stone tiles, each tile costing $3, and 8 bags of cement for $2 each. How much did Samuel spend on his project?
def solve() -> int: stone_tiles = 80 tile_cost = 3 bags_cement = 8 bag_cost = 2 total_tile_cost = stone_tiles * tile_cost total_cement_cost = bags_cement * bag_cost total_cost = total_tile_cost + total_cement_cost result = total_cost return result
Maria has three rabbits. Each rabbit needs 1/4 cup of pellets, three times a day. How many cups of pellets does Maria need to feed her rabbits for 2 days?
def solve() -> int: rabbits = 3 pellets_per_rabbit_per_day = 1/4 times_per_day = 3 days = 2 pellets_needed = rabbits * pellets_per_rabbit_per_day * times_per_day * days result = pellets_needed return result
Benjamin deposited $1000 in his savings account at the beginning of the year. If the interest rate is 6% per year, how much money will he have at the end of 2 years?
def solve() -> int: deposit = 1000 interest_rate = 6 / 100 year = 2 final_amount = deposit * (1 + interest_rate)**year result = final_amount return result
Andy saved $20 every month and have saved $70 already. How much money will he have after 16 months?
def solve() -> int: amount_saved_monthly = 20 amount_already_saved = 70 num_of_months = 16 total_money_saved = num_of_months * amount_saved_monthly final_amount_saved = amount_already_saved + total_money_saved result = final_amount_saved return result
If a number is increased by 35%, it becomes 286. What is the number?
def solve() -> int: num = 286 / 1.35 result = round(num) return result
Student: Mary went shopping for her cousin's birthday. She bought four books for $15 each book, and two teddy bears at $20 each. How much did she spend in total?
def solve() -> int: books = 4 book_price = 15 bears = 2 bear_price = 20 book_cost = books * book_price bear_cost = bears * bear_price total_cost = book_cost + bear_cost result = total_cost return result
Mr. Ellis owns a store which sells apples. He buys a crate containing 10 kg of apples at a price of $7.3 per kg. He sells single apples at $0.47 per kg. Calculate the total profit from selling the apples in the crate.
def solve() -> int: weight_crate = 10 cost_each_kg = 7.3 selling_price_each_kg = 0.47 total_profit = (weight_crate * selling_price_each_kg) - (weight_crate * cost_each_kg) result = 26.0 return result
A construction worker wants to build a rectangular fence around a property that measures 20 feet by 30 feet. He wants to leave a 4-foot opening for a gate on one of the sides. How much fencing does the worker need to buy?
def solve() -> int: width = 20 length = 30 gate_width = 4 new_width = width + gate_width fencing_needed = (2 * length) + (2 * new_width) result = fencing_needed return result
Rebecca wants to buy markers for her art project. The store sells them in packs of 35 with an equal number of black, blue, and red markers. How many packs does she need to buy if she wants 70 red markers?
def solve() -> int: markers_per_pack = 35 red_markers_per_pack = 70/3 packs_needed = red_markers_per_pack/markers_per_pack result = round(packs_needed) return result
Clara needs to walk her dog every day. She walks at 2.5 mph for 30 minutes, then she runs at 5 mph for 15 minutes, then she walks back home at 2.5 mph. How long is her walking route in miles?
def solve() -> int: hours_walking = (30 + 15) / 60 hours_running = hours_walking - 0.5 distance_walked = 2.5 * 0.5 distance_run = 5 * hours_running total_distance = (distance_walked + distance_run) * 2 result = total_distance return result
Max wants to make pancakes and needs 1 and 1/2 cups of flour. He only has a 1/3 cup measuring cup. He has a 6 cup bag of flour and wants to remove the extra. How many scoops should he remove?
def solve() -> int: flour_needed = 1.5 measuring_cup = 1/3 bag_of_flour = 6 scoops_needed = flour_needed / measuring_cup scoops_to_remove = bag_of_flour - scoops_needed result = scoops_to_remove return result
There are 16 students in grade 5 and 18 students in grade 6. If half of the grade 5 students are under 10 years old and half of the grade 6 students are over 10 years old, how many students under 10 years old are in grades 5 and 6?
def solve() -> int: students_5 = 16 students_6 = 18 half_5 = students_5 / 2 half_6 = students_6 / 2 result = half_5 + half_6 return result
arah is a painter. She uses 4 tubes of red paint a week, 3 tubes of blue paint a week, and 2 tubes of yellow paint a week. One tube of red paint costs $3. One tube of blue paint costs $4, and one tube of yellow paint costs $2. What is the total cost of Sarah's paint in one week?
def solve() -> int: red_cost = 3 blue_cost = 4 yellow_cost = 2 red_num = 4 blue_num = 3 yellow_num = 2 red_total = red_cost * red_num blue_total = blue_cost * blue_num yellow_total = yellow_cost * yellow_num total = red_total + blue_total + yellow_total result ...
A water tank can hold 27 gallons of water. If it is currently filled with 16 gallons, how many more gallons of water can be added?
def solve() -> int: tank_capacity = 27 current_gallons = 16 gallons_left = tank_capacity - current_gallons result = gallons_left return result
Ben has a jar of marbles. He has 40 red marbles, 30 blue marbles, and 20 green marbles. He takes out 10 red marbles, 5 blue marbles, and 15 green marbles. He puts back 5 red marbles, 10 blue marbles, and 5 green marbles. How many marbles does he have in the jar now?
def solve() -> int: red = 40 blue = 30 green = 20 red = red - 10 blue = blue - 5 green = green - 15 red = red + 5 blue = blue + 10 green = green + 5 result = red + blue + green return result
Ivy is driving on a highway and passes mile marker 50. She continues driving and passes mile marker 120. How many miles has she driven?
def solve() -> int: start_mile = 50 end_mile = 120 distance_driven = end_mile - start_mile result = distance_driven return result
Peter is filling up his gas tank which has a capacity of 12 gallons. If the price of gas per gallon is $3.50 and he fills up his tank halfway, how much money will he spend on gas?
def solve() -> int: tank_capacity = 12 price_per_gallon = 3.50 filled_gas = tank_capacity / 2 total_cost = filled_gas * price_per_gallon result = total_cost return result
Eric spent one-fifth of his money and gave three-fourths of the remaining money to his sister. The total amount of money he had left was $70. How much money did Eric have at the beginning?
def solve() -> int: money_left = 70 portion_spent = 1/5 portion_given = 3/4 remaining = money_left / portion_given money_at_beginning = remaining / (1 - portion_spent) result = money_at_beginning return result
Repeat this format for each question Some possible new questions are: Emma is selling cupcakes at a bake sale. She made 120 cupcakes, and sold them for $2 each. She also bought some lemonade for $1.50 per bottle, and sold them for $3 each. She sold 80 bottles of lemonade. How much profit did Emma make in total?
def solve() -> int: cupcakes = 120 cupcake_cost = 2 lemonade = 80 lemonade_cost = 1.5 lemonade_price = 3 cupcake_revenue = cupcakes * cupcake_cost lemonade_revenue = lemonade * lemonade_price total_revenue = cupcake_revenue + lemonade_revenue lemonade_expense = lemonade * lemonade_co...
Mrs. Lee bought 3 kilograms of apples and 2 kilograms of oranges at the farmers market. She paid $4.50 per kilogram for the apples and $3 per kilogram for the oranges. She also gave a $2 tip to the seller. How much did Mrs. Lee spend in total?
def solve() -> int: apples = 3 oranges = 2 apple_price = 4.50 orange_price = 3 tip = 2 apple_cost = apples * apple_price orange_cost = oranges * orange_price total_cost = apple_cost + orange_cost + tip result = total_cost return result
Ethan wants to run the same distance as his friend who ran 10 laps around a track, where each lap is 400 meters. However, Ethan's track is different, and each lap is only 350 meters. How many more laps will Ethan need to run to cover the same distance as his friend?
def solve() -> int: friend_laps = 10 friend_lap_distance = 400 ethan_lap_distance = 350 friend_distance = friend_laps * friend_lap_distance ethan_laps_needed = friend_distance / ethan_lap_distance - friend_laps result = ethan_laps_needed return result
A recipe for a cake requires 250 g of flour. Sam has 1 kg of flour and wants to make as many cakes as possible. How many cakes can he make and how much flour will he have left?
def solve() -> int: flour = 1000 cake = 250 cakes = flour // cake leftover = flour % cake result = (cakes, leftover) return result
Emily has twice as many stickers as Kristine. Mark has 8 more stickers than Kristine. If Kristine has 7 stickers, how many stickers does Mark have?
def solve() -> int: kristine_stickers = 7 emily_stickers = kristine_stickers * 2 mark_stickers = kristine_stickers + 8 result = mark_stickers return result
Student: Thomas wants to make a rectangular garden bed that is 12 feet by 4 feet. He wants to put a border of bricks around the garden bed, which will increase the length and the width by 1 foot. How many bricks does he need if each brick is 6 inches by 3 inches?
def solve() -> int: length = 12 + 2*12/12 width = 4 + 2*12/12 area = length * width brick_length = 6/12 brick_width = 3/12 brick_area = brick_length * brick_width total_bricks = area / brick_area result = total_bricks return result
If the sum of Kelly's age and Marie's age is 44, and Marie is four times as old Kelly, how old is Kelly?
def solve() -> int: kelly = 44//5 marie = 4*kelly result = kelly return result
Student: Jennifer wants to buy a new backpack. She makes money selling iced tea for $3 a cup and brownies for $2 each. She sold 20 cups of iced tea and 25 brownies. How much money did she make?
def solve() -> int: price_iced_tea = 3 price_brownie = 2 quantity_iced_tea = 20 quantity_brownie = 25 revenue_iced_tea = price_iced_tea * quantity_iced_tea revenue_brownie = price_brownie * quantity_brownie total_revenue = revenue_iced_tea + revenue_brownie result = total_revenue re...
Student: A store sells shirts for $20 each. If there is a sale of 25% off, how much does a shirt cost during the sale?
def solve() -> int: price = 20 discount = 0.25 discounted_price = price - (price * discount) result = discounted_price return result
John has a rectangle-shaped garden that measures 6 meters by 8 meters. He wants to put a border around the garden by adding a strip of land of uniform width along the perimeter of the garden. If the total area of the strip is 96 square meters, what is the width of the strip in meters?
def solve() -> int: garden_length = 6 garden_width = 8 border_area = 96 total_perimeter = 2 * garden_length + 2 * garden_width border_width = (border_area / total_perimeter) result = border_width return result
If Amy saves $100 per week for 4 weeks and $150 for the next 2 weeks, how much will she save in 6 weeks?
def solve() -> int: saving_per_week_1 = 100 saving_per_week_2 = 150 total_weeks = 6 total_savings = (saving_per_week_1 * 4) + (saving_per_week_2 * 2) savings_in_6_weeks = total_savings * (total_weeks / 6) result = savings_in_6_weeks return result
sana bought a 3-months gym membership for $120. How much did Susana pay in total for each month?
def solve() -> int: membership_price = 120 no_of_months = 3 total_price = membership_price / no_of_months result = total_price return result
When Sarah was one-seventh her mother's age, her mother passed away. If her mother were still alive now, fifteen years later, she would be 70. How old is Sarah currently?
def solve() -> int: sarah_age = 1/7 * (70 - 15) result = sarah_age return result
Alex went to a shoe store with $150 and bought 2 pairs of shoes. His mother then asked him to buy three more pairs of shoes. Each pair of shoes cost $30. Finally, he also bought a pair of socks for $5. How much money does Alex have remaining?
def solve() -> int: money = 150 shoes_cost = 30 socks_cost = 5 shoes_total_cost = shoes_cost * 2 additional_shoes_cost = shoes_cost * 3 total_shoes_cost = shoes_total_cost + additional_shoes_cost total_cost = total_shoes_cost + socks_cost remaining_money = money ...
Emma drove 180 miles in 3 hours, then took a 30-minute break, then drove another 120 miles in 2 hours. What was her average speed for the whole trip?
def solve() -> int: distance1 = 180 time1 = 3 distance2 = 120 time2 = 2 break_time = 0.5 total_distance = distance1 + distance2 total_time = time1 + time2 + break_time avg_speed = total_distance/total_time result = avg_speed return result
A triangle has a base of 10 cm and a height of 6 cm. What is the area of the triangle?
def solve() -> int: base = 10 height = 6 area = 0.5 * base * height result = area return result
Byron and Shelly are playing a board game. If it takes Byron 4 hours to complete the game but Shelly can complete it twice as fast, how long does it take the two of them to play the game together?
def solve() -> int: byron_time = 4 shelly_time = byron_time / 2 total_time = byron_time + shelly_time result = total_time return result
had $15. She gave each of her friends $2. How much money did Sue have left?
def solve() -> int: num_dollars = 15 num_friends = 8 num_dollars_given = num_friends * 2 num_dollars_left = num_dollars - num_dollars_given result = num_dollars_left return result
Lisa and her seven classmates baked 4 pies for a school fundraiser. Each pie had 6 pieces. They sold all the pies and donated the money to a charity. How much money did they donate if each piece of pie cost $1.50?
def solve() -> int: total_pieces = 4 * 6 total_money = total_pieces * 1.50 result = total_money return result
Emily has to buy 100 pencils for her classroom. Each pack of pencils contains 10 pencils. How many packs of pencils does Emily need to buy?
def solve() -> int: pencils_per_pack = 10 total_pencils = 100 packs_needed = total_pencils // pencils_per_pack result = packs_needed return result
If a pizza has a diameter of 12 inches, what is the circumference of the pizza in inches?
def solve() -> int: pi = 3.14 radius = 12/2 circumference = 2 * pi * radius result = f'The circumference of the pizza is {circumference} inches' result = circumference return result
Rachel has $200 and needs to pay off a credit card balance of $100. If she pays off the balance with a 5% interest rate, how much money does she have left?
def solve() -> int: balance = 100 interest_rate = 0.05 interest = balance * interest_rate total_payment = balance + interest money_left = 200 - total_payment result = money_left return result
Amy and Sarah want to make a container of bubbles. To the bubble mix, they need to add one cup of water for every two cups of bubble solution. If they have eight cups of bubble solution, how many cups of water do they need to add?
def solve() -> int: solution_cup = 8 water_cup = 0.5 * solution_cup result = water_cup return result
In a class, the ratio of boys to girls is 3:5. If there are 24 boys, how many girls are there?
def solve() -> int: boys = 3 girls = 5 boys_num = 24 girls_num = girls/boys * boys_num result = girls_num return result
A student spends 1/4 of their time studying for Math. If they study for a total of 24 hours, how many hours did they spend studying Math?
def solve() -> int: total_study_time = 24 math_percentage = 1/4 math_time = total_study_time * math_percentage result = math_time return result
Student: - There are three printers in an office. Printer A can print 20 pages in 1 minute. Printer B can print 5 fewer pages than Printer A. Printer C can print twice as many pages as Printer B. How many pages can those three printers print in 15 minutes?
def solve() -> int: printer_A = 20 printer_B = printer_A - 5 printer_C = printer_B * 2 time = 15 pages_A = printer_A * time pages_B = printer_B * time pages_C = printer_C * time total_pages = pages_A + pages_B + pages_C result = total_pages return result
Olivia had 24 cupcakes for her bake sale. She sold 18 cupcakes and then gave another 2 cupcakes to the volunteers. If the box can hold up to 30 cupcakes, how many cupcakes does Olivia need to bake to fill the box entirely?
def solve() -> int: cupcakes_available = 24 cupcakes_sold = 18 cupcakes_given_to_volunteers = 2 box_capacity = 30 cupcakes_remaining = cupcakes_available - cupcakes_sold - cupcakes_given_to_volunteers cupcakes_needed = box_capacity - cupcakes_remaining result = cupcakes_needed ...
arah has $80 to spend. She wants to buy some books that cost $15 each and some pens that cost $1 each. If she buys 5 pens, how many books can she buy?
def solve() -> int: total_cost_pens = 5 * 1 total_money = 80 money_left = total_money - total_cost_pens cost_per_book = 15 number_of_books = money_left // cost_per_book result = number_of_books return result
Jack is trying to figure out when his uncle was born. He knows his great-grandfather was born in 1930, his grandfather was born in 1950, and his father was born in 1980. The difference in age between his father and his grandfather is twice the difference in age between his great-grandfather and his grandfather. What is...
def solve() -> int: great_grandfather_birth_year = 1930 grandfather_birth_year = 1950 father_birth_year = 1980 age_difference_father_grandfather = father_birth_year - grandfather_birth_year age_difference_great_grandfather_grandfather = grandfather_birth_year - great_grandfather_birth_year ...
A recipe calls for 3/4 cup of sugar to make 12 cookies. How much sugar would be needed to make 64 cookies?
def solve() -> int: cookies_needed = 64 sugar_needed = (cookies_needed / 12) * (3/4) result = sugar_needed return result
Sarah has a bag of marbles. She has twice as many blue marbles as red marbles and 10 green marbles. If she has a total of 50 marbles, how many red marbles does Sarah have?
def solve() -> int: greens = 10 blues = 2 total_marbles = 50 red_marbles = (total_marbles - greens) / (blues + 1) result = red_marbles return result
If x + y = 10 and x - y = 4, what is the value of x?
def solve() -> int: sum = 10 difference = 4 x = (sum + difference) / 2 result = f"The value of x is {x}." result = x return result
A school has 4 classes with 25 students in each class. Each student needs 0.5 lb. of apples per day. If apples come in bags of 5 lbs. , how many bags of apples should the school buy for a day?
def solve() -> int: students_in_school = 4 * 25 lbs_of_apples = students_in_school * 0.5 bags_of_apples = lbs_of_apples / 5 result = bags_of_apples return result
The perimeter of a square is 24 inches. What is the length of one of its sides?
def solve() -> int: perimeter_of_square = 24 length_of_side = perimeter_of_square / 4 result = length_of_side return result
It takes Max 13 minutes to skateboard to the basketball court. From there, he has to walk to the bus stop and it takes him 9 minutes. By the time he arrives at the bus stop, he will have been gone for 42 minutes altogether. If he had walked to the train station before skating to the basketball court, how long is the wa...
def solve() -> int: max_skateboard_time = 13 walk_to_bus_stop_time = 9 total_time = 42 bus_wait_time = total_time - max_skateboard_time - walk_to_bus_stop_time walk_to_basketball_court_time = max_skateboard_time - bus_wait_time - walk_to_bus_stop_time result = walk_to_basketball_c...
Tom starts to collect water from the rain to use for his garden. It starts raining at 8 am. In the first three hours, 1 inch of rainfall occurs. For the next seven hours, it rains at a rate of 1.5 inches per hour. It then rains at two and a half inches per hour for the rest of the day. If the garden needs 300 inches of...
def solve() -> int: hours_1 = 3 rainfall_1 = 1 hours_2 = 7 rainfall_2 = 1.5 rainfall_needed = 300 total_rainfall = (hours_1 * rainfall_1) + (hours_2 * rainfall_2) remaining_rainfall = rainfall_needed - total_rainfall hours_3 = remaining_rainfall / 2.5 total_h...
Michael is washing his car. He has a bucket that holds 3 gallons of soapy water. It takes him 25 seconds to fill the bucket from the hose and 15 seconds to walk it to his car before pouring the water on the car. If he needs to use 12 gallons of water to wash his car, how many minutes will it take him to use the whole b...
def solve() -> int: bucket_capacity = 3 fill_time = 25 walk_time = 15 total_water_needed = 12 num_fills = total_water_needed / bucket_capacity total_fill_time = num_fills * fill_time total_walk_time = num_fills * walk_time total_time = total_fill_time + total_walk_tim...
Nathan has three times as many marbles as there are days in February. He loses 8 marbles every day for a week. How many marbles does he have left?
def solve() -> int: marbles = 3 * 28 marbles = marbles - 56 result = marbles return result
A gym charges $30 per month for a membership. In January, the gym had 200 members sign up. How much money did the gym make that month?
def solve() -> int: membership_price = 30 members_signed_up = 200 total_sales = membership_price * members_signed_up result = total_sales return result
A school has 1200 students. On school nights, 25% of the students do not do their homework. How many students do their homework on school nights?
def solve() -> int: num_students = 1200 percent_no_hw_on_school_nights = 0.25 num_students_doing_hw = num_students * (1 - percent_no_hw_on_school_nights) result = num_students_doing_hw return result
If Samantha is twice as old as her younger brother and her younger brother is 16, what is the combined age of Samantha and her younger brother?
def solve() -> int: younger_brother_age = 16 samantha_age = younger_brother_age * 2 combined_age = samantha_age + younger_brother_age result = combined_age return result
arah has 2 cats and 3 dogs. Each cat has 4 legs and each dog has 3 legs. How many legs are there in total?
def solve() -> int: cat_legs = 2 * 4 dog_legs = 3 * 3 total_legs = cat_legs + dog_legs result = total_legs return result
Jane's Bakery has 400 cupcakes to serve 50 customers. How many cupcakes would be needed to serve 40% more customers?
def solve() -> int: cupcakes = 400 customers = 50 percent_increase = 40 new_customers = customers + (percent_increase/100)*customers new_cupcakes = (new_customers/customers)*cupcakes result = new_cupcakes return result
Samantha can knit 3 hats an hour, and she wants to knit 30 hats. How many hours will it take Samantha to knit all the hats?
def solve() -> int: hats_per_hour = 3 total_hats = 30 hours = total_hats / hats_per_hour result = hours return result
Peter practices guitar for 2 hours every day. He spends 1/10 of the time practicing chords and the rest of the time playing songs. If he plays songs for twice the time he spends practicing chords, how much time in minutes does he spend practicing chords?
def solve() -> int: hours_practicing_guitar = 2 time_practicing_chords = hours_practicing_guitar * (1/10) time_playing_songs = hours_practicing_guitar - time_practicing_chords time_playing_songs_in_minutes = time_playing_songs * 60 time_practicing_chords_in_minutes = (time_playing_songs_in_minutes /...
A school has 650 students. Each student spends an average of $32 on school supplies per year. If the school earns 5% of its total expenses from fundraising, and its total expenses is twice the students' spending on supplies, how much money did the school earn from fundraising in a year?
def solve() -> int: students = 650 spending_per_student = 32 total_spending = students * spending_per_student expenses = total_spending * 2 fundraising_percentage = 0.05 fundraising = expenses * fundraising_percentage result = fundraising return result
Lily and Ryan are sharing a pizza that has 12 slices. Lily eats 3 slices and Ryan eats 4 slices. Then, they decide to order another pizza that has the same size and number of slices. How many slices of the second pizza can Lily and Ryan each eat if they want to eat the same total amount of pizza?
def solve() -> int: lily_first = 3 ryan_first = 4 lily_left = 12 - lily_first ryan_left = 12 - ryan_first diff_left = abs(lily_left - ryan_left) lily_second = diff_left / 2 ryan_second = diff_left / 2 result = (lily_second, ryan_second) return result
Jack had 37 marbles. He gave away 12 marbles. How many marbles are left?
def solve() -> int: totalMarbles = 37 marblesGiven = 12 marblesLeft = totalMarbles - marblesGiven result = marblesLeft return result
A bakery sells cupcakes for $2 each and cookies for $1.50 each. If they sold a total of 50 cupcakes and cookies for a total of $85, how many cupcakes did they sell?
def solve() -> int: cupcake_price = 2 cookie_price = 1.5 total_sales = 85 total_items = 50 cookie_count = (total_sales - (total_items * cupcake_price)) / (cookie_price - cupcake_price) cupcake_count = total_items - cookie_count result = cupcake_count return result
Rick has saved up some money and wants to buy a bike. He found one at the store for $120. If he already had $60 in his wallet, how much more money does he need to buy the bike?
def solve() -> int: purchase_price = 120 money_available = 60 result = purchase_price - money_available return result
Johnny borrowed $400 from a loan company that charges 8% interest compounded weekly. If Johnny doesn't make any payments, how much interest (in dollars) will he owe after the second week?
def solve() -> int: principal = 400 interest_rate = 0.08 compounding_period = 52 time = 2 interest = principal * (1 + interest_rate/compounding_period)**time - principal result = round(interest, 2) return result
At a toy store, Mia has 12 dolls and 2 times as many stuffed animals. If she has 36 toys in total, how many stuffed animals does she have?
def solve() -> int: dolls = 12 stuffed_animals = 2 * dolls total_toys = dolls + stuffed_animals stuffed_animals = (total_toys - 36) / 2 result = stuffed_animals return result
A rectangular garden with a length of 20 feet and a width of 12 feet needs to be covered with grass. Each square foot of grass costs $2.50. How much will it cost to cover the garden with grass?
def solve() -> int: grass_cost = 20 * 12 * 2.5 result = grass_cost return result
Laura has 15 apples and one-third of them are Granny Smith. If each Granny Smith apple weighs 8 ounces, how much do the Granny Smith apples weigh in total?
def solve() -> int: apples = 15 granny_smith_apples = apples / 3 weight_per_apple = 8 total_weight = granny_smith_apples * weight_per_apple result = total_weight return result
Harry has 5 times as many coins as Irene. Jack has 16 more coins than Irene. If Harry has 25 coins, how many coins does Jack have?
def solve() -> int: harry = 25 irene = None jack = None irene = harry / 5 jack = irene + 16 result = jack return result
Student: If a company sold 500 products at $20 each, and they spent $4500 on producing them, how much profit did they make?
def solve() -> int: products_sold = 500 price_per_product = 20 cost_of_production = 4500 total_revenue = products_sold * price_per_product profit = total_revenue - cost_of_production result = profit return result
A school is having a fundraiser. For every item sold, they will get a donation of $2. They sold 100 items. How much donation did they receive?
def solve() -> int: items_sold = 100 donation_per_item = 2 total_donation = items_sold * donation_per_item result = total_donation return result
Cathy has a buy 2 get 1 free coupon for buying 3 shirts. Each shirt costs $35. How much did she pay in total?
def solve() -> int: num_shirts = 3 price_per_shirt = 35 num_free_shirts = 1 total = (num_shirts - num_free_shirts) * price_per_shirt result = total return result
Possible new questions and programs are: A farmer has 12 chickens and 16 rabbits in his farm. He sells 3 chickens and 5 rabbits and buys 4 ducks. Each chicken, rabbit, and duck lays one egg per day. How many eggs will the farmer collect in 7 days?
def solve() -> int: chickens = 12 rabbits = 16 ducks = 0 eggs = 0 chickens = chickens - 3 rabbits = rabbits - 5 ducks = ducks + 4 eggs = eggs + (chickens + rabbits + ducks) * 7 result = eggs return result
Ava charges $20.00 per hour as a babysitter. In one evening, she watches four different families and they each pay her a $10.00 tip. How much money did she earn that evening?
def solve() -> int: hourly_rate = 20.00 num_families = 4 tip_per_family = 10.00 total_earnings = (hourly_rate * num_families) + (tip_per_family * num_families) result = total_earnings return result