question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A rectangle has a width of 10 cm and a length of 15 cm. What is the perimeter of the rectangle?
def solve() -> int: width = 10 length = 15 perimeter = 2 * (width + length) result = perimeter return result
Michael went to the electronics store to buy headphones. The store was having a sale that offered customers a deal to buy one pair at full price and get the second pair for half off the full price. If he purchased two pairs of headphones that were each originally marked at $50, how much did he spend on the two pairs, i...
def solve() -> int: price = 50 discounted_price = price / 2 total_price = price + discounted_price result = total_price * 2 return result
Sophia, Liam, and Jackson collected stamps. Sophia had 15 more stamps than Liam. Liam had 4 less than Jackson. Jackson had 31 stamps. How many stamps did the 3 children have in total?
def solve() -> int: sophia_stamps = 0 liam_stamps = 0 jackson_stamps = 31 liam_stamps = jackson_stamps - 4 sophia_stamps = liam_stamps + 15 total_stamps = sophia_stamps + liam_stamps + jackson_stamps result = total_stamps return result
A frog's legs measure 7/12 the length of its body. If the frog is 18 inches long, how long are its legs?
def solve() -> int: body_length = 18 leg_length_ratio = 7/12 leg_length = body_length * leg_length_ratio result = leg_length return result
Student: A blue whale can consume up to 40 million krill in a day. One krill weighs about 0.002 grams. How many kilograms of krill can a blue whale eat in a week?
def solve() -> int: krill_per_day = 40 * 10**6 krill_weight = 0.002 days_per_week = 7 krill_weight_kg = krill_weight / 1000 krill_per_day_kg = krill_per_day * krill_weight_kg krill_per_week_kg = krill_per_day_kg * days_per_week result = krill_per_week_kg return result
Olivia owns a wheat field that is 2000 feet by 2000 feet. 1 square foot of wheat can make 1 kg of flour. If it takes 2 kg of flour to make 1 loaf of bread and 1 loaf of bread sells for $5, how much does she make from her field?
def solve() -> int: field_length = 2000 field_width = 2000 field_area = field_length * field_width wheat_weight = field_area flour_weight = wheat_weight loaf_weight = 2 * flour_weight loaf_price = 5 total_income = loaf_price * (loaf_weight / 2) result = ...
A box contains 100 marbles, of which 20 are red, 30 are blue, 25 are green and 25 are yellow. If one marble is chosen randomly, what is the probability that it is yellow?
def solve() -> int: marbles = 100 yellow = 25 probability = yellow/marbles result = probability return result
For every dress Maria sews, she is paid $25 more than she is paid to add the finishing touches on the dress. If Maria gets $10 to add the finishing touches on the dress, how much does she get paid to sew and add the finishing touches on 4 dresses?
def solve() -> int: finishing_touches_payment = 10 sewing_payment = finishing_touches_payment + 25 total_payment = (finishing_touches_payment + sewing_payment) * 4 result = total_payment return result
John makes coffee with a 1:3 ratio of coffee to water. He uses 20 grams of coffee to make a pot of coffee. How much water does he use?
def solve() -> int: coffee = 20 ratio = 1/3 water = coffee / ratio result = water return result
Ben, Emma and Ryan are sharing a pizza that has 12 slices. Ben eats one third of the pizza, Emma eats one fourth of the pizza, and Ryan eats the rest. How many slices does Ryan eat?
def solve() -> int: result = 12 - (4 + 3) return result
Ava sells muffins for $3.00 each. If a muffin liner costs $0.10 and a scoop of blueberries costs $0.30, how many cents does a muffin cost Ava to make that has one liner and one scoop of blueberries?
def solve() -> int: muffin_price = 3.00 liner_cost = 0.10 blueberry_cost = 0.30 muffin_cost = liner_cost + blueberry_cost result = muffin_cost * 100 return result
Melissa is making bracelets for a fundraiser. She bought 11 packs of beads, with each pack containing 150 beads. She wants to make 25 bracelets, each using 23 beads. How many beads will she have left over after making all the bracelets?
def solve() -> int: n_packs = 11 beads_per_pack = 150 n_bracelets = 25 beads_per_bracelet = 23 total_beads = n_packs*beads_per_pack beads_used = n_bracelets*beads_per_bracelet leftover_beads = total_beads - beads_used result = leftover_beads return result
A box contains 10 red balls and 5 blue balls. If one ball is drawn, what is the probability that the ball is red?
def solve() -> int: num_red_balls = 10 num_blue_balls = 5 total_balls = num_red_balls + num_blue_balls prob_red_ball = num_red_balls / total_balls result = f'<<<{prob_red_ball}>>>' result = prob_red_ball return result
A cooking show gives away one prize per week, chosen randomly from 50 participants. What is the probability that the same person will win two consecutive weeks?
def solve() -> int: probability_single_win = 1 / 50 probability_two_wins = probability_single_win ** 2 result = probability_two_wins return result
Julie read 8 pages of a book each hour for 6 hours. Then she read 12 pages each hour for 4 hours. Tommy read 10 pages each hour for 8 hours. How many more pages did Tommy read than Julie?
def solve() -> int: julie_pages = 8 * 6 + 12 * 4 tommy_pages = 10 * 8 difference = tommy_pages - julie_pages result = difference return result
Two boxes have a combined weight of 55 pounds. Box A weighs twice as much as Box B. Calculate the weight of Box A.
def solve() -> int: total_weight = 55 weight_ratio_A_to_B = 2 weight_ratio_total = weight_ratio_A_to_B + 1 weight_A = total_weight / weight_ratio_total * weight_ratio_A_to_B result = weight_A return result
Student: Out of the 80 students who took a math test, 1/4 got an A while 2/5 got a B. The rest failed. How many students failed the test?
def solve() -> int: num_students = 80 num_A = num_students / 4 num_B = num_students * 2 / 5 num_failed = num_students - num_A - num_B result = num_failed return result
Student: A rectangle has a length of 12 inches and a width of 8 inches. What is the perimeter of the rectangle?
def solve() -> int: length = 12 width = 8 perimeter = 2 * (length + width) result = perimeter return result
Student: Betty has 80 apples. She wants to divide them into three baskets, putting twice as many apples in the first one as in the second one, and the third one should have 10 fewer apples than the second one. How many apples should she put in each basket?
def solve() -> int: apples = 80 basket1 = 0 basket2 = 0 basket3 = 0 basket1 = 2 * basket2 basket3 = basket2 - 10 basket2 = (apples - basket1 - basket3) / 2 result = basket1 + basket2 + basket3 return result
Mark saves $560 per month and splits it equally among his four children. If each child saves half their money each month and spends the other half, how much money does each child have to spend each month?
def solve() -> int: mark_monthly_savings = 560 num_children = 4 each_child_monthly_savings = mark_monthly_savings / num_children each_child_monthly_spending = each_child_monthly_savings / 2 result = each_child_monthly_spending return result
Kelly collected 200 nickels and put them in her mason jar. Jake saved 250 quarters, and Lily has a jar full of 500 pennies. What was the total savings of the three kids combined?
def solve() -> int: nickels = 200 quarters = 250 pennies = 500 total_savings = (nickels * 5) + (quarters * 25) + (pennies * 1) result = total_savings return result
There are 7 bikes rented to 6 people. How many wheels are there in total?
def solve() -> int: bikes = 7 people = 6 wheels_per_bike = 2 result = bikes * people * wheels_per_bike return result
Student: Lauren went for a run in the morning and burned 80 calories. She burned 50 calories doing yoga in the afternoon and 90 calories doing weight training at the gym. If Lauren had burned a total of 300 calories that day, how many calories did she burn during her evening workout?
def solve() -> int: morning_calories = 80 afternoon_calories = 50 gym_calories = 90 total_calories = 300 evening_calories = total_calories - (morning_calories + afternoon_calories + gym_calories) result = evening_calories return result
Sophie is monitoring how many hours she practices the piano in a week. She practices every day except Sunday, and practices for thirty minutes each time. In addition, she practices an extra hour on Thursday. How many hours does Sophie practice in a week?
def solve() -> int: days_in_week = 7 minutes_per_hour = 60 minutes_per_practice = 30 extra_practice_on_thursday = 60 total_minutes_per_week = (days_in_week - 1) * minutes_per_practice + extra_practice_on_thursday total_hours_per_week = total_minutes_per_week / minutes_per_hour resu...
Emma has 8 monkeys and 4 birds. How many animal limbs are there overall?
def solve() -> int: monkeys = 8 birds = 4 monkey_limbs = monkeys * 4 bird_limbs = birds * 2 total_limbs = monkey_limbs + bird_limbs result = total_limbs return result
Emily deposits $5000 into a savings account that pays 2% annual interest rate. If the interest in the account is compounded annually, how much money will she have in her account after 5 years?
def solve() -> int: initial = 5000 interest_rate = 0.02 compound_periods = 5 final_balance = initial * (1 + interest_rate) ** compound_periods result = final_balance return result
Student: Samuel had 20 coins. Each coin has a value of 10 cents. Karen had 5 coins worth 5 cents each. If they put their coins together and shared them equally, what is the total amount of money they have each?
def solve() -> int: samuel_coins = 20 samuel_value = 10 karen_coins = 5 karen_value = 5 samuel_total = samuel_coins * samuel_value karen_total = karen_coins * karen_value total = samuel_total + karen_total result = total / 2 return result
Mary had 10 buckets of apples to distribute to patients in a hospital. She had to use at least 25 apples but no more than 40 apples per bucket. How many buckets can she make?
def solve() -> int: min_apples = 25 max_apples = 40 total_apples = 10 * min_apples num_buckets = total_apples // max_apples result = num_buckets return result
If a recipe calls for 2 cups of sugar to make 20 cookies, how much sugar would be needed to make 35 cookies?
def solve() -> int: sugar_cups = 2 cookies = 20 new_cookies = 35 sugar_needed = sugar_cups * (new_cookies / cookies) result = sugar_needed return result
A survey of 400 students revealed that 25% of students play basketball and 50% of basketball players also play football. What is the probability that a student chosen at random plays basketball and football?
def solve() -> int: total_students = 400 basketball_players = total_students * 0.25 football_players_given_basketball = basketball_players * 0.5 probability = football_players_given_basketball / total_students result = probability return result
A group of friends were hiking and brought 4 dozen granola bars. Each person got 2 bars, and the boys received 1 more bar than the girls because the girls had some fruit. If there were 8 girls on the trip, how many boys went on the trip?
def solve() -> int: bars_per_dozen = 12 total_bars = 4 * bars_per_dozen bars_per_person = 2 girls = 8 boys = (total_bars - (girls * bars_per_person)) / (bars_per_person + 1) result = boys return result
Jake collected 2/5 of a bucket of rainwater on Monday. He collected another 1/3 of a bucket of rainwater on Tuesday. He used 2/15 of a bucket of rainwater to water his plants on Wednesday. How much rainwater was left in his bucket?
def solve() -> int: from fractions import Fraction amount = Fraction(9, 15) result = amount return result
Leo's house has an area equal to 1,440 square feet. It has 4 bedrooms that each measure 10 x 12 feet. There is 1 bathroom that is 8 x 9 feet. The living room and the kitchen complete the home and they have the same sized area. How many square feet is the area of the kitchen?
def solve() -> int: bedroom_area = 4 * 10 * 12 bathroom_area = 8 * 9 total_area = bedroom_area + bathroom_area remaining_area = 1440 - total_area kitchen_area = remaining_area / 2 result = kitchen_area return result
An art class is taking a field trip to a museum. The admission for each student is $7.00. How much money does the class need for admission if 45 students are attending?
def solve() -> int: price_per_student = 7 num_students = 45 admission_fee = price_per_student * num_students result = admission_fee return result
A factory produces 712 products in a single hour. How many products does the factory produce in 8 hours?
def solve() -> int: result = 0 no_of_products_per_hour = 712 no_of_hours = 8 total_products = no_of_products_per_hour * no_of_hours result = total_products return result
If Amanda is 5ft tall and she grows 1 inch taller each year, how tall will Amanda be in 10 years?
def solve() -> int: result = 0 initial_height = 5 growth_rate = 12 time_period = 10 total_growth = growth_rate * time_period result = initial_height + total_growth return result
Jack earns $18 per hour at his job. This week he worked 35 hours, and he earned an additional $100 from selling his old textbooks. His tax rate is 25% and he spends $25 on lunch each week. How much money does Jack have left after paying tax and lunch expenses?
def solve() -> int: hourly_rate = 18 hours_worked = 35 extra_income = 100 tax_rate = 0.25 lunch_cost = 25 total_income = (hourly_rate * hours_worked) + extra_income tax_amount = total_income * tax_rate net_income = total_income - tax_amount remaining_income = net_income - lunch_cost ...
A survey of 1000 people showed that 30% of the people prefer cats, 20% prefer dogs, and the rest prefer birds. If 300 people prefer cats, how many prefer birds?
def solve() -> int: total_people = 1000 cats_percentage = 0.3 dogs_percentage = 0.2 birds_percentage = 1 - cats_percentage - dogs_percentage cats_people = 300 birds_people = total_people * birds_percentage result = birds_people return result
An apple costs $0.50. You have $20. How many apples can you buy?
def solve() -> int: cost_per_apple = 0.5 total_money = 20 num_apples = total_money // cost_per_apple result = num_apples return result
Jason has $80 to spend on food for his road trip. He wants to eat at two restaurants. The first restaurant is cheaper than the second one by $5. If he wants to spend the same amount of money on each meal, how much can he spend at each restaurant?
def solve() -> int: money = 80 restaurant_difference = 5 restaurant_total = money / 2 restaurant_1 = (restaurant_total - restaurant_difference) / 2 restaurant_2 = restaurant_total + restaurant_difference / 2 result = restaurant_1, restaurant_2 return result
The sum of the ages of two people is 32. One person is three times as old as the other. What is the age of the younger person?
def solve() -> int: total_age = 32 older_person_age = 24 younger_person_age = total_age - older_person_age result = younger_person_age return result
Jonah has 2kg of candy. He divides it equally into 4 bags, each containing 500g of candy. How much candy did he put in each bag?
def solve() -> int: totalCandy = 2000 numBags = 4 bagSize = totalCandy // numBags result = bagSize return result
Jack has twice as many marbles as Lisa. Lisa has 15 marbles less than David. David has 23 marbles. How many marbles does Jack have?
def solve() -> int: david_marbles = 23 lisa_marbles = david_marbles - 15 jack_marbles = lisa_marbles * 2 result = jack_marbles return result
Student: Rosy enters a skating competition that requires a $12 entry fee. She earns $0.3 for every lap she completes in 3 minutes. If she loses $9 after the competition, how many laps did she complete?
def solve() -> int: entry_fee = 12 earning_per_lap = 0.3 loss = 9 laps = (entry_fee + loss) / earning_per_lap result = laps return result
A building has 15 floors. An elevator takes 20 seconds to travel from the ground floor to the tenth floor. If it travels at the same speed, how long will it take to travel from the tenth floor to the top floor?
def solve() -> int: total_floors = 15 distance = 10 travel_time = 20 time_per_floor = travel_time / distance floors_left = total_floors - distance time_left = floors_left * time_per_floor result = time_left return result
Jacob is preparing burgers for his cookout. He has bought 5 packs of burgers, each with 4 burgers. There are 12 guests who will eat 2 burgers each. How many burgers will be left over if Jacob eats 1 himself?
def solve() -> int: packs_of_burgers = 5 burgers_per_pack = 4 guests = 12 burgers_per_guest = 2 jacob_eats = 1 total_burgers = packs_of_burgers * burgers_per_pack total_burgers_needed = guests * burgers_per_guest + jacob_eats burgers_left_over = total_burgers - total_burgers_needed ...
ome possible new questions are: - There are 72 cupcakes in a bakery. Two-fifths of them are chocolate. How many cupcakes are not chocolate?
def solve() -> int: total = 72 chocolate = 2/5 chocolate_cupcakes = total * chocolate non_chocolate_cupcakes = total - chocolate_cupcakes result = non_chocolate_cupcakes return result
9. Ann earns $6 per hour, she works 5 hours per day for 8 weeks. How much money did Ann make?
def solve() -> int: hours = 5 weeks = 8 wage = 6 total = hours * weeks * 7 * wage result = total return result
Sarah bought 6 bags of candy. Each bag cost $3.25, but there was a sale of 10% off for 5 bags or more. How much, in dollars, did she spend on the candy?
def solve() -> int: cost_per_bag = 3.25 num_bags = 6 total_cost = cost_per_bag*num_bags discount_threshold = 5 discount = 0.10 if num_bags >= discount_threshold: final_cost = total_cost - total_cost*discount else: final_cost = total_cost result = final_cost return result
A flower shop has 3 bouquets of flowers. The first bouquet has 7 more roses than daisies. The second bouquet has 5 more daisies than the first bouquet and 3 more roses than the first bouquet. The third bouquet has 10 more roses than daisies and 12 more daisies than the second bouquet. How many roses are in the third bo...
def solve() -> int: roses_1=0 daisies_1=0 roses_2=0 daisies_2=0 roses_3=0 daisies_3=0 roses_1 = daisies_1 + 7 daisies_2 = daisies_1 + 5 roses_2 = roses_1 + 3 daisies_3 = daisies_2 + 12 roses_3 = daisies_3 + 10 result = roses_3 return result
Q3: Sarah has a bowl of jellybeans. There are 4 times as many red jellybeans as blue jellybeans and 6 times as many orange jellybeans than blue jellybeans. There are 30 jellybeans in the bowl in total. How many blue jellybeans are there in the bowl?
def solve() -> int: total_jellybeans = 30 orange_jellybeans = total_jellybeans/6 blue_jellybeans = orange_jellybeans/4 result = blue_jellybeans return result
A group of 6 employees decided to buy a new desk for their office that cost $1200. They decided to split the cost on a per head basis, however, one employee left his job before they bought the desk. How much more should each employee contribute now that they are one employee short?
def solve() -> int: num_of_employees = 6 desk_cost = 1200 num_of_employees_left = num_of_employees - 1 amount_paid_per_person = desk_cost/num_of_employees cost_paid = amount_paid_per_person*num_of_employees_left amount_owed_per_person = (desk_cost-cost_paid)/(num_of_employees_left) result = ...
In order to ship a package, a delivery company charges a flat fee of $30 and an additional charge of $1.50 for each additional pound above the first 5 pounds. If the total cost to ship a package is $42.50, what is the weight of the package?
def solve() -> int: shipping_flat_fee = 30 additional_charge_per_pound = 1.5 total_shipping_cost = 42.5 additional_weight = (total_shipping_cost-shipping_flat_fee)/additional_charge_per_pound result = 5 + additional_weight return result
If a store sells an item for $25, but offers a 20% discount on it, what is the final price of the item with the discount?
def solve() -> int: original_price = 25 discount = 0.2 discount_amount = original_price * discount final_price = original_price - discount_amount result = final_price return result
Jack and Jill went strawberry picking. Jack picked 11 strawberries and Jill picked two times as many. How many strawberries did they collect altogether?
def solve() -> int: p1 = 11 p2 = 2 total = p1 + (p2 * 2) result = total return result
Henry used a ladder to paint a wall that had a height of 8 meters. If the ladder was 3 meters long, how many times did Henry have to move the ladder?
def solve() -> int: wall_height = 8 ladder_length = 3 times = wall_height // ladder_length result = times return result
If John had $40 more, he would have $120. If Julie had $10 less, she would have the same money as John has. How much money do John and Julie have altogether?
def solve() -> int: john_extra_money = 40 john_total_money = 120 julie_less_money = 10 john_current_money = john_total_money - john_extra_money julie_current_money = john_current_money total_money = john_current_money + julie_current_money result = total_money return ...
Mike has 54 oranges. He gives away 8 oranges and then eats 16 oranges. How many oranges does Mike have left?
def solve() -> int: number_of_oranges = 54 oranges_given_away = 8 oranges_eaten = 16 result = number_of_oranges - (oranges_given_away + oranges_eaten) return result
Alice is a painter who sells her paintings online. She charges $50 for each painting, plus a $10 shipping fee. She spends $20 on average for the materials and $5 for the packaging of each painting. How many paintings does she need to sell to earn a profit of $1000?
def solve() -> int: income = 50 + 10 expense = 20 + 5 profit = income - expense target = 1000 number = target / profit result = number return result
A car travels 256 miles with 8 gallons of gasoline. If gasoline costs $3.50 per gallon, how much will it cost to travel 400 miles?
def solve() -> int: distance1 = 256 gasoline1 = 8 distance2 = 400 unit_rate = gasoline1 / distance1 gasoline2 = distance2 * unit_rate price_per_gallon = 3.5 total_cost = gasoline2 * price_per_gallon result = total_cost return result
ophie went to the store to buy fruits. She bought three types of fruits: apples ($0.60 each), bananas ($0.40 each), and oranges ($0.75 each). She bought 4 apples, 6 bananas, and 2 oranges. How much did Sophie spend on fruit in total?
def solve() -> int: total_apple = 0.60 * 4 total_banana = 0.40 * 6 total_orange = 0.75 * 2 total_cost = total_apple + total_banana + total_orange result = total_cost return result
A train starts from Philadelphia to New York at 9:00 AM and travels at a speed of 80 mph. Another train starts from New York to Philadelphia at 10:00 AM and travels at a speed of 100 mph. If the distance between the cities is 100 miles, what time will they meet?
def solve() -> int: distance = 100 speed1 = 80 speed2 = 100 time1 = distance / speed1 time2 = distance / speed2 total_time = time1 + time2 meeting_time_hours = 10 + total_time result = meeting_time_hours return result
During a research of different fruits, Emma learned that Mango had 50 more pieces than Pineapple. Apple had 200 pieces, and Banana had 20 more pieces than Apple. If Mango had 300 pieces, how many fruits are there in all?
def solve() -> int: pineapple = 300 - 50 apple = 200 banana = apple + 20 mango = 300 total_fruits = pineapple + apple + banana + mango result = total_fruits return result
If you switch from using 13 incandescent light bulbs in your house to using 10 efficient light bulbs that produce 17 lbs of carbon dioxide each, how many pounds of carbon dioxide will be saved?
def solve() -> int: old_bulbs_quantity = 13 new_bulbs_quantity = 10 co2_produced_per_bulb = 17 co2_saved = (old_bulbs_quantity - new_bulbs_quantity) * co2_produced_per_bulb result = co2_saved return result
A snail climbs up a 16-foot wall. Each day, it climbs up 3 feet, but at night, it slides down 2 feet. How many days does it take for the snail to reach the top of the wall?
def solve() -> int: snail_height = 0 days = 0 while snail_height < 16: snail_height += 3 if snail_height < 16: snail_height -= 2 days += 1 result = days return result
Student: A construction workers has a certain type of bricks. He has used 15 of them for building a wall. For every 3 bricks he uses, he throws away 1. How many bricks have been thrown away?
def solve() -> int: bricks_used = 15 ratio = 1 / 3 bricks_thrown = ratio * bricks_used result = round(bricks_thrown) return result
Steven wants to buy a gift for his girlfriend. The gift costs $200 and he has saved $50. He earns $10 per hour and needs to work for 18 hours to make enough money to buy the gift. How much will Steven have left after buying the gift? Abby can swim in a pool at a speed of 5 meters per second, and a ball thrown by her ca...
def solve() -> int: gift_cost = 200 saved_money = 50 hourly_wage = 10 hours_needed = 18 total_money = saved_money + (hourly_wage * hours_needed) money_left = total_money - gift_cost abby_swim_speed = 5 ball_speed = 20 relative_speed = ball_speed - abby_swim_speed r...
Student: Keith rented 19 books from the library. 4/7th of the books were informational books, 3/5th of the rest were novels. How many novels did Keith rent?
def solve() -> int: books_rented = 19 informational_books = books_rented * (4/7) novels = (books_rented - informational_books) * (3/5) result = novels return result
During a sale, a jacket is being sold for 20% less. If the original price was $80 dollars, what is the sale price?
def solve() -> int: original_price = 80 discount_percent = 20 sale_price = original_price - (original_price * (discount_percent / 100)) result = sale_price return result
A boat travels 60 miles downstream in 3 hours. The return trip upstream takes 5 hours. What is the speed of the boat in still water if the speed of the current is 5 miles per hour?
def solve() -> int: distance = 60 downstream_time = 3 upstream_time = 5 current_speed = 5 boat_speed = (distance / downstream_time + distance / upstream_time) / 2 - current_speed result = boat_speed return result
It takes 4 people 3 hours to make 48 wooden chairs. How many people would it take to make 72 chairs in 6 hours?
def solve() -> int: people = 4 time = 3 chairs = 48 new_time = 6 new_chairs = 72 result = new_chairs * people / (time/new_time) return result
A pizza restaurant has a special deal where for every three slices of pizza, they give you one free drink. If John orders 9 slices of pizza, how many free drinks will he have received?
def solve() -> int: pizzas = 9 / 3 free_drinks = pizzas result = free_drinks return result
A train travels at a speed of 120 mph for the first 50 miles and at a speed of 80 mph for the next 100 miles. Calculate the total amount of time it took the train to travel the whole distance.
def solve() -> int: distance1 = 50 distance2 = 100 speed1 = 120 speed2 = 80 time1 = distance1 / speed1 time2 = distance2 / speed2 total_time = time1 + time2 result = f'<<<{total_time}>>>' result = total_time return result
Student: Grace buys a laptop for $1000 and gets a 33% discount. How much did she pay?
def solve() -> int: price = 1000 discount = 0.33 discounted_price = price * (1 - discount) result = price - discounted_price return result
A box contains 20 pencils and 10 erasers. I take out 5 pencils and 2 erasers. Then, I put in 3 new pencils and 4 new erasers. How many pencils and erasers are there in the box now?
def solve() -> int: pencils_left = 20 - 5 erasers_left = 10 - 2 pencils_in = pencils_left + 3 erasers_in = erasers_left + 4 total = pencils_in + erasers_in result = total return result
A classroom has 20 students. If each student needs 3 pencils, 2 pens, and 1 notebook for class, how many pencils, pens, and notebooks are needed in total?
def solve() -> int: students = 20 pencils_per_student = 3 pens_per_student = 2 notebooks_per_student = 1 total_pencils = students * pencils_per_student total_pens = students * pens_per_student total_notebooks = students * notebooks_per_student result = total_pencils + total_pen...
Lisa had a starting balance of $500 and she withdraws $100. What is her new balance?
def solve() -> int: balance = 500 withdraw = 100 result = 0 result = balance - withdraw return result
Sophia has 11 stickers and wants to quadruple the amount for her scrapbooking hobby. If she splits the stickers equally into 2 albums, how many stickers will be in each album?
def solve() -> int: stickers = 11 quadrupled = stickers * 4 album_stickers = quadrupled / 2 result = album_stickers return result
Bob has 200 dollars and wants to buy 4 shirts, each costing 25 dollars. He also wants to buy 2 pairs of pants, each costing 35 dollars. How much money will Bob have left after purchasing all of his items?
def solve() -> int: money_spent_on_shirts = 4*25 money_spent_on_pants = 2*35 total_money_spent = money_spent_on_shirts + money_spent_on_pants money_left = 200 - total_money_spent result = money_left return result
Michael buys peanuts for $8 per jar. Each jar is 10 ounces. He consumes 24 ounces of peanuts every 6 days. What is his weekly spending on peanuts?
def solve() -> int: jar_price = 8 jar_size = 10 consumption_rate = 24 weekly_consumption = consumption_rate * 7/6 jars_per_week = weekly_consumption / jar_size weekly_spending = jars_per_week * jar_price result = weekly_spending return result
2. Jodie has $12. She spent $2.25 on snacks, and then spent another $1.50 on a toy. How much money, in dollars, does she have left?
def solve() -> int: money = 12 spent1 = 2.25 spent2 = 1.50 result = money - spent1 - spent2 return result
Lisa walks 3000 steps on day 1, and double that on day 2 plus 500. On day 3, Lisa walks 300 more steps than the sum of the first two days. How many steps did Lisa walk in total in those 3 days?
def solve() -> int: day1_steps = 3000 day2_steps = (day1_steps * 2) + 500 day3_steps = (day1_steps + day2_steps) + 300 total_steps = day1_steps + day2_steps + day3_steps result = total_steps return result
A recipe calls for 2 1/2 cups of flour. If you only have 1/2 cup measuring cup, how many times do you need to measure to get enough flour?
def solve() -> int: cups_needed = 2.5 cups_per_measure = 0.5 measures_needed = cups_needed / cups_per_measure result = measures_needed return result
A car traveled 240 miles in 4 hours. If the car traveled at a constant speed, how many miles will it travel in 6 hours?
def solve() -> int: speed = 240/4 distance_in_6_hours = speed*6 result = distance_in_6_hours return result
A pizza has a diameter of 16 inches. What is the area of the pizza?
def solve() -> int: diameter = 16 radius = diameter / 2 pi = 3.14159 area = pi * radius ** 2 result = area return result
Student: A pizza has 8 slices. A group of 4 people wants to share the pizza equally. How many slices of pizza will each person get?
def solve() -> int: slices = 8 people = 4 slices_per_person = slices // people result = slices_per_person return result
James bought 3 pairs of shoes on sale for $50 each. The store manager told him that he saved a total of $45. If James saved the same amount on each pair, what was the original price of each pair?
def solve() -> int: pairs_of_shoes = 3 sale_price = 50 total_savings = 45 original_price = (pairs_of_shoes * sale_price) + total_savings result = original_price / pairs_of_shoes return result
A bookshelf can hold 48 books. The ratio of hardcover books to paperback books is 3:5. If the bookshelf is filled with only hardcover books, how many more books can fit in the bookshelf?
def solve() -> int: total_books = 48 hardcover_ratio = 3/8 hardcover_books = int(total_books * hardcover_ratio) remaining_spaces = total_books - hardcover_books result = remaining_spaces return result
A tank can hold 500 gallons of water when full. If it has 120 gallons of water, what percent of its capacity is the tank currently filled?
def solve() -> int: tank_capacity = 500 current_water = 120 percent_full = current_water / tank_capacity * 100 result = percent_full return result
Craig and Clara went to the park very often. Craig went to the park 10 times more in 2011 than he did in 2010. In 2010, Craig went to the park 6 times. In 2011, Clara went to the park 3 times as many times as Craig did, but in 2010, she only went to the park half as much as he did. How many times did Craig and Clara go...
def solve() -> int: total_2010 = 0 total_2011 = 0 craig_2010 = 6 clara_2010 = craig_2010 / 2 total_2010 = craig_2010 + clara_2010 craig_2011 = craig_2010 * 10 clara_2011 = craig_2011 * 3 total_2011 = craig_2011 + clara_2011 result = total_2010 + total_2011 ...
Lisa has always wanted to read all the classic literature works. She spends 3 months researching and compiling a list of the books she wants to read. It takes her 8 years to read them all. After that, she spends another 2 years studying to become an expert in classic literature. How long did Lisa take to achieve her li...
def solve() -> int: research_time = 3 reading_time = 8 expert_time = 2 total_time = research_time/12 + reading_time + expert_time result = total_time return result
A small vase contains 56 marbles that are all the same size. If the radius of each marble is 1cm, what is the volume of the vase?
def solve() -> int: radius = 1 volume = (4/3) * 3.14 * (radius**3) * 56 result = volume return result
A rectangle has a length of 20cm and a width of 10cm. Find its area in cm².
def solve() -> int: length = 20 width = 10 area = length * width result = area return result
Dan wanted to fill his swimming pool with water. The pool had a capacity of 8000 liters. He had a hose that could pump water at a rate of 25 liters per minute. He started filling the pool at 9 a.m. and took a 30-minute break at noon. At what time did he finish filling the pool?
def solve() -> int: water_per_hour = 25 * 60 water_before_break = water_per_hour * 3 water_after_break = water_per_hour * (8000 - water_before_break) / 25 total_time = 3 * 60 + 30 + water_after_break hours = int(total_time / 60) minutes = int(total_time % 60) finish_hour = 9 + hours fini...
Two numbers have a difference of 17. If their sum is 79, what is the larger number?
def solve() -> int: difference = 17 sum = 79 smaller_num = (sum - difference) / 2 larger_num = smaller_num + difference result = larger_num return result
Eric borrowed $30,000 from the bank to buy a car. The bank loan had a fixed interest rate of 4% for 6 years. What is the total amount of interest Eric will have to pay?
def solve() -> int: loan_amount = 30000 interest_rate = 0.04 term = 6 total_interest = loan_amount*interest_rate*term result = total_interest return result
A box of cereal initially sells for 5 dollars. The price drops by 2 dollars every week. If the price can never go below 2 dollars, how long does it take for the price to reach the lowest possible value?
def solve() -> int: initial_price = 5 decrease_per_week = 2 minimum_price = 2 weeks = (initial_price-minimum_price)/decrease_per_week result = weeks return result
David is going to spend 1/4 of a day painting. He will paint landscapes, portraits, and abstracts. He can paint 4 landscapes in an hour, 6 portraits in an hour, and 8 abstracts in an hour. If he paints each for 1/3 of his time, how many paintings can he paint?
def solve() -> int: hours = 6 landscapes_per_hour = 4 portraits_per_hour = 6 abstracts_per_hour = 8 time_per_painting = 1/3 total_paintings = hours * (landscapes_per_hour + portraits_per_hour + abstracts_per_hour) * time_per_painting result = total_paintings return result...
A car travels at a constant speed of 60 miles per hour for 2 hours, then at 50 miles per hour for 1.5 hours, and then at 40 miles per hour for 1 hour. What is the average speed of the car for the whole trip, in miles per hour?
def solve() -> int: speed_1 = 60 speed_2 = 50 speed_3 = 40 time_1 = 2 time_2 = 1.5 time_3 = 1 distance_1 = speed_1 * time_1 distance_2 = speed_2 * time_2 distance_3 = speed_3 * time_3 total_distance = distance_1 + distance_2 + distance_3 total_time = time_1 + time_2 + time_3 ...
A book store sold 50 fiction books for $15 each, 10 non-fiction books for $25 each, and 15 cookbooks for $30 each. How much money did the book store make?
def solve() -> int: fiction_books = 50 non_fiction_books = 10 cookbooks = 15 fiction_book_price = 15 non_fiction_book_price = 25 cookbook_price = 30 total_money = (fiction_books * fiction_book_price) + (non_fiction_books * non_fiction_book_price) + (cookbooks * cookbook_price) ...