question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
The Smith family bought 2 cats at a pet store. The orange cat weighs 3 kg and the white cat weighs 8 kg. They also got 1 kg of cat food. What's the average weight of what the Smith family brought?
def solve() -> int: total_weight = 3 + 8 + 1 num_items = 3 result = total_weight / num_items return result
In a park, there are 60 tennis shoes, not including the ones worn by the players. Assuming every tennis player has 2 tennis shoes, how many players are in the park?
def solve() -> int: shoes_in_park = 60 shoes_per_player = 2 players_in_park = shoes_in_park / shoes_per_player result = players_in_park return result
Clara had a cake that weighed 1.5 kilograms. She cut the cake into 12 equal slices. She ate 2 slices and gave 3 slices to her sister. How many grams of cake did she have left?
def solve() -> int: cake = 1.5 * 1000 slice = cake / 12 cake = cake - slice * (2 + 3) result = cake return result
Michelle and her coworkers buy a gift for their boss and split the cost evenly. They get a basket of chocolates worth $60, a bouquet of flowers worth $30, and a gift card worth $100. Michelle also pitches in an additional $20 on her own. What percentage of the total cost does Michelle contribute?
def solve() -> int: basket_of_chocolates = 60 bouquet_of_flowers = 30 gift_card = 100 michelle_contribution = 20 total_cost = basket_of_chocolates + bouquet_of_flowers + gift_card + michelle_contribution michelle_percentage = (michelle_contribution / total_cost) * 100 result =...
Tom can run 1 mile in 8 minutes. How long will it take him to run 5 miles?
def solve() -> int: distance_to_run = 5 time_per_mile = 8 total_time = distance_to_run * time_per_mile result = total_time return result
1. What is the total number of pieces of envelope and mail that the mailman has to deliver altogether if he has to deliver 12 pieces of envelope and 123 pieces of postcard?
def solve() -> int: envelope = 12 postcard = 123 total = envelope + postcard result = total return result
An old man is ridding a bike. He rode for 15 minutes at a constant speed of 6 km/h and then increased his speed to 12 km/h for the rest of his ride. If the total distance travelled was 18 km, how long did he ride at the increased speed?
def solve() -> int: init_speed = 6 inc_speed = 12 total_dist = 18 init_time = 15 total_time = (total_dist/(init_speed+inc_speed))*60 inc_time = total_time - init_time result = inc_time return result
Mason has 35 coins that he wants to share with his sister Emily. How many coins will each of them get if they split them equally?
def solve() -> int: coins = 35 sister = coins // 2 result = sister return result
Possible math questions and programs are: Ben surveys 120 people at the park and asks them if they like chocolate ice cream. He makes sure to get an equal number of responses from children and adults. He finds that 65% of children and 40% of adults say yes. How many children like chocolate ice cream?
def solve() -> int: total = 120 children = total // 2 adults = total - children child_rate = 0.65 adult_rate = 0.40 child_chocolate = children * child_rate result = child_chocolate return result
If Alex made twice as much money as her sister, and together they earned $120, how much money did Alex make?
def solve() -> int: sister_money = 0 alex_money = 0 total_money = 120 sister_money = total_money / 3 alex_money = sister_money * 2 result = alex_money return result
Emily bought a shirt and a pair of jeans from a store. The shirt cost $15 and the jeans cost $25. The store had a 20% off discount on all items. How much did Emily save by buying the items from the store?
def solve() -> int: shirt_cost = 15 jeans_cost = 25 discount = 0.2 original_price = shirt_cost + jeans_cost discounted_price = original_price * (1 - discount) savings = original_price - discounted_price result = savings return result
-Use descriptive and meaningful variable names for your Python program, for example, cards_for_jenny, cards_for_orlando, cards_for_richard. Possible questions and programs: Tina collected 12 stickers. She gave 4 stickers to Ali. Ali had 7 stickers before receiving Tina's gift. Roy has twice as many stickers as Ali. How...
def solve() -> int: stickers_for_tina = 12 stickers_for_ali = 7 stickers_for_roy = 0 stickers_for_tina = stickers_for_tina - 4 stickers_for_ali = stickers_for_ali + 4 stickers_for_roy = 2 * stickers_for_ali total_stickers = stickers_for_tina + stickers_for_ali + stickers_for_roy resul...
8. On the first day, Alicia has an animal farm with 6 cows. On the second day, she buys 3 more cows and on the third day, she buys double the number of cows than what she bought the second day. How many cows does Alicia have in the end?
def solve() -> int: totalCows = 6 totalCows += 3 totalCows += (3*2) result = totalCows return result
A recipe calls for 2 1/2 cups of flour. If you want to make half the recipe, how many cups of flour do you need?
def solve() -> int: original_flour = 2.5 reduced_recipe = 0.5 reduced_flour = original_flour * reduced_recipe result = reduced_flour return result
A box contains 70 red marbles and 84 blue marbles. What fraction of marbles are red?
def solve() -> int: total_marbles = 70 + 84 red_fraction = 70 / total_marbles result = red_fraction return result
Student: A train traveled 120 km/h for 2 hours and then 150 km/h for another 2 hours. What was its average speed for the entire journey?
def solve() -> int: distance = 120 + 150 time = 4 result = distance / time return result
Melvin is running a retail store that has a flat rate of $20 fee and an additional fee of 13 cents for every item customers buy. How much will it cost for 16 items?
def solve() -> int: flat_rate = 20 fee_per_item = 0.13 num_items = 16 total_fee = flat_rate + (num_items * fee_per_item) result = total_fee return result
A rectangular room has a length of 15 meters and a width of 10 meters. If the cost of carpeting the room is $20 per square meter, what is the total cost of carpeting the room?
def solve() -> int: length = 15 width = 10 area = length * width cost_per_square_meter = 20 total_cost = area * cost_per_square_meter result = total_cost return result
A bottle of juice is 60% full. If the bottle contains 3 liters of juice, how many liters of juice were consumed?
def solve() -> int: total_juice = 3 full_percentage = 60 consumed_percentage = 100 - full_percentage consumed_juice = total_juice * (consumed_percentage/100) result = consumed_juice return result
Haley can only type 4 words a minute, but takes a 5-minute break every 30 minutes. How long does it take for her to type 80 words?
def solve() -> int: words_per_minute = 4 break_duration = 5 typing_duration = 30 - break_duration total_words = 80 typing_time = total_words / words_per_minute total_breaks = typing_time // typing_duration total_break_time = total_breaks * break_duration total_time = typing_tim...
Jake gets paid $14 per hour and earned $420 in his paycheck before taxes were taken out. How many hours did he work last week?
def solve() -> int: hourly_rate = 14 total_earnings = 420 hours_worked = total_earnings / hourly_rate result = hours_worked return result
Student: A rectangular fence has a length of 12 meters and a width of 8 meters. What is its area in square meters?
def solve() -> int: length = 12 width = 8 area = length * width result = area return result
Emily buys 4 bottles of water today and plans to buy 6 more tomorrow. If the cost per bottle of water is $1.50 today, how much will Emily spend for all her bottles of water?
def solve() -> int: bottles_today = 4 bottles_tomorrow = 6 cost_per_bottle = 1.50 total_bottles = bottles_today + bottles_tomorrow total_cost = total_bottles * cost_per_bottle result = total_cost return result
A company has 175 employees, and each employee works an average of 7.5 hours per day. If the company operates for 5 days a week, and the hourly rate is $12, how much does the company pay in wages every week?
def solve() -> int: num_employees = 175 hours_per_day = 7.5 num_days = 5 hourly_rate = 12 total_hours = num_employees * hours_per_day * num_days total_wages = total_hours * hourly_rate result = total_wages return result
A car rental company charges $40 per day for rental plus an additional $0.25 per mile driven. If a customer rented a car and drove 300 miles, how much does the rental cost?
def solve() -> int: miles_driven = 300 daily_rental_cost = 40 mileage_cost = 0.25*miles_driven total_cost = daily_rental_cost + mileage_cost result = total_cost return result
Student: A store has 400 shirts in total. They sold 2/5 of the shirts last month and 1/4 of the remaining shirts this month. How many shirts are left in the store?
def solve() -> int: total_shirts = 400 shirts_sold_last_month = total_shirts * 2/5 shirts_sold_this_month = (total_shirts - shirts_sold_last_month) * 1/4 shirts_left = total_shirts - shirts_sold_last_month - shirts_sold_this_month result = shirts_left return result
Mariah spends 4 hours cooking every day. During her cooking time, she spends 1/5 of the time preparing ingredients and the rest of the time cooking and plating. If she spends twice as much time cooking as preparing ingredients, how much time does she spend preparing ingredients in minutes?
def solve() -> int: hours_cooking = 4 prep_time = hours_cooking * (1/5) cook_time = hours_cooking - prep_time prep_time_minutes = prep_time * 60 cook_time_minutes = cook_time * 60 prep_time_minutes = prep_time_minutes / 3 result = prep_time_minutes return result
John is at a restaurant with 3 friends. Their total bill is $85.80, including a 15% tip. How much did each person contribute to the bill?
def solve() -> int: total = 85.8 tip_percentage = 0.15 people = 4 total_no_tip = total / (1 + tip_percentage) total_per_person = total_no_tip / people result = total_per_person return result
Kelvin bought 5 shoes. The first 3 shoes cost $25 each, the last two cost $40 each. What is the total cost, in dollars of the 5 shoes?
def solve() -> int: cost_of_first_3_shoes = 25*3 cost_of_last_2_shoes = 40*2 total_cost = cost_of_first_3_shoes + cost_of_last_2_shoes result = total_cost return result
Mark made 80 cupcakes, and divided them equally into 16 boxes. How many cupcakes are in each box?
def solve() -> int: cupcakes = 80 boxes = 16 cupcakes_per_box = cupcakes / boxes result = cupcakes_per_box return result
Student: If a yard of fabric costs $10 and can make 4 pillows, how much will it cost to make 12 pillows?
def solve() -> int: cost_of_fabric = 10 pillows_per_yard = 4 num_pillows = 12 num_yards = num_pillows / pillows_per_yard total_cost = num_yards * cost_of_fabric result = total_cost return result
It can cost $420 to fill up a gas tank. What is the total cost of filling up three gas tanks?
def solve() -> int: cost_fill_up = 420 no_tanks = 3 total_cost = cost_fill_up * no_tanks result = total_cost return result
A baker uses 25% of the flour in a bag to make bread. He then uses 50% of the remaining flour to make cookies. If there were 8 kilograms of flour in the bag, how many kilograms of flour are left?
def solve() -> int: flour = 8 flour_bread = flour * 0.25 flour = flour - flour_bread flour_cookies = flour * 0.5 flour = flour - flour_cookies result = flour return result
John needs to paint a rectangular room that measures 10 feet by 12 feet. The room has a standard 8-foot ceiling. He needs to paint the walls and the ceiling. How many square feet does he need to paint?
def solve() -> int: length_of_room = 10 width_of_room = 12 height_of_room = 8 area_of_walls = 2 * height_of_room * (length_of_room + width_of_room) area_of_ceiling = length_of_room * width_of_room total_area_to_paint = area_of_walls + area_of_ceiling result = total_area_to_paint return r...
If the size of the banana plantation on Jakies Island is 400 hectares and the size of the banana plantation on the nearby island is 300 hectares, how much larger or smaller is the plantation on Jakies Island?
def solve() -> int: size_jakies = 400 size_nearby = 300 difference = size_jakies - size_nearby result = difference return result
If a bag of candy contains 32 pieces and you want to give 4 pieces to each of your 7 friends, how many pieces will be left in the bag?
def solve() -> int: candy_bag_size = 32 pieces_per_friend = 4 num_friends = 7 total_pieces_given = pieces_per_friend * num_friends pieces_left = candy_bag_size - total_pieces_given result = pieces_left return result
Here are 10 possible math questions and python programs: Lisa spent one-third of her savings on a new bike and one-fourth of the remaining amount on a helmet. If she now has $60 left, how much was her initial savings?
def solve() -> int: from fractions import Fraction s = 0 s = 60 * 12 / 5 result = s return result
Student: A pizza parlor always cuts its pizzas into 8 slices, but today it decides to cut them into 10 slices. What is the percentage increase in the number of slices?
def solve() -> int: original_slices = 8 new_slices = 10 difference = new_slices - original_slices ratio = new_slices / original_slices percentage = round(ratio * 100, 2) percentage_increase = percentage - 100 result = percentage_increase return result
Brad needs to buy a new phone that costs $800. He has a coupon that takes off 15% of the cost. How much will Brad end up paying?
def solve() -> int: price = 800 discount = 0.15 discounted_price = price - (price * discount) result = discounted_price return result
Serena swam 400 meters in 5 minutes. What was her average speed in meters per minute?
def solve() -> int: distance = 400 time = 5 average_speed = distance / time result = average_speed return result
A construction company needs 360 bricks to build a wall. They already have 80 bricks. Each pallet of bricks contains 120 bricks. How many pallets should the company buy?
def solve() -> int: total_bricks_needed = 360 bricks_already_have = 80 bricks_per_pallet = 120 total_bricks_needed -= bricks_already_have pallets_to_buy = total_bricks_needed // bricks_per_pallet result = pallets_to_buy return result
Nathan gathered 90 seashells. Twenty-three of the seashells were white and purple, thirty-four of the seashells were orange and white, and thirty-three of the seashells were orange and purple. How many more seashells contained the color orange than contained the color white?
def solve() -> int: white_and_purple = 23 orange_and_white = 34 orange_and_purple = 33 total_white = white_and_purple + orange_and_white total_orange = orange_and_white + orange_and_purple difference = total_orange - total_white result = difference return result
A school is planning a field trip that costs $17 per student and $120 for the bus rental. If the total cost of the trip is $544, how many students can go on the trip?
def solve() -> int: total_cost = 544 bus_rental_price = 120 student_price = 17 num_students = (total_cost - bus_rental_price) // student_price result = num_students return result
The perimeter of a rectangle is 22 cm. The length is 3 cm larger than the width. What are the dimensions of this rectangle?
def solve() -> int: perimeter = 22 length = (perimeter - 6) / 2 width = length - 3 result = (length, width) return result
After doing their weekly shopping, John and Sue spent a total of $210. If John spent $120 more than Sue, how much did Sue spend?
def solve() -> int: total_spent = 210 difference = 120 sue_spent = total_spent - difference result = sue_spent return result
Lisa works as a receptionist and earns $7/hour. She works for five 9-hour shifts every week. On average, she receives a bonus worth $35 every day. Lisa is supposed to pay 18% of her earnings as taxes, but she only reports 2/3rd of her bonus to the IRS. What is the total amount of tax Lisa has to pay each week?
def solve() -> int: hourly_wage = 7 hours_per_shift = 9 num_shifts_per_week = 5 bonus_per_day = 35 bonus_reported_to_IRS = 2/3 weekly_wage = hourly_wage * hours_per_shift * num_shifts_per_week weekly_bonus = bonus_per_day * 5 * bonus_reported_to_IRS total_income = weekly_wage + week...
A company produced 4500 pieces in 3 hours. If they want to produce 6000 pieces, how many hours will it take?
def solve() -> int: pieces_per_hour = 4500/3 hours = 6000/pieces_per_hour result = hours return result
Emily needs to make 5 copies of a handbook for 8 participants in her workshop. The handbook is 18 pages long. How many pages will Emily copy in total?
def solve() -> int: handbook_pages = 18 participants = 8 copies = 5 total_pages = handbook_pages * copies result = total_pages return result
Lisa has a circular cake that has a diameter of 10 inches. She wants to cut it into 8 equal slices. What is the area of each slice in square inches? Use 3.14 as an approximation for pi.
def solve() -> int: area = 3.14 * (10 / 2) ** 2 slice_area = area / 8 slice_area = round(slice_area, 2) result = slice_area return result
Student: Janet has 500 books and wants to divide them up evenly among her 5 friends. How many books will each receive?
def solve() -> int: books = 500 friends = 5 result = books // friends return result
Sophie had 200 chocolates. She ate 50 chocolates. After that, her mother took half of the remaining chocolates to give to charity. Her mother gave her back 25 chocolates. How many chocolates does Sophie have now?
def solve() -> int: chocolates_start = 200 chocolates_eaten = 50 chocolates_remaining = chocolates_start - chocolates_eaten chocolates_given_away = chocolates_remaining / 2 chocolates_remaining = chocolates_remaining - chocolates_given_away + 25 result = chocolates_remaining return result
Every hour of last night Daniel played a video game. The first hour, he scored 100 points. Each hour after that, he scored 10% more points than the previous hour. How many points did he score on the ninth hour?
def solve() -> int: score = 100 for hour in range(2, 10): score *= 1.1 result = round(score) return result
Leah, Chloe, and Mason collect pencils. Leah had 51 pencils in her collection, Chloe had 43 pencils in her collection, and Mason had 37 pencils in his collection. Chloe gave Leah one fifth of her collection in exchange for a set of erasers, and then Mason traded Leah five mechanical pencils for one pen. How many pencil...
def solve() -> int: leah_pencils = 51 chloe_pencils = 43 mason_pencils = 37 leah_pencils += chloe_pencils // 5 chloe_pencils -= chloe_pencils // 5 leah_pencils += 5 * 5 mason_pencils -= 5 result = leah_pencils return result
Student: Sarah needs to buy a total of 15 notebooks for her classes. She has already bought 7 notebooks, but only 60% of them are suitable. If each notebook costs $2, how much will Sarah spend to buy the remaining notebooks?
def solve() -> int: total_notebooks = 15 bought_notebooks = 7 suitable_notebooks = bought_notebooks * 0.6 notebook_cost = 2 remaining_notebooks = total_notebooks - suitable_notebooks cost = remaining_notebooks * notebook_cost result = cost return result
A farmer has 400 meters of fencing and wants to enclose a rectangular field beside a river. If the farmer does not fence the side along the river, what is the largest area that can be enclosed?
def solve() -> int: length = 200 width = 400 - length area = length * width result = area return result
Max's grandmother is 7 times as old as Max's turtle. If in 8 years, Max's grandmother will be 84 years, how old is Max's turtle going to be in eight years?
def solve() -> int: grandmother_age = 84 - 8 turtle_age = grandmother_age / 7 turtle_age_in_eight_years = turtle_age + 8 result = turtle_age_in_eight_years return result
Luke has two delivery trucks. The first truck can carry 10 tons of goods and the second truck can carry 40% fewer goods but each load is 20% heavier. How much can be carried in total?
def solve() -> int: first_truck_capacity = 10 second_truck_capacity = first_truck_capacity * (1 - 0.4) second_truck_load = first_truck_capacity * 1.2 total_capacity = first_truck_capacity + second_truck_capacity total_load = first_truck_capacity + second_truck_load result = total_capacity + tota...
Alex wants to make a vegetable soup with either carrots or peppers. Carrots cost $2.00 per 8 ounces and Alex needs 24 ounces for his recipe. Peppers cost $1.50 per 8 ounces and Alex needs 32 ounces for his recipe. How much money would he save by using peppers instead of carrots?
def solve() -> int: carrots_price_per_ounce = 2 / 8 carrots_needed = 24 carrots_cost = carrots_price_per_ounce * carrots_needed peppers_price_per_ounce = 1.5 / 8 peppers_needed = 32 peppers_cost = peppers_price_per_ounce * peppers_needed savings = carrots_cost - peppers_cost ...
A factory produced 80 computers in 16 hours if it works 5 hours a day. How many computers did it produce in 4 days if it works 6 hours a day?
def solve() -> int: computers = 80 hours1 = 16 days2 = 4 hours2 = 6 result = computers * (days2 * hours2) / hours1 result = 160 return result
Eva has nine and two-thirds kilograms of flour. She uses one and one-sixth kilograms of flour to make a cake. How much flour does she have left in grams?
def solve() -> int: total_flour = 9 + 2/3 total_flour = total_flour * 1000 used_flour = 1 + 1/6 used_flour = used_flour * 1000 left_flour = total_flour - used_flour result = left_flour return result
A rectangular swimming pool has a length of 25 feet and a width of 15 feet. If the pool is filled with water to a depth of 8 feet, how many gallons of water are in the pool (assume one cubic foot of water is equivalent to 7.5 gallons)?
def solve() -> int: length = 25 width = 15 depth = 8 gallons_per_cubic_foot = 7.5 total_gallons = length * width * depth * gallons_per_cubic_foot result = total_gallons return result
Possible questions and programs: A car travels 230 miles on 9 gallons of gas in the city, and 320 miles on 10 gallons of gas on the highway. What is the average gas mileage, in miles per gallon, of the car?
def solve() -> int: city_mpg = 230 / 9 highway_mpg = 320 / 10 average_mpg = (city_mpg + highway_mpg) / 2 result = average_mpg return result
A company pays its employees $10 per hour for the first 40 hours of work in a week, and $15 per hour for any additional hours. If an employee works 50 hours in a week, how much money will they earn?
def solve() -> int: wage = (40*10) + (10*15) result = wage return result
Gina has 3 times as many stickers as Henry. If Gina has 27 stickers, how many stickers does Henry have?
def solve() -> int: num_ginas_stickers = 27 ratio_gina_to_henry = 3 num_henrys_stickers = num_ginas_stickers // ratio_gina_to_henry result = num_henrys_stickers return result
There are 620 color pencils in a cupboard. On Monday, 160 color pencils were given away to students. On Wednesday, 25 color pencils were broken and had to be thrown away. On Friday, another 30 color pencils were given away. How many color pencils are still in the cupboard?
def solve() -> int: num_pencils = 620 num_given1 = 160 num_broken = 25 num_given2 = 30 total_given = num_given1 + num_given2 result = num_pencils - total_given - num_broken return result
The monthly expenses of a family are 2000 dollars. If the expenses increase by 10% each year, what will be the family's monthly expenses in the second year?
def solve() -> int: expense_first_year = 2000 expense_second_year = expense_first_year * 1.1 result = expense_second_year return result
An item costs 120 dollars with a sales tax of 8%. What is the total cost of the item?
def solve() -> int: item_cost = 120 sales_tax_percent = 8 sales_tax = item_cost * (sales_tax_percent/100) total_cost = item_cost + sales_tax result = total_cost return result
A pizza parlor charges $12 for a medium pizza and $15 for a large pizza. If the grand total for an order of 2 medium pizzas and 1 large pizza is $39.50, what is the amount of tax charged if the tax rate is 8.5%?
def solve() -> int: medium_pizza_cost = 12 large_pizza_cost = 15 order_total = 39.50 num_medium_pizzas = 2 num_large_pizzas = 1 subtotal = (medium_pizza_cost*num_medium_pizzas) + (large_pizza_cost*num_large_pizzas) tax_rate = 0.085 tax_amount = subtotal * tax_rate result = tax_amount...
Student: Mia and Emma need to each buy a gift for their mother’s 45th birthday. Mia spends $50 on her gift. Emma spent $30 less than Mia. How much did they together spend on their mother’s birthday?
def solve() -> int: mias_gift = 50 emmas_gift = mias_gift - 30 total_amount = mias_gift + emmas_gift result = total_amount return result
Student: Jen ran for 8 miles at an average speed of 6 miles per hour, while Mark ran for 6 miles at an average of 8 miles per hour. How much longer did Mark's run take?
def solve() -> int: jen_distance = 8 jen_speed = 6 mark_distance = 6 mark_speed = 8 jen_time = jen_distance / jen_speed mark_time = mark_distance / mark_speed time_difference = mark_time - jen_time time_difference_minutes = time_difference * 60 result = time_difference_minute...
================================================= Some possible questions and programs are: Maya likes to collect stickers. She has 180 stickers in her album, and she wants to fill it up with 250 stickers. She buys 3 packs of stickers, each with 12 stickers inside. How many more stickers does she need to buy to complet...
def solve() -> int: stickers_bought = 3 * 12 stickers_after_buying = 180 + stickers_bought stickers_needed = 250 - stickers_after_buying result = stickers_needed return result
Mia's family went camping and they wanted to buy some supplies. They got a tent for $50, a sleeping bag for $25, 4 flashlights for $5 each, and 3 airbeds for $15 each. When they left the store, they had $30 left. How much money did they bring with them when they entered the store?
def solve() -> int: money = 30 items = 50 + 25 + 5 * 4 + 15 * 3 result = money + items return result
A shipping company charges a base rate of $4.50 plus $0.60 per pound for packages under 10 pounds. For packages 10 pounds or heavier, the company charges $12.50 plus $0.90 per pound. If Janice wants to send a package that weighs 8 pounds, how much will she have to pay for shipping?
def solve() -> int: weight = 8 if weight < 10: shipping_cost = 4.50 + (0.60 * weight) else: shipping_cost = 12.50 + (0.90 * weight) result = shipping_cost return result
Amy buys 5 pants for her kids. The price for each pant is $32 and she gets a 25 percent discount on her total purchase. How much money does she spend in total?
def solve() -> int: pants_amount = 5 pants_price = 32 discount = 0.25 total_price = pants_amount * pants_price * (1 - discount) result = total_price return result
The price of a single movie ticket is 11.50. If the total spent on tickets was $287, how many tickets were purchased?
def solve() -> int: price_per_ticket = 11.50 total_cost = 287 num_tickets = total_cost/price_per_ticket result = num_tickets return result
If Michael adds 10 teaspoons of sugar and 20 teaspoons of water to a pitcher, but spills 2 teaspoons of water, then doubles the amount of sugar in the pitcher, what percent of the pitcher's total volume is sugar?
def solve() -> int: sugar_added = 10 water_added = 20 water_spilled = 2 total_volume = sugar_added + water_added - water_spilled doubled_sugar = sugar_added * 2 sugar_percent = (doubled_sugar / total_volume) * 100 result = sugar_percent return result
Five friends each order a personal pan pizza cut into 4 pieces. If 1 person eats 50% of their pizza, 2 people eat 25% of their pizza, and the remaining 2 people eat 75% of their pizza, how many pizza pieces are left uneaten?
def solve() -> int: whole_pizza = 1 pieces_per_pizza = 4 total_pizzas = 5 pizza_pieces = total_pizzas * pieces_per_pizza one_eats = whole_pizza * 0.5 two_eats = 2 * whole_pizza * 0.25 two_eats2 = 2 * whole_pizza * 0.75 total_eaten = one_eats + two_eats + two_eats2 remaining = pizza_p...
Chris has 5 coins in his pocket: 2 quarters, 1 dime, 1 nickel, and 1 penny. He buys a candy bar that costs $0.65. How much money does he have left in his pocket?
def solve() -> int: total_value = 2 * 0.25 + 1 * 0.1 + 1 * 0.05 + 1 * 0.01 money_left = total_value - 0.65 result = money_left return result
At the pet store, I need to buy enough food for myMaggie wants to make a profit of $900 by selling 300 t-shirts. If she buys each t-shirt for $8, what price does she need to sell them for?
def solve() -> int: cost_per_tshirt = 8 number_of_tshirts = 300 profit = 900 total_cost = cost_per_tshirt * number_of_tshirts selling_price = (total_cost + profit) / number_of_tshirts result = selling_price return result
Sarah drove 150 miles. Daniel drove 200 kilometers and Rachel drove 0.5 miles. How many combined kilometers did they drive?
def solve() -> int: miles_to_kilometers = 1.60934 sarah_miles = 150 daniel_kilometers = 200 rachel_miles = 0.5 sarah_kilometers = sarah_miles * miles_to_kilometers rachel_kilometers = rachel_miles * miles_to_kilometers combined_kilometers = sarah_kilometers + daniel_kilometers + ra...
A company sells a product for $12 per unit. If the fixed costs are $600 and the variable costs are $4 per unit, how many units does the company need to sell to break even?
def solve() -> int: unit_price = 12 fixed_cost = 600 variable_cost = 4 break_even_point = fixed_cost / (unit_price - variable_cost) result = break_even_point return result
Nicole and her friend Isabella are organizing a clothing swap. Nicole has 42 items, 2/3 of which are tops. Isabella has half as many tops as Nicole and 7 more pairs of pants than Nicole. How many items in total do the two have?
def solve() -> int: nicole_items = 42 nicole_tops = (2/3) * nicole_items isabella_tops = nicole_tops / 2 isabella_pants = nicole_items / 2 + 7 total_items = nicole_items + isabella_tops + isabella_pants result = total_items return result
A college student spent 2 hours studying for a science test and 3 hours studying for a math test. If the science test was worth 60% of the overall grade and the math test was worth 40%, what percentage of the overall grade did the student spend studying?
def solve() -> int: science_hours = 2 math_hours = 3 science_weight = 0.6 math_weight = 0.4 total_weight = science_weight + math_weight science_weighted_hours = science_hours * science_weight math_weighted_hours = math_hours * math_weight total_weighted_hours = science_weighted_hours + m...
David had 200 books in his collection. He gave away 10% of them to his friends and donated 20% of them to a library. How many books did he have left?
def solve() -> int: books_to_friends = 0.1 * 200 books_to_library = 0.2 * 200 books_left = 200 - books_to_friends - books_to_library result = books_left return result
The ratio of adults to children in a picnic is 5:8. If a total of 112 people attended the picnic, how many more children than adults attended?
def solve() -> int: adults = 112 * 5 / 13 children = 112 * 8 / 13 result = children - adults return result
Ethan orders 1000 cans of paint for his hardware store, which is four times the number of cans he has in stock. After selling 60% of his total stock, his father buys 500 more cans and then sells 300. What is the final number of cans of paint in the store?
def solve() -> int: x = 1000 / 4 total_cans = x + 1000 sold_cans = total_cans * 0.6 remaining_cans = total_cans - sold_cans remaining_cans += 500 remaining_cans -= 300 result = remaining_cans return result
Kobe had $685, he used 1/3 of his money and now he has $482 left. How much did he spend?
def solve() -> int: starting_amount = 685 ending_amount = 482 money_spent = starting_amount - ending_amount result = money_spent return result
An amusement park charges $20 per ticket. If a family of 4 visits the park, and buys 2 souvenirs for $10 each, how much money do they spend?
def solve() -> int: ticket_cost = 20*4 souvenir_cost = 10*2 total_cost = ticket_cost + souvenir_cost result = total_cost return result
Bella bakes cookies for a school fundraiser. She bakes 24 cookies in the first batch, 18 cookies in the second batch, and 30 cookies in the third batch. She uses 3 eggs for each batch of cookies. How many eggs does Bella use in total?
def solve() -> int: total_eggs = 0 for batch in range(1, 4): total_eggs = total_eggs + 3 result = total_eggs return result
If a train travels 640 miles in 8 hours, how far can it go in 24 hours travelling at the same speed?
def solve() -> int: distance_in_8_hours = 640 distance_in_24_hours = distance_in_8_hours * 3 result = distance_in_24_hours return result
Evan has to build a park bench using wood boards. Each wood board is 4 feet long, and he needs 6 boards. How many feet of wood does Evan need for the park bench?
def solve() -> int: number_boards = 6 length_board = 4 total_length_wood = number_boards * length_board result = total_length_wood return result
A retailer reduces the prices of their products by 25%. If a product originally costs $48, how much would it cost after the discount is applied?
def solve() -> int: original_price = 48 discount_percentage = 25 discount_amount = original_price * (discount_percentage / 100) final_price = original_price - discount_amount result = final_price return result
A rectangle has a length of 8 and width of 4. What is the perimeter of the rectangle?
def solve() -> int: length = 8 width = 4 perimeter = (2 * length) + (2 * width) result = perimeter return result
Every year, Eric adds a new recipe to his cookbook. He started this tradition when he was 30 years old, which was the year he added his second recipe. In five years, Eric will have 12 different recipes in his cookbook. What is Eric’s current age?
def solve() -> int: age_when_started = 30 recipes_added_when_started = 2 years_passed = 5 recipes_added_in_five_years = 12 total_recipes_added = recipes_added_in_five_years - recipes_added_when_started current_age = age_when_started + years_passed + total_recipes_added result = cur...
Jack has 36 toy cars in his collection. If he gives away 9 cars to his friends, how many toy cars does he have now?
def solve() -> int: toy_cars = 36 cars_given_away = 9 remaining_cars = toy_cars - cars_given_away result = remaining_cars return result
A car travels 60 miles per hour for 3 hours. How far did the car travel in total?
def solve() -> int: speed = 60 time = 3 distance = speed * time result = distance return result
A box has dimensions of 12 inches by 10 inches by 8 inches. What is the volume of the box in cubic inches?
def solve() -> int: length = 12 width = 10 height = 8 volume = length * width * height result = f'{volume}' result = volume return result
The sum of two numbers is 36. If the difference between the two numbers is 14, what is the value of the larger number?
def solve() -> int: sum_of_two_numbers = 36 difference_of_two_numbers = 14 larger_number = (sum_of_two_numbers + difference_of_two_numbers) / 2 result = larger_number return result
A box contains red and green marbles. The ratio of red marbles to green marbles is 3:5. If the box contains a total of 80 marbles, how many red marbles are there?
def solve() -> int: total_marbles = 80 ratio_red = 3 ratio_green = 5 total_ratio = ratio_red + ratio_green red_marbles = total_marbles * ratio_red / total_ratio result = red_marbles return result
Student: If a box is 25 cm wide and 15 cm long, how much area does it have?
def solve() -> int: width = 25 length = 15 area = width * length result = area return result