question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A company sells 3000 pencils per month at $0.50 each. The company decides to increase the price by 20 cents. If the company sells 2000 pencils per month at the new price, how much more revenue do they make in a month from selling pencils?
def solve() -> int: old_price = 0.5 new_price = old_price + 0.2 old_quantity = 3000 new_quantity = 2000 old_revenue = old_price * old_quantity new_revenue = new_price * new_quantity difference_in_revenue = new_revenue - old_revenue result = difference_in_revenue return result
Sophia has a laptop that can last for 6 hours on a full charge. It takes her 45 minutes to write a page of a report. Sophia wants to write a report of 60 pages. How many times does Sophia need to charge her laptop to complete the report?
def solve() -> int: hours_per_charge = 6 minutes_per_page = 45 pages = 60 time_per_charge = hours_per_charge * 60 pages_per_charge = time_per_charge / minutes_per_page total_charges = pages / pages_per_charge result = round(total_charges) return result
A group of students are going to the park, each student has to buy 3 balloons each. If the group consists of 15 students, how many balloons do they need to buy in total?
def solve() -> int: students = 15 balloons_per_student = 3 total_balloons = students * balloons_per_student result = total_balloons return result
In a classroom, the ratio of boys to girls is 4:3. If there are 28 students in the classroom, how many boys are there?
def solve() -> int: total_ratio = 4+3 boys_ratio = 4 total_students = 28 boys = (boys_ratio/total_ratio) * total_students result = int(boys) return result
Student: In a garden, there are 18 short flowers and 36 tall flowers. How many more tall flowers than short flowers are there?
def solve() -> int: short_flowers = 18 tall_flowers = 36 difference = tall_flowers - short_flowers result = difference return result
Ben is saving money for a new laptop. He already has 120 dollars and he earns 15 dollars per hour by doing chores. He needs 300 dollars more to buy the laptop. How many hours of chores does he need to do to get enough money for the laptop?
def solve() -> int: money_has = 120 money_earns = 15 money_needs = 300 money_left = money_needs - money_has hours_chores = money_left / money_earns result = hours_chores return result
A pizza place offers one large 16-inch pizza for $14 and a small 10-inch pizza for $8. Lisa wants to buy 3 large pizzas and 4 small pizzas. What is the total cost?
def solve() -> int: large_pizza_price = 14 small_pizza_price = 8 large_pizzas = 3 small_pizzas = 4 total_cost = (large_pizza_price*large_pizzas) + (small_pizza_price*small_pizzas) result = total_cost return result
Wendy dug a rectangular hole in her backyard with a width of 5 ft and a length of 13 ft. How much dirt did Wendy dig out of the hole?
def solve() -> int: width = 5 length = 13 area = width*length volume = area*0.5 result = volume return result
A teacher grades her students on a scale from 0 to 100. If a student got a grade of 65, what is the percentage of their score?
def solve() -> int: score = 65 percentage = (score / 100) * 100 result = percentage return result
Rachel is a jewelry maker. She can sell each necklace for $35. A bag of beads weighs 15 pounds and costs $5. Each necklace will require 3 pounds of beads. If she makes $175 profit from selling necklaces, how many did she sell?
def solve() -> int: beads_bag_weight = 15 beads_bag_cost = 5 necklace_price = 35 beads_per_necklace = 3 cost_per_pound = beads_bag_cost / beads_bag_weight cost_per_necklace = beads_per_necklace * cost_per_pound profit_per_necklace = necklace_price - cost_per_necklace num_necklaces =...
If the speed limit on a highway is 65 mph, what is the speed in feet per second?
def solve() -> int: speed_limit = 65 feet_per_mile = 5280 seconds_per_hour = 3600 feet_per_second = speed_limit * feet_per_mile / seconds_per_hour result = feet_per_second return result
-The python program that you write should be syntatically correct! Some possible questions are: - Lily has 10 candies and she wants to share them with her 4 friends. She gives 2 candies to each of her friends and keeps the rest for herself. How many candies does she have left?
def solve() -> int: candies = 10 friends = 4 candies_given = 2 * friends candies_left = candies - candies_given result = candies_left return result
Dave's age is twice the age of Gloria's age. If Gloria is 21, how old is Dave?
def solve() -> int: gloria_age = 21 dave_age = 2 * gloria_age result = dave_age return result
A library has 5,000 books, 70% of the books are fiction and 30% of the books are non-fiction. If 20% of the non-fiction books have been loaned out, how many books remain in the library?
def solve() -> int: total_books = 5000 percent_fiction = 0.7 fiction_books = total_books * percent_fiction non_fiction_books = total_books - fiction_books loaned_books_amount = non_fiction_books * 0.2 remaining_books_amount = total_books - loaned_books_amount result = remaining_books_amount ...
Andy is saving up for a new bike. He puts aside $20 for the bike each month for 6 months. He also has a $50 bonus from his job. What is the probability, expressed as a percentage, that he will have enough money to buy the bike after 6 months?
def solve() -> int: initial_saved = 50 monthly_save = 20 months = 6 total_saved = initial_saved + months * monthly_save total_needed = 200 result = (total_saved / total_needed) * 100 return result
Jerry has 15 toys. His grandparents bring him a box of 45 toys. During the month, Jerry donates one-seventh of his total amount of toys to a local charity. How many toys does Jerry have left?
def solve() -> int: toys_jerry = 15 toys_grandparents = 45 total_toys = toys_jerry + toys_grandparents donated_toys = total_toys / 7 toys_left = total_toys - donated_toys result = toys_left return result
-Use X to replace the number for each question. Leo bought 12 pencils for himself and gave half of them to Maya. Then he bought another 8 pencils and gave one-third of them to Maya. How many pencils does Leo have now?
def solve() -> int: leo = 12 maya = 0 leo = leo - 6 maya = maya + 6 leo = leo + 8 leo = leo - round(14 / 3) maya = maya + round(14 / 3) result = leo return result
Madison weighed 50 pounds on her first day of school. In one year, she gained 40 percent of her original weight. How much does she weigh now (in pounds)?
def solve() -> int: original_weight = 50 percent_gain = 0.4 weight_in_one_year = original_weight + (original_weight * percent_gain) result = weight_in_one_year return result
Ethan bought some books and pencils for his classmates. Each book costs $12 and each pencil box costs $7. If he spent $143 in total, how many pencil boxes did he buy?
def solve() -> int: cost_books = 12 cost_pencils = 7 total_cost = 143 num_pencils = (total_cost - cost_books)/cost_pencils result = num_pencils return result
A rectangle has a length of 8 meters and a width of 5 meters. What is the area of the rectangle?
def solve() -> int: length = 8 width = 5 area = length*width result = area return result
arah wants to buy a new phone that costs $500. She has already saved $250. If she saves $25 every week, how long will it take her to save enough money to buy the phone?
def solve() -> int: phone_price = 500 saved_money = 250 weekly_savings = 25 remaining_money = phone_price - saved_money weeks_to_save = remaining_money/weekly_savings result = weeks_to_save return result
Ella has 8 books more than three quarters the number of books that Fred has. Fred has 12 books less than five sixths the number of books that Grace has. If Grace has 54 books, calculate the total number of books they all have.
def solve() -> int: gr = 54 fr = 5 * gr / 6 - 12 el = 3 * fr / 4 + 8 total = sum([gr, fr, el]) result = total return result
A rectangular prism has a height of 3 meters, a width of 2 meters, and a length of 4 meters. What is the volume of the prism?
def solve() -> int: height = 3 width = 2 length = 4 volume = height * width * length result = volume return result
A group of friends went out for dinner and the total bill came to $125. They decided to split the bill evenly between the group and also leave a 20% tip. How much does each person owe?
def solve() -> int: bill = 125 tip_percentage = 0.2 num_people = 5 total_cost = bill * (1 + tip_percentage) cost_per_person = total_cost / num_people result = cost_per_person return result
Leo has 90 candies. If 1/6 of them are chocolates and 3/7 are gummies, how many are neither chocolates nor gummies?
def solve() -> int: num_chocolates = (1/6) * 90 num_gummies = (3/7) * 90 num_other = 90 - num_chocolates - num_gummies result = num_other return result
At a restaurant, there were 22 parties that each had 6 people. One group of 4 people did not order any drinks. How many drinks were ordered?
def solve() -> int: people = 22*6 people_without_drink = 4 total_drink_ordered = people - people_without_drink result = total_drink_ordered return result
If a square has a side length of 8 cm, what is its area?
def solve() -> int: side_length = 8 area = side_length * side_length result = area return result
John and Sally are planning to purchase a house for $300,000. They will pay 20% as a down payment and take a loan for the rest of the amount. What is the final amount of the loan?
def solve() -> int: house_price = 300000 down_payment_rate = 0.2 down_payment = down_payment_rate * house_price loan_amount = house_price - down_payment result = loan_amount return result
Maria wants to buy a new car that costs $27,000. She can afford to pay $500 every month but also wants to have the car paid off within 3 years. What interest rate can Maria afford to get if she wants to finance the car?
def solve() -> int: car_cost = 27000 monthly_payment = 500 months_to_pay_off = 36 interest_rate = ((car_cost - (monthly_payment * months_to_pay_off)) / car_cost) * 100 result = interest_rate return result
A bunch of 57 grapes are shared equally among 4 people. How many grapes will each person get?
def solve() -> int: grapes = 57 people = 4 each_person = grapes // people result = each_person return result
A recipe requires 1/4 teaspoon of salt for every 2 cups of water. If you are making 8 cups of water, how much salt do you need to add to the recipe?
def solve() -> int: salt_per_cup = 1/8 water = 8 salt = salt_per_cup * water result = salt return result
Amy and Ben share a pizza that has 8 slices. Amy eats 3 slices and Ben eats 4 slices. How many slices of pizza are left?
def solve() -> int: total_slices = 8 amy_slices = 3 ben_slices = 4 slices_left = total_slices - amy_slices - ben_slices result = slices_left return result
Tom is preparing for a camping trip. He needs three types of gear: a tent, a sleeping bag, and a stove. Each stove lasts for 6 times as many days as each sleeping bag, and each tent lasts half as many days as each sleeping bag. If each sleeping bag lasts for 4 days, and he needs to stay for a total of 24 days, how many...
def solve() -> int: sleeping_bag = 4 stove = sleeping_bag * 6 tent = sleeping_bag / 2 total_days = 24 total_gear_days = stove + sleeping_bag + tent gear_ratio = total_days / total_gear_days sleeping_bag_days = sleeping_bag * gear_ratio stove_days = stove * gear_ratio tent_d...
A electronics shop pays $500 for 750 items and adds a 40% markup. They give a 15% discount on the original price and sell 60% of the inventory. They must pay a sales tax of 10%. How much money do they have left?
def solve() -> int: cost = 500 num_units = 750 markup = 0.4 discount = 0.15 num_sold = 0.6 * num_units sales_tax = 0.1 gross_revenue = (cost + (cost*markup)) * num_sold discount_owed = gross_revenue * discount tax_owed = (gross_revenue - discount_owed) * sales_tax net_revenu...
It takes Kyle 5 hours to complete a 500-piece puzzle, while Jessica can do it in 4 hours. If Kyle puts together 40 pieces per hour, what is Jessica's puzzle-solving rate (in pieces per hour)? John walks 4 blocks north, then five times as many blocks east. Then he turns around and walks 12 blocks south and three times a...
def solve() -> int: kyle_time = 5 jessica_time = 4 kyle_rate = 40 jessica_rate = 500 / jessica_time jessica_rate = jessica_rate john_distance = 4 + 5*4 + 12 + 3*5 john_time = john_distance / 3 result = jessica_rate return result
Ben has a rectangular garden that measures 15 feet by 12 feet. He wants to fence the entire garden with a wire that costs $0.5 per foot. He also wants to leave a 3-foot gap for a gate. How much will he spend on the wire?
def solve() -> int: perimeter = 15 + 15 + 12 + 12 wire_length = perimeter - 3 wire_cost = wire_length * 0.5 result = wire_cost return result
A garden is 20 feet long and 15 feet wide. What is the perimeter of the garden in feet?
def solve() -> int: perimeter = 2*(20 + 15) result = perimeter return result
In a basketball game, Jack scored three times as many points as Max, who scored twice as many points as Tom. If Tom scored 6 points, how many points did Jack score?
def solve() -> int: tom_score = 6 max_score = tom_score * 2 jack_score = max_score * 3 result = jack_score return result
A car has a fuel tank with a capacity of 40 liters. One day, the car traveled 240 km with 20 liters of fuel. How many more liters of fuel does the car need to travel 100 km?
def solve() -> int: fuel_tank = 40 distance_traveled = 240 fuel_consumed = 20 fuel_per_km = fuel_consumed / distance_traveled fuel_for_100km = fuel_per_km * 100 extra_fuel_needed = fuel_for_100km - fuel_consumed result = extra_fuel_needed return result
Brandon is managing a restaurant. The kitchen started the day with 15 orders. Later in the day, 7 more orders were added and 4 orders were completed. How many orders are left to be completed?
def solve() -> int: orders_start = 15 orders_added = 7 orders_completed = 4 orders_left = orders_start + orders_added - orders_completed result = orders_left return result
Alex has to run 2 miles every day, but for every 90 minutes of running, he has to do his homework for 75 minutes. If he runs for 3 hours, how many minutes does he have to spend on doing his homework? In a zoo, there are 5 times more zebras than giraffes. If there are 15 giraffes in the zoo, how many zebras and giraffes...
def solve() -> int: daily_distance = 2 running_time = 180 homework_time = (running_time // 90) * 75 total_homework_time = homework_time giraffes = 15 zebras = giraffes * 5 total_animals = giraffes + zebras result = total_homework_time + total_animals ...
Zoe paid $18 for 5 dozen apples and 3 bunches of bananas. How much does a dozen of apples cost?
def solve() -> int: total_price = 18 bananas_price = 3 num_bananas = 3 * 1 num_apples = 5 * 12 result = (total_price - (num_bananas * bananas_price)) / num_apples return result
Student: A recipe requires 2 cups of flour to make 10 cookies. If you only have 1 cup of flour, how many cookies can you make?
def solve() -> int: flour_needed_per_cookie = 2/10 flour_available = 1 cookies_possible = flour_available/flour_needed_per_cookie result = cookies_possible return result
Emma wants to buy books for her library. Each book costs $12. She has $180. How many books can she buy?
def solve() -> int: book_cost = 12 total_money = 180 num_books = total_money // book_cost result = num_books return result
A recipe for a cake requires 3 cups of flour, 2 cups of sugar, 4 eggs, and 1/2 cup of oil. How many cakes can be made with 15 cups of flour, 12 cups of sugar, 20 eggs, and 4 cups of oil?
def solve() -> int: flour_cakes = 15 / 3 sugar_cakes = 12 / 2 eggs_cakes = 20 / 4 oil_cakes = 4 / 0.5 max_cakes = min(flour_cakes, sugar_cakes, eggs_cakes, oil_cakes) result = max_cakes return result
Student: Brian can run 1 km in 5 minutes. How much time will it take him to run 6 km?
def solve() -> int: distance = 6 time_per_km = 5 total_time = distance * time_per_km result = total_time return result
Possible math questions and python programs: Tala has 6 stickers, while Leila has twice as many stickers as Tala. If Tala gave 2 of her stickers to Leila, how many stickers did Leila have then?
def solve() -> int: tala = 6 leila = 2 * tala tala = tala - 2 leila = leila + 2 result = leila return result
Student: Simon lost 10 kilograms every year for 4 years, while Bella lost 5 kilograms every year for 4 years. How many more kilograms did Simon lose than Bella?
def solve() -> int: simon_weight_lost = 10 bella_weight_lost = 5 simon_total_weight_lost = simon_weight_lost * 4 bella_total_weight_lost = bella_weight_lost * 4 difference = simon_total_weight_lost - bella_total_weight_lost result = difference return result
A store receives a shipment of 300 shirts. If they sell 40 percent of them, and then receive another shipment of 200 shirts, what is the total number of shirts remaining in the store?
def solve() -> int: shirts_received = 300 shirts_sold = shirts_received * 0.4 shirts_remaining1 = shirts_received - shirts_sold shirts_remaining2 = shirts_remaining1 + 200 result = shirts_remaining2 return result
Adam and his brother Brad are running on a track. Brad runs at the same speed as Adam, who runs 9 miles per hour. After running 2 miles, Adam realizes he left his watch at home and runs back to get it. If they were supposed to run together for a total of 10 miles, how much longer does Adam spend running compared to Bra...
def solve() -> int: adam_speed = 9 distance_run = 2 total_distance = 10 time_spent = distance_run / adam_speed distance_left = total_distance - distance_run time_spent_running_back = distance_left / adam_speed time_difference = time_spent_running_back - time_spent ...
A truck used 150 liters of fuel to travel 450 km. How many liters of fuel will it use to travel 1200 km?
def solve() -> int: distance_given = 450 fuel_given = 150 distance_needed = 1200 fuel_needed = (distance_needed / distance_given) * fuel_given result = fuel_needed return result
ome possible questions and programs are: Kelly makes 12 cookies each day for 10 days. She gives 2 cookies to her friend every day. She then sells 6 cookies to a customer. If 8 cookies fit in each bag, how many bags can Kelly fill with her cookies?
def solve() -> int: left = 12 * 10 - 2 * 10 - 6 bags = left // 8 result = bags return result
A box is filled with 800 balls. 45% of the balls are red and the rest are blue. How many blue balls are there?
def solve() -> int: total_balls = 800 percentage_red = 45 percentage_blue = 100 - percentage_red blue_balls = (percentage_blue/100) * total_balls result = blue_balls return result
A cake recipe calls for 3 cups of flour, 2 cups of sugar, and 4 eggs. How much flour, sugar, and eggs are needed to make 6 cakes?
def solve() -> int: flour_needed = 3 * 6 sugar_needed = 2 * 6 eggs_needed = 4 * 6 result = (flour_needed, sugar_needed, eggs_needed) return result
A rectangle has a length of 10 inches and a width of 6 inches. What is the perimeter of the rectangle?
def solve() -> int: length = 10 width = 6 perimeter = 2 * length + 2 * width result = perimeter return result
Emma is trying to save up money for a new bicycle. She currently has $50 and she wants to save around $450 to buy the bike. Her parents will pitch in $100 when she has saved that much. How much money will Emma need to save on her own to get enough money to buy the bike?
def solve() -> int: initial_savings = 50 total_savings = 450 parent_savings = 100 emma_savings = total_savings - parent_savings - initial_savings result = emma_savings return result
Tony is a beginner swimmer and he swims on average 5 laps in a 32-meter pool each day. How many meters did he swim in a week?
def solve() -> int: laps_per_day = 5 pool_length = 32 total_laps_per_week = laps_per_day * 7 pool_distance_per_week = pool_length * total_laps_per_week result = pool_distance_per_week return result
There are 5 times as many bees as there are butterflies in a garden. There are 30 butterflies. How many insects are in the garden?
def solve() -> int: bees = 30 * 5 insects = bees + 30 result = insects return result
If Mark's monthly income is $5000 and he spends 40% of it on transportation while 20% of his transportation budget is spent on gas, how much does he spend on gas each month?
def solve() -> int: monthly_income = 5000 transportation_budget = monthly_income * 0.4 gas_spending = transportation_budget * 0.2 result = gas_spending return result
A carpenter is making tables and chairs for a school. Each table requires 4 planks of wood and each chair requires 2 planks of wood. If the carpenter has 100 planks of wood, how many tables and chairs can he make at most?
def solve() -> int: tables = 100 // 4 remaining = 100 % 4 chairs = remaining // 2 result = (tables, chairs) return result
A rectangular prism has a width of 5 cm, a length of 7 cm, and a height of 9 cm. What is its volume in cubic centimeters?
def solve() -> int: width = 5 length = 7 height = 9 volume = width * length * height result = volume return result
Student: If a basketball player has made 80 out of 100 shots, what is their shooting percentage?
def solve() -> int: shots_made = 80 shots_attempted = 100 shooting_percentage = shots_made / shots_attempted * 100 result = shooting_percentage return result
The surface area of a cylinder is 616.39 inches squared. If the height of the cylinder is 10 inches, what is the circumference of its base?
def solve() -> int: surface_area = 616.39 height_cylinder = 10 vol_cylinder= 3.14 * height_cylinder * (surface_area/3.14) radius_base = vol_cylinder / (2 * 3.14 * height_cylinder) circumference = 2 * 3.14 * radius_base result = circumference return result
Student: There are 12 students in a class. Each student will be given the same number of notebooks to use for school. If the teacher has 100 notebooks in total how many notebooks will each student receive?
def solve() -> int: num_students = 12 total_notebooks = 100 notebooks_per_student = total_notebooks / num_students result = notebooks_per_student return result
Possible questions and programs are: In a trivia game, Ali has 36 points and Zara has 15 points less than him. How many more points does Ali need to double the sum of their scores?
def solve() -> int: zara = 36 - 15 sum = 36 + zara target = sum * 2 difference = target - 36 result = difference return result
Karen has 45 coins, and she gave 25 coins away to her friend. How many coins does Karen have left?
def solve() -> int: coins = 45 coins_given_away = 25 coins_remaining = coins - coins_given_away result = coins_remaining return result
Lisa has 26 marbles and loses 5 while walking to her friend's house. She finds 3 more marbles on the way and gives 10 to her friend. How many marbles does Lisa have now?
def solve() -> int: marbles_start = 26 marbles_lost = 5 marbles_found = 3 marbles_given = 10 marbles_now = marbles_start - marbles_lost + marbles_found - marbles_given result = marbles_now return result
Angela has $145 in her savings account. She wants to buy a new bike for $72. How much money will she have left in her account after she buys the bike?
def solve() -> int: savings_account = 145 bike_cost = 72 money_left = savings_account - bike_cost result = money_left return result
Alice and Bob are making cookies for a bake sale. Alice can make 12 cookies in an hour and Bob can make 8 cookies in an hour. They start working at 9 am and finish at 12 pm. During this time, they also take a 15-minute break and eat 3 cookies each. How many cookies do they have for the bake sale?
def solve() -> int: alice_rate = 12 bob_rate = 8 hours = 3 cookies_before_break = alice_rate * hours + bob_rate * hours cookies_eaten = 3 * 2 cookies_after_break = alice_rate * 0.75 + bob_rate * 0.75 cookies = cookies_before_break + cookies_after_break - cookies_eaten ...
- A rectangular garden has a length of 18 meters and a width of 12 meters. A gardener wants to plant roses along the perimeter of the garden, leaving a gap of 0.5 meters between each rose. How many roses does the gardener need?
def solve() -> int: perimeter = (18 + 12) * 2 distance = perimeter - 0.5 roses = distance / (0.5 + 0.5) result = roses return result
A toy train set has 12 pieces. If each piece is $2, how much will it cost to buy the entire set?
def solve() -> int: price_per_piece = 2 total_pieces = 12 total_cost = price_per_piece * total_pieces result = total_cost return result
Jane has twice as many pencils as pens. If she has 24 pencils, how many pens does she have?
def solve() -> int: pencils = 24 pens = pencils / 2 result = pens return result
A candy store sells lollipops, gummies, and chocolates. A lollipop costs $0.25, a gummy costs $0.10, and a chocolate costs $0.50. A customer buys 20 lollipops, 15 gummies, and 10 chocolates. How much change does the customer get from a $20 bill?
def solve() -> int: lollipops = 20 lollipop_price = 0.25 gummies = 15 gummy_price = 0.10 chocolates = 10 chocolate_price = 0.50 bill = 20 total_cost = lollipops * lollipop_price + gummies * gummy_price + chocolates * chocolate_price change = bill - total_cost resul...
A garden measuring 8 meters by 10 meters needs to be surrounded by a fence. If fencing is sold by the meter, how much fencing is needed and how much will it cost if the per meter cost of fencing is $5?
def solve() -> int: length = 8 width = 10 perimeter = 2 * (length + width) cost_per_meter = 5 total_cost = perimeter * cost_per_meter result = total_cost return result
Emily is playing roulette and starts with $250. She wins 2 rounds in a row, earning $90 in total and decides to bet her winnings on the next round. She ends up losing everything and owes her friends $40. How much money did Emily lose in all?
def solve() -> int: initial_money = 250 winning_amount = 90 total_money = initial_money + winning_amount final_money = total_money - winning_amount total_loss = final_money - initial_money + 40 result = total_loss return result
A pizza has 12 slices of pepperoni pizza. If Mary divided the pizza equally among 4 friends, how many slices of pizza does each friend get?
def solve() -> int: num_slices = 12 num_friends = 4 result = num_slices / num_friends return result
James loves to cycle. He tries to cycle at least 50 miles in one day. Every seventh day, he cycles twice that distance. If he were able to keep up with his resolution, how many miles would he cycle during 2 months?
def solve() -> int: days_in_2_months = 2 * 30 miles_per_day = 50 miles_per_seventh_day = 2 * miles_per_day total_miles = (days_in_2_months // 7) * miles_per_seventh_day + (days_in_2_months % 7) * miles_per_day result = total_miles return result
Possible questions and programs: Raul bought a new laptop for $875 and a printer for $135. He also paid $40 for a warranty and $15 for shipping. Naomi bought a tablet for $399 and a keyboard for $59. She also paid $25 for a warranty and $10 for shipping. How many more dollars did Raul spend on his purchases?
def solve() -> int: raul_laptop = 875 raul_printer = 135 raul_warranty = 40 raul_shipping = 15 naomi_tablet = 399 naomi_keyboard = 59 naomi_warranty = 25 naomi_shipping = 10 raul_total = raul_laptop + raul_printer + raul_warranty + raul_shipping naomi_total = naomi_tablet + ...
A rectangular room is 10 feet long, 8 feet wide, and 6 feet high. How many cubic feet of air does it contain?
def solve() -> int: length = 10 width = 8 height = 6 volume = length * width * height result = volume return result
A bakery sells cakes for $18 each. If the bakery sells 10 cakes in one day, how much money will they make?
def solve() -> int: cake_price = 18 num_cakes = 10 total_money = cake_price*num_cakes result = total_money return result
A ship loaded with cargo containers sets sail. The crew counts 60 empty containers, and twice as many containers full of cargo. How many full cargo containers are aboard the ship?
def solve() -> int: empty_containers = 60 full_containers = empty_containers * 2 result = full_containers return result
Emily’s rent is $1000 per month. Her first month, she got a promotional rate of $100 off. However, in the fourth month her landlord raised the rent by $50 per month. How much did Emily pay in the first 6 months for rent?
def solve() -> int: rent_per_month = 1000 promotional_rate = 100 rent_after_promotion = rent_per_month - promotional_rate rent_after_3_months = rent_after_promotion * 3 rent_after_4_months = rent_after_3_months + 50 rent_after_6_months = rent_after_4_months * 2 result = r...
Max had saved up $800 from his summer job. He made a bet with his sister that he could run a mile in under five minutes. If Max won the bet and they agreed to give the winner four times the amount of money Max had saved, how much money did Max have after winning the bet?
def solve() -> int: savings = 800 bet_winnings = 4 * savings total_money = savings + bet_winnings result = total_money return result
Jamie is taking a class that costs $100 every two weeks. In four weeks, she spent $125 on the course. How much extra money did Jamie spend?
def solve() -> int: regular_cost_per_two_weeks = 100 total_cost_in_four_weeks = 125 extra_cost = total_cost_in_four_weeks - (regular_cost_per_two_weeks * 2) result = extra_cost return result
Michael baked 700 chocolate chip cookies for his brother's birthday party. He served 2/7 of them on Friday, shared half of the remaining on Saturday, and saved the rest for Sunday. If he ate 1/6 of the remaining cookies on Sunday, how many cookies are left?
def solve() -> int: cookies_baked = 700 cookies_served_friday = (2/7) * cookies_baked cookies_remaining_friday = cookies_baked - cookies_served_friday cookies_served_saturday = (1/2) * cookies_remaining_friday cookies_remaining_saturday = cookies_remaining_friday - cookies_served_saturday cookie...
There are 20 students in a class. The teacher decides to buy 5 pencils for each student in the class. If each pencil costs $0.50, what is the total cost of pencils?
def solve() -> int: num_students = 20 num_pencils_per_student = 5 cost_per_pencil = 0.5 total_cost = num_students * num_pencils_per_student * cost_per_pencil result = total_cost return result
In a school with 60 students, 45 study French and 35 study Spanish. If each student studies at least one language, how many students study both French and Spanish?
def solve() -> int: total_students = 60 french_students = 45 spanish_students = 35 both_languages = french_students + spanish_students - total_students result = both_languages return result
You invest $300 at the beginning of each quarter (every three months) in a fund paying 7 percent interest at the end of the quarter (every three months). How much money, including interest, will you have at the end of 2 years?
def solve() -> int: quarterly_investment = 300 interest_rate = 0.07 total = 0 for i in range(8): interest = total * interest_rate total += quarterly_investment + interest result = total return result
Student: A jar has 20 red marbles, 30 blue marbles, and 50 green marbles. What is the probability of picking a blue marble at random from the jar?
def solve() -> int: red_marbles = 20 blue_marbles = 30 green_marbles = 50 total_marbles = red_marbles + blue_marbles + green_marbles probability_blue = blue_marbles / total_marbles result = probability_blue return result
Charles found 6 feathers. Each had 3 points on each side. How many points did he find in total?
def solve() -> int: feathers = 6 points_side = 3 total_points = feathers * points_side * 2 result = total_points return result
A watch costs $100. If the store offers a buy one get one 30% off sale, what is the final cost of three watches?
def solve() -> int: watch_cost = 100 percent_off = 0.30 discount_amount = watch_cost * percent_off cost_after_discount = watch_cost - discount_amount final_cost = (3 * watch_cost) - cost_after_discount result = final_cost return result
A movie theater has 450 seats. If 225 tickets were sold, what percent of seats are still available for purchase?
def solve() -> int: available_seats = 450 - 225 percent_available = (available_seats / 450) * 100 result = percent_available return result
A recipe needs 1/3 of a cup of sugar for every 4 servings. If there are 24 servings, how many cups of sugar are needed in total?
def solve() -> int: sugar_per_serving = 1/3 servings = 24 sugar_needed = (sugar_per_serving * servings) / 4 result = sugar_needed return result
At a carnival, three stuffed animals have a combined weight of 24 pounds. If the first animal weighs 8 pounds and the third animal weighs 5 pounds more than the second, what is the range of weights for the three stuffed animals?
def solve() -> int: animal1_weight = 8 animal3_weight = 0 animal2_weight = 0 animal3_weight = animal2_weight + 5 total_weight = animal1_weight + animal2_weight + animal3_weight min_weight = animal1_weight + 2*(animal2_weight+5) max_weight = animal1_weight + 2*(animal2_wei...
Jason visits five different cities. He spends 3 days in the first city and three times longer in each of the other four cities. How many days does Jason spend on his journey?
def solve() -> int: city1 = 3 city2 = city1 * 3 city3 = city2 * 3 city4 = city3 * 3 city5 = city4 * 3 total_days = city1 + city2 + city3 + city4 + city5 result = total_days return result
Student: A recipe requires 3 cups of flour to make 12 cookies. How many cups of flour are needed to make 36 cookies?
def solve() -> int: cookies = 36 cups_per_12_cookies = 3 cups_needed = cups_per_12_cookies * (cookies / 12) result = cups_needed return result
A school ordered 1000 pencils for their students. They set aside 100 for each day of the week, used 300 for their art department, and split the remaining equally among their five classes. How many pencils did each class get?
def solve() -> int: pencils_ordered = 1000 pencils_set_aside = 100 * 7 pencils_art_department = 300 pencils_remaining = pencils_ordered - pencils_set_aside - pencils_art_department pencils_per_class = pencils_remaining / 5 result = pencils_per_class return result
- Jack is 3 years older than Kelly. Kelly is 5 years younger than Leo. If Leo is 18 years old, how old is Jack, in years?
def solve() -> int: leo = 18 kelly = leo - 5 jack = kelly + 3 result = jack return result
A village's water supply is halved every time the population doubles. If it supports 200 people, how many can it support when the population is 800?
def solve() -> int: population_1 = 200 population_2 = 800 water_supply_1 = 1 water_supply_2 = water_supply_1 / (2 ** (population_2 // population_1)) result = water_supply_2 return result
A store has 200 shirts. The owner offers a 10% discount on the shirts. If 60 shirts are sold, how many shirts are remaining?
def solve() -> int: total_shirts = 200 discount = 0.1 discounted_price = 1 - discount sold_shirts = 60 remaining_shirts = total_shirts - sold_shirts remaining_price = remaining_shirts * discounted_price result = remaining_shirts return result