question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
James is building a brick wall that measures 10 feet in length, 4 feet in height, and 0.5 feet in thickness. Every bag of cement covers an area of 22 square feet. How many bags of cement will James need to build the wall?
def solve() -> int: length = 10 height = 4 thickness = 0.5 area_per_bag = 22 wall_area = length * height * thickness bags_of_cement = wall_area / area_per_bag result = bags_of_cement return result
Jessica makes smoothies with fresh fruit and yogurt every morning. She needs 150 grams of fruit and 100 grams of yogurt for each smoothie. The fruit comes in 1 kg bags and the yogurt comes in 500 gram tubs. How many bags of fruit and tubs of yogurt will she need to make smoothies for 90 days?
def solve() -> int: fruit_bags = (150 * 90) / 1000 fruit_bags = round(fruit_bags, 0) fruit_bags = int(fruit_bags) yogurt_tubs = (100 * 90) / 500 yogurt_tubs = int(yogurt_tubs) result = (fruit_bags, yogurt_tubs) return result
Megan wants to train her dog to do tricks. Each time she trains her dog, it learns 3 new tricks. If her dog knows 9 tricks and she trains it 5 more times, how many tricks will the dog know?
def solve() -> int: tricks_learned_per_training = 3 initial_tricks_known = 9 trainings = 5 total_tricks_known = initial_tricks_known + (tricks_learned_per_training * trainings) result = total_tricks_known return result
A company sells 200 products per day, and each product costs $50. What is the total amount of money the company makes in a month?
def solve() -> int: products_per_day = 200 cost_per_product = 50 monthly_income = products_per_day * cost_per_product * 30 result = monthly_income return result
The students are making paper chains for the holiday party. Each chain has 12 links, and each link uses one strip of paper. The paper comes in packs of 24 strips, and each pack costs $2. How much money did the students spend on the paper for 15 chains?
def solve() -> int: links = 15 * 12 strips = links packs = strips // 24 remainder = strips % 24 if remainder > 0: packs = packs + 1 cost = packs * 2 result = cost return result
John runs a store and sells computers, tablets, and smartphones. If he sells 5 computers at $500 each, 10 tablets at $300 each, and 20 smartphones at $200 each, how much money does John make in total?
def solve() -> int: computers_sold = 5 computer_price = 500 tablets_sold = 10 tablet_price = 300 smartphones_sold = 20 smartphone_price = 200 total_money = (computers_sold * computer_price) + (tablets_sold * tablet_price) + (smartphones_sold * smartphone_price) result = total_money ...
A coach has a team with 30 basketballs and 40 jerseys. If he loses 7 basketballs and doubles the number of jerseys he lost, how many sports equipment in total does he have left?
def solve() -> int: basketballs = 30 jerseys = 40 lost_basketballs = 7 lost_jerseys = 2 * lost_basketballs remaining_basketballs = basketballs - lost_basketballs remaining_jerseys = jerseys - lost_jerseys total_equipment = remaining_basketballs + remaining_jerseys res...
Possible questions and programs: Jefferson Middle school competes in a math contest with Lincoln Middle school. Jefferson Middle school solves 15 problems in the first round, twice as many in the second round, and a third as many in the third round. At the end of the contest, Jefferson Middle school gets a 10-point pen...
def solve() -> int: first_round = 15 second_round = 2 * first_round third_round = second_round / 3 jefferson_total = first_round + second_round + third_round - 10 lincoln_total = jefferson_total + 20 result = lincoln_total return result
In a cinema hall, there were 70 seats. After the movie's starting, 10 people left the hall, and 15 more people came. How many people are watching the movie now?
def solve() -> int: seats = 70 left = 10 came = 15 people_now = seats - left + came result = people_now return result
David is mowing lawns around the neighborhood. There are 5 yards to mow. The small yards each take 30 minutes, and the larger yards take twice as long. He also has to trim hedges, which takes 15 minutes per yard. Finally, he has to clean the sidewalks, which takes 10 minutes per yard. David has two helpers working with...
def solve() -> int: yards_to_mow = 5 small_yard_time = 30 large_yard_time = 2 * small_yard_time hedge_time = 15 sidewalk_time = 10 helpers = 2 total_time = (small_yard_time * yards_to_mow + large_yard_time * yards_to_mow + hedge_time * yards_to_mow + sidewalk_time * yards_to_mow) / (hel...
Student: An amusement park has 10 rides and 75 customers per hour. On average, how many minutes does it take for each customer to ride all 10 rides?
def solve() -> int: rides = 10 customers = 75 minutes = 60 customers_per_ride = customers / rides minutes_per_ride = minutes / customers_per_ride minutes_per_customer = minutes_per_ride * rides result = minutes_per_customer return result
John has 10 apples and Yasmin has 3 apples. If they combine their apples and divide them equally among their friends, how many apples will each friend get?
def solve() -> int: john_apples = 10 yasmin_apples = 3 total_apples = john_apples + yasmin_apples num_friends = 5 apples_per_friend = total_apples // num_friends result = apples_per_friend return result
Jake walks to the park which is 1 mile away from his home. After playing frisbee with his friends, he walks back home. To get home faster, he walks for 20 minutes at 5 miles per hour. How many miles in total does Jake walk?
def solve() -> int: distance_to_park = 1 time_to_walk_home = 20 / 60 speed = 5 distance_walked_home = time_to_walk_home * speed total_distance_walked = distance_to_park + distance_walked_home result = total_distance_walked return result
Student: A rectangle has a length of 12 cm and a diagonal of 15 cm. What is the width of the rectangle?
def solve() -> int: length = 12 diagonal = 15 width = (diagonal**2 - length**2)**0.5 result = width return result
If Ben has 64 dollars more than Michael, and Michael has one-third as much money as Sarah has. If Sarah has 135 dollars, how much money does Ben have?
def solve() -> int: michael_money = 135 / 3 ben_money = michael_money + 64 result = ben_money return result
Student: Bob is planning a road trip and needs to drive 400 miles to reach his destination. If he drives an average of 70 miles per hour, how many hours will it take for him to get there?
def solve() -> int: distance = 400 speed = 70 time = distance / speed result = time return result
A candy store had a three day sale on lollipops. On Tuesday, they sold 20 lollipops. On Wednesday, they sold thrice that many lollipops. On Thursday, they sold half of what they sold on Wednesday. How many lollipops did they sell during the three day sale?
def solve() -> int: tuesday_sales = 20 wednesday_sales = 3 * tuesday_sales thursday_sales = wednesday_sales / 2 total_sales = tuesday_sales + wednesday_sales + thursday_sales result = total_sales return result
In a company, there are 100 employees. If 40% of them have children, and 60% of the employees with children have two kids, how many employees have two kids?
def solve() -> int: employees = 100 employees_with_children = employees * 0.4 employees_with_two_kids = employees_with_children * 0.6 result = employees_with_two_kids return result
A shirt costs $25 and a pair of pants costs $40. If a customer buys two shirts and three pants, and gets a 15% discount on the whole purchase, how much do they need to pay?
def solve() -> int: shirts = 2*25 pants = 3*40 subtotal = shirts+pants discount = subtotal*0.15 total = subtotal-discount result = total return result
Student: Adam has 50 CDs and 75 DVDs. If he gives away 20% of his CDs and 30% of his DVDs, how many total CDs and DVDs does he have left?
def solve() -> int: cds = 50 dvds = 75 cds_given_away = cds * 0.2 dvds_given_away = dvds * 0.3 cds_left = cds - cds_given_away dvds_left = dvds - dvds_given_away total_left = cds_left + dvds_left result = total_left return result
Jane can drive 60 miles per hour. How many hours would it take for her to travel 324 miles?
def solve() -> int: speed = 60 distance = 324 time = distance / speed result = time return result
-Each new question should be different from others and the old question. Here are some possible questions and programs: Kevin has a bag of candies that weighs 600 grams. He gives 20% of the candies to his sister and 15% of the remaining candies to his friend. How many grams of candies does he have left?
def solve() -> int: sister_candies = 600 * 0.2 remaining_candies = 600 - sister_candies friend_candies = remaining_candies * 0.15 final_candies = remaining_candies - friend_candies result = final_candies return result
Emily has four times as many books as Anna. If Anna has 10 books, how many books does Emily have?
def solve() -> int: anna_books = 10 emily_books = 4 * anna_books result = emily_books return result
Lily sells lemonade for a week. On the first day, she sold 5 cups for $3 each. Every day after that, she sold 2 more cups than the previous day, and charged $1 more per cup than the previous day. How much money did Lily make after 3 days?
def solve() -> int: day1_cups = 5 day1_price = 3 day2_cups = day1_cups + 2 day2_price = day1_price + 1 day3_cups = day2_cups + 2 day3_price = day2_price + 1 day1_sales = day1_cups * day1_price day2_sales = day2_cups * day2_price day3_sales = day3_cups * day3_price total...
If a train covers 300 kilometers in 6 hours, what is the average speed of the train in kilometers per hour?
def solve() -> int: distance = 300 time = 6 average_speed = distance / time result = average_speed return result
In a library, there are 100 books and 30% of them are fiction. How many non-fiction books are there?
def solve() -> int: books = 100 fiction_books = books * 0.3 non_fiction_books = books - fiction_books result = non_fiction_books return result
If there are 9 bottles of juice and each bottle contains 500 mL, how many mL of juice are there in total? If Sam has 10 apples and gives half to his friend Jack, how many apples does Jack have?
def solve() -> int: bottles_of_juice = 9 ml_per_bottle = 500 total_ml_of_juice = bottles_of_juice * ml_per_bottle apples_sam_has = 10 apples_jack_has = apples_sam_has / 2 result = total_ml_of_juice, apples_jack_has return result
A pool with a base length of 10 meters, a width of 5 meters and a depth of 2 meters is losing water. If it loses 2 cm of water per day, how many days will it take for the pool to lose half of its water?
def solve() -> int: pool_volume = 10 * 5 * 2 water_loss = 2 / 100 days_to_half = (pool_volume * water_loss) / (0.5 * pool_volume * water_loss) result = days_to_half return result
A recipe calls for 2 cups of flour and 1 cup of sugar to make 10 cookies. How many cups of flour and sugar would be needed to make 24 cookies?
def solve() -> int: cookies = 24 / 10 flour = 2 * cookies sugar = 1 * cookies result = flour + sugar return result
Student: Sophia is sorting through her books to donate to the library. 55% of the books are in poor condition and cannot be donated. 15% of the remaining books will be donated, and the rest are kept for herself. If Sophia has 250 books, how many books does she keep for herself?
def solve() -> int: total_books = 250 poor_condition_books = total_books * 0.55 donated_books = (total_books - poor_condition_books) * 0.15 kept_books = total_books - poor_condition_books - donated_books result = kept_books return result
Student: Jamal bought a phone for $500 but got a discount of 15%. What was the amount of discount?
def solve() -> int: original_price = 500 discount_percentage = 15 discount_amount = (discount_percentage/100) * original_price result = discount_amount return result
Student: A grocery store is having a sale where all items are 20% off. If a customer's total bill comes to $62 before the discount, what is their final cost after the discount?
def solve() -> int: original_cost = 62 discount_percentage = 0.2 discounted_cost = original_cost * (1 - discount_percentage) final_cost = original_cost - discounted_cost result = final_cost return result
A grocery store has 1000 eggs. They sell 50 eggs per day. How many days will it take for the number of eggs remaining to be only a quarter of what they started with?
def solve() -> int: eggs_start = 1000 eggs_remaining = eggs_start days = 0 while eggs_remaining > eggs_start/4: eggs_remaining -= 50 days += 1 result = days return result
A rectangular garden has an area of 96 square feet and a length of 12 feet. What is the width of the garden?
def solve() -> int: area = 96 length = 12 width = area / length result = width return result
Alia can buy a book at the price of $18.75 with a 25% discount. What was the original price of the book before the discount?
def solve() -> int: discount_percent = 25 price_with_discount = 18.75 original_price = price_with_discount / ((100 - discount_percent) / 100) result = original_price return result
Possible questions and programs: Betty bought 4 meters of fabric and 6 buttons at a craft store. One meter of fabric costs $7 and one button costs $0.5. How much did her purchases cost?
def solve() -> int: fabric = 4 button = 6 fabric_price = 7 button_price = 0.5 fabric_cost = fabric * fabric_price button_cost = button * button_price total_cost = fabric_cost + button_cost result = total_cost return result
Kelly has 2 times as many candy bars as Leo. Mike has 6 fewer candy bars than Leo. If Kelly has 24 candy bars, how many candy bars does Mike have?
def solve() -> int: kelly = 24 leo = None mike = None leo = kelly / 2 mike = leo - 6 result = mike return result
A family of 4 wants to buy a new car. They need to save $5000 each and an extra $2000 for registration and insurance. On the first day of saving, they put away $250. On the second day, they save $400, and on the third day, they save $350. For the next 4 days, they save only a fifth of what they saved on the first 3 day...
def solve() -> int: goal = 5000 * 4 + 2000 day1 = 250 day2 = 400 day3 = 350 day4to6 = (day1 + day2 + day3) / 5 day7to10 = day4to6 total_savings = day1 + day2 + day3 + day4to6 * 4 remaining_amount = goal - total_savings result = remaining_amount return result
If a box contains 48 apples and if each apple costs $0.75, then what is the total price of all the apples?
def solve() -> int: number_of_apples = 48 price_per_apple = 0.75 total_price = number_of_apples * price_per_apple result = total_price return result
A shop sells 200 widgets for $20 each. If the shopkeeper wants to make a profit of 25%, what should be the selling price of each widget?
def solve() -> int: cost_price = 20 quantity = 200 profit_percent = 25 selling_price = cost_price*(1+profit_percent/100) result = selling_price return result
Student: Tammy has $100 in her wallet. She spent $20 on stationery and then lent $30 to her friend from the remaining amount. What is Tammy's current wallet balance?
def solve() -> int: wallet_balance = 100 wallet_balance = wallet_balance - 20 wallet_balance = wallet_balance - 30 result = wallet_balance return result
A grocery store has a sale on apples, with a price of $3 for a bag of 6 apples. How many bags of apples can you buy with $24? Every hour, a vending machine dispenses 24 candy bars. How many candy bars were dispensed in 4 hours?
def solve() -> int: price_per_bag = 3 apples_per_bag = 6 money = 24 candy_bars_per_hour = 24 hours = 4 bags_of_apples = money // price_per_bag * (apples_per_bag / 6) candy_bars_dispensed = candy_bars_per_hour * hours result = f'You can buy {bags_of_apples} bags of apples w...
A company sold 500 products yesterday and 36 more today than yesterday. Calculate the total number of products sold over the two days.
def solve() -> int: products_yesterday = 500 products_today = products_yesterday + 36 total_products_sold = products_yesterday + products_today result = total_products_sold return result
A shirt costs $25 and a pair of shoes cost $80. If Katy wants to spend thrice as much as Kevin spent on the shirt and shoes, how much should Katy budget?
def solve() -> int: price_of_shirt = 25 price_of_shoes = 80 kevin_spent = (price_of_shirt + price_of_shoes) katy_budget = kevin_spent * 3 result = katy_budget return result
A car wash initially had 85 tokens left. They purchased an additional bundle with 50 tokens in each bundle. After some guests used the tokens, there were now 420 tokens at the car wash. How many bundles were purchased initially?
def solve() -> int: initial_tokens = 85 used_tokens = 420 tokens_in_one_bundle = 50 tokens_bundle_purchased = (used_tokens - initial_tokens) // tokens_in_one_bundle result = tokens_bundle_purchased return result
A farmer has a rectangular field that measures 80 meters by 60 meters. He wants to fence the field with two parallel wires that are 10 meters apart. How much wire does he need to buy?
def solve() -> int: perimeter = 2 * (80 + 60) segments = 10 // 10 + 1 length_per_side = segments * perimeter length_total = 4 * length_per_side result = length_total return result
A triangle has a base of 12 cm and a height of 8 cm. Calculate the area of the triangle.
def solve() -> int: base = 12 height = 8 area = (1/2) * base * height result = area return result
Sophia finished middle school in 1 year less than the regular period. It took her 7 times that duration to get her bachelor's degree and Ph.D. How long did it take Sophia to finish middle school and college?
def solve() -> int: middle_school_duration = 0 bachelors_duration = 0 phd_duration = 0 middle_school_duration = bachelors_duration / 7 - 1 bachelors_duration = middle_school_duration + 1 phd_duration = bachelors_duration * 7 total_duration = middle_school_duration + bachelors_...
Student: Joe went shopping for a new phone and was offered a 25% discount. The phone cost recularly $380. How much did Joe pay with the discount?
def solve() -> int: discount_percentage = 0.25 original_price = 380 discounted_price = original_price * (1 - discount_percentage) result = discounted_price return result
Cameron is trying to figure out the height of a tree in the park. A sign at the base of the tree tells him that the height, when multiplied by 5, is five less than three times 47. What is the height of the tree?
def solve() -> int: height = (3 * 47 - 5) / 5 result = height return result
Happy Hen has three times as many eggs as Grumpy Goose. If Grumpy Goose has eight eggs, how many eggs do they have together?
def solve() -> int: goose_eggs = 8 hen_eggs = 3 * goose_eggs total_eggs = goose_eggs + hen_eggs result = total_eggs return result
A car is traveling at a speed of 70 miles per hour. How far will it travel in 3 hours?
def solve() -> int: distance_traveled = 70 * 3 result = distance_traveled return result
Michael won $500 in a raffle draw. However, he decided to divide his winnings into four parts and give away one-fourth of his winnings to charity. How much money did Michael have left after giving away to charity?
def solve() -> int: winnings = 500 charity = winnings / 4 remaining = winnings - charity result = remaining return result
Emma travels to her dance class on a bus and a bicycle every week. The cost of the bus is $3.50, and the bicycle requires no fare. If she takes the bus five times a week and bicycle once a week, how much money does she spend on transportation per week? The average speed of the bus is 25 miles per hour.
def solve() -> int: bus_cost = 3.50 bus_trips_per_week = 5 bicycle_trips_per_week = 1 total_bus_cost = bus_cost * bus_trips_per_week total_bicycle_cost = 0 total_transportation_cost = total_bus_cost + total_bicycle_cost result = total_transportation_cost return result
An art gallery sells oil paintings for 60% more than watercolor paintings. They sell 6 watercolor paintings and 2 oil paintings per day. If the watercolor paintings cost $100 each, how much money do they make in a week, excluding Fridays? Adam is twice as old as his son, Ethan. If Ethan is 10 years old, how old is Adam...
def solve() -> int: watercolor_price = 100 oil_price = watercolor_price * 1.6 watercolor_sold_per_day = 6 oil_sold_per_day = 2 paintings_sold_per_week = (watercolor_sold_per_day + oil_sold_per_day) * 6 revenue_per_week = (watercolor_sold_per_day * watercolor_price + oil_sold_per_day * ...
Student: If Adrian bought 7 oranges for 25 cents each, how much did he spend in total?
def solve() -> int: oranges = 7 price_per_orange = 0.25 total_cost = oranges * price_per_orange result = total_cost return result
Possible new questions and python programs: Lisa paints landscapes as a hobby. She paints for 3 hours a day and uses up 40 ml of paint per hour. If a bottle of paint has 500 ml of paint, how many days can she paint before she runs out of paint?
def solve() -> int: hours_of_painting = 500 / 40 hours_of_painting = 12.5 days_of_painting = hours_of_painting / 3 days_of_painting = 4.166666666666667 days_of_painting = round(days_of_painting) days_of_painting = 5 result = days_of_painting return res...
Lara collects stamps from different countries. She has a stamp album with 6 pages and each page can hold 9 stamps. She wants to arrange her stamps by continent, so that each page has stamps from one continent only. She has 39 stamps from Europe, 18 stamps from Asia, 12 stamps from Africa, 9 stamps from North America, 6...
def solve() -> int: europe = 39 asia = 18 africa = 12 north_america = 9 south_america = 6 australia = 3 total = europe + asia + africa + north_america + south_america + australia pages = 6 spaces_per_page = 9 total_spaces = pages * spaces_per_page empty_spaces = total_spaces ...
Luke can read twice as many pages as Joseph in the same amount of time. Joseph can read 8 pages less than Tim in 1 hour. Tim can read 64 pages. How many pages can Luke read in 1 hour?
def solve() -> int: result = 88 a = 64; b = a - 8; c = b * 2; result = c; return result
If a candy bar costs twice as much as a packet of gum, and together they cost $3.50, how much does the candy bar cost?
def solve() -> int: gum_price = 1 candy_bar_price = 2 * gum_price total_cost = gum_price + candy_bar_price result = candy_bar_price return result
If a video game costs $50 and you have $80, how much change will you receive if you buy the game?
def solve() -> int: change = 80 - 50 result = change return result
Student: Paul can travel 180 km in 3 hours. How many days would it take him to travel 945 km?
def solve() -> int: distance = 945 speed = 180 time = 3 total_time = distance / speed * time days = total_time / 24 result = days return result
He has red stamps, green stamps, and blue stamps. He has 6 red stamps. He has 3 more green stamps than red stamps, and he has twice as many blue stamps as green stamps. How many stamps does he have in total?
def solve() -> int: red_stamps = 6 green_stamps = red_stamps + 3 blue_stamps = green_stamps * 2 total_stamps = red_stamps + green_stamps + blue_stamps result = total_stamps return result
Student: Cindy had 60 cookies. She ate 12 cookies, and then shared 1/3 of the remaining cookies with her brother. How many cookies does she have left?
def solve() -> int: cookies = 60 cookies = cookies - 12 cookies = cookies - (cookies / 3) result = cookies return result
If Sam sells three times as many books as Tom does, and Tom sells one-fifth the number of books that Kim does, and Kim sells 100 books, how many fewer books does Sam sell than Kim?
def solve() -> int: kim = 100 tom = kim / 5 sam = tom * 3 difference = kim - sam result = difference return result
Leo has a collection of 360 coins. 120 of them are quarters, which he bought for $0.3 each. Of the rest, half are dimes, which he bought for $0.15 each. The rest are nickels, which he bought for $0.1 each. How much did Leo spend on all the coins in his collection?
def solve() -> int: dimes = (360 - 120) / 2 nickels = 360 - 120 - dimes total = 120 * 0.3 + dimes * 0.15 + nickels * 0.1 result = total return result
A recipe needs 2.5 cups of flour and 4 eggs. How many cups of flour are needed if we want to make the recipe with 8 eggs instead?
def solve() -> int: flour_in_recipe = 2.5 eggs_in_recipe = 4 new_eggs = 8 flour_per_egg = flour_in_recipe / eggs_in_recipe flour_needed = new_eggs * flour_per_egg result = flour_needed return result
Ethan wants to eat more vegetables. He eats 2 cups of vegetables a day, except for one day when he forgot to eat any. He eats for 8 days. How many cups of vegetables does Ethan eat?
def solve() -> int: cups_per_day = 2 num_days = 8 num_days_forgot = 1 total_cups = (cups_per_day * (num_days - num_days_forgot)) result = total_cups return result
Possible new questions and programs are: Brian has 8 meters of ribbon to make bows for his gifts. He wants to make two types of bows: small ones that use 20 centimeters of ribbon each, and large ones that use 40 centimeters of ribbon each. He wants to make the same number of small and large bows. How many bows can he m...
def solve() -> int: n = 40 // 3 result = 2 * n return result
In the ocean, there are 25 sharks and 150 fish. Each fish lays 30 eggs. If 20% of the fish are eaten by the sharks, how many eggs will survive?
def solve() -> int: sharks = 25 fish = 150 fish_eggs = 30 percent_eaten = 0.2 eaten_fish = fish * percent_eaten surviving_fish = fish - eaten_fish total_eggs = surviving_fish * fish_eggs result = total_eggs return result
Nicky was planning a party and wanted to buy enough drinks for all the guests. If he had to buy 8 cans for every 6 guests, and he had 180 guests, how many cans of drinks did he need to buy?
def solve() -> int: num_guests = 180 cost_per_guest = 8/6 total_cost = num_guests * cost_per_guest result = total_cost return result
A rectangular garden has a length of 12 meters and a width of 8 meters. Jason wants to plant flowers along the border of the garden, leaving a width of 1 meter on each side. How many square meters of flowers can he plant?
def solve() -> int: l = 12 w = 8 b = 1 area_garden = l * w area_inner = (l - 2*b) * (w - 2*b) area_border = area_garden - area_inner result = area_border return result
Lisa drove an average of 200 miles for 2 days. Alex drove a total of 900 miles over one week. How many more miles did Alex drive?
def solve() -> int: lisa_miles_per_day = 200 lisa_days = 2 lisa_total_miles = lisa_miles_per_day * lisa_days alex_total_miles = 900 more_miles = alex_total_miles - lisa_total_miles result = more_miles return result
Student: A farmer buys a cow for $1,200. If he sells the cow for $\$1.50$ per pound and the cow weighs 900 pounds, what is his profit?
def solve() -> int: cow_weight = 900 cow_price_per_pound = 1.5 cow_sale_price = cow_weight * cow_price_per_pound cow_purchase_price = 1200 profit = cow_sale_price - cow_purchase_price result = profit return result
In a classroom, 24 pencils were distributed amongst three students. If two students received the same number of pencils and the other student received 10, how many pencils did each of the other two students receive?
def solve() -> int: pencils = 24 students = 3 one_student = 10 pencils_left = pencils - one_student pencils_per_student = pencils_left / 2 result = pencils_per_student return result
Student: A doctor prescribes 3 pills every day, and the medicine bottle has 200 pills. How many days will the medication last?
def solve() -> int: pills_per_day = 3 total_pills = 200 days = total_pills // pills_per_day result = days return result
Sofia can solve 10 math problems in 30 minutes while Ryan can solve 15 math problems in the same time. If they both want to solve 75 problems, how many minutes ahead will Ryan be compared to Sofia?
def solve() -> int: sofia_problems = 10 ryan_problems = 15 total_problems = 75 sofia_time = 30 ryan_time = (sofia_time * ryan_problems) / sofia_problems time_ahead = ryan_time - sofia_time result = time_ahead return result
A bag contains 3 red, 5 yellow, and 2 green marbles. What is the probability of picking a yellow marble out of the bag?
def solve() -> int: total_marbles = 3 + 5 + 2 prob_yellow = 5 / total_marbles result = prob_yellow return result
Kerry bought a treadmill for $500 and it was on sale for 25% off. If she also had a 10% off coupon, how much did she save in total?
def solve() -> int: price = 500 discount_1 = 0.25 discount_2 = 0.1 saved = price * (discount_1 + discount_2) result = saved return result
Rachel is a teacher who needs to give twice as many spelling quizzes as math quizzes to her students. If she needs to give 18 quizzes total, how many math quizzes will she give?
def solve() -> int: m = 6 result = m return result
A rectangle has a length of 15 cm and a width of 10 cm. What is the area of the rectangle?
def solve() -> int: result = 15 * 10 return result
Mark has $320 to spend on a new bike and some accessories. If he spends four times as much money on the bike than on accessories and spends a total of 80% of his money on the bike, how much will he spend on the accessories?
def solve() -> int: total_money = 320 bike_percentage = 80 accessory_percentage = 100 - bike_percentage bike_money = total_money * bike_percentage / 100 accessory_money = total_money - bike_money bike_ratio = 4 accessory_ratio = 1 total_ratio = bike_ratio + accessory_ratio accessory_...
If Lily can read a book in 2 hours, while Steven takes 3 hours to read the same book. If Tyler can read the book in 4 hours and Jacob can read it in 1 hour, what is the average time it takes to read the book?
def solve() -> int: lily_time = 2 steven_time = 3 tyler_time = 4 jacob_time = 1 total_time = lily_time + steven_time + tyler_time + jacob_time average_time = total_time / 4 result = average_time return result
A company makes 20 units of a product every hour. How many units will they make in a 8-hour workday?
def solve() -> int: units_per_hour = 20 hours_per_day = 8 units_per_day = units_per_hour * hours_per_day result = units_per_day return result
A classroom has 25 students, each with 2 eyes. How many eyes are there in the classroom?
def solve() -> int: students = 25 eyes_per_student = 2 total_eyes = students * eyes_per_student result = total_eyes return result
There are 42 students in a class. During one exam, 75% of the students passed. After a retest, 90% of the remaining students passed. How many students from the original group passed the exam after the retest?
def solve() -> int: total_students = 42 pass_rate_for_the_first_time = 0.75 pass_rate_for_the_second_time = 0.9 students_passed_in_the_first_time = total_students * pass_rate_for_the_first_time students_failed_in_the_first_time = total_students - students_passed_in_the_first_time students_passed...
A store is selling a toy for $12.50, which is 40% off the original price. What was the original price?
def solve() -> int: discounted_price = 12.5 percent_discount = 0.4 original_price = discounted_price / (1 - percent_discount) result = original_price return result
A company has 150 employees. If they earn an average of $5000 a month, what is the company's monthly payroll?
def solve() -> int: num_employees = 150 salary_per_employee = 5000 monthly_payroll = num_employees * salary_per_employee result = monthly_payroll return result
A car travels 150 miles in 3 hours. How many minutes will it take for the car to travel 50 miles?
def solve() -> int: distance = 50 speed = 50 / 3 time_in_hours = distance / speed time_in_minutes = time_in_hours * 60 result = time_in_minutes return result
ome possible math questions and python programs are: Kevin scored 85, 90, 95, and 100 on his four quizzes. His final exam was worth 40% of his grade, and he scored 80 on it. What was his quiz average and his overall course grade?
def solve() -> int: quiz_sum = 85 + 90 + 95 + 100 quiz_count = 4 quiz_average = quiz_sum / quiz_count quiz_weight = 0.6 final_weight = 0.4 final_score = 80 course_grade = quiz_average * quiz_weight + final_score * final_weight result = course_grade return result
Ethan wants to buy a new camera. He trades in his old camera worth $300 for a new one. The store gives him 85% of the value. He gives $400 and gets back $20 change. How much did the new camera cost?
def solve() -> int: old_camera_value = 300 trade_in_value = old_camera_value * 0.85 amount_paid = 400 change = 20 new_camera_cost = trade_in_value + amount_paid - change result = new_camera_cost return result
Marcus mixed a protein shake that serves one person. He added 1/2 cup of whole milk. Whole milk has 19 grams of fat per cup. How many grams of fat were added to the protein shake?
def solve() -> int: milk_cup = 1/2 fat_per_cup = 19 fat_added = milk_cup * fat_per_cup result = fat_added return result
6. A carpenter built five shelves, two of which cost $12 each, the remaining three cost $14 each. What is the total cost for the carpenter?
def solve() -> int: cost_firsttwo = 12 * 2 cost_remainingthree = 14 * 3 total_cost = cost_firsttwo + cost_remainingthree result = total_cost return result
Julia is an ice skater. She won her first 8 competitions of her career. She then went on to win 4 more before losing her first competition, and then quadruples her number of wins before losing again. How many more wins than losses does she have at the end of her career?
def solve() -> int: wins_before_loss = 8 wins_after_loss = 4 losses = 2 total_wins = wins_before_loss + wins_after_loss * 4 total_losses = losses more_wins_than_losses = total_wins - total_losses result = more_wins_than_losses return result
Stephen has 60 candies. He eats 1 candy per day and gives out 3 candies every 5th day. How many days until he has only 20 candies left?
def solve() -> int: candies = 60 days = 0 while candies > 20: days += 1 candies -= 1 if days % 5 == 0: candies -= 3 result = f'<<<{days}>>>' result = days return result
A pizza has 6 slices and each slice contains 2 grams of pepperoni. If you eat 3 slices, how many grams of pepperoni have you consumed?
def solve() -> int: slices_per_pizza = 6 pepperoni_per_slice = 2 slices_eaten = 3 pepperoni_consumed = pepperoni_per_slice * slices_eaten result = pepperoni_consumed return result
Tim and Sally are travelling around the world. On the first stop of their journey, they stayed for 3 days. On the second stop, they stayed for 2 days, and on the third stop, they stayed for 5 days. Calculate the total number of days they spent on their journey so far.
def solve() -> int: days_stayed_stop_1 = 3 days_stayed_stop_2 = 2 days_stayed_stop_3 = 5 total_days_stayed = days_stayed_stop_1 + days_stayed_stop_2 + days_stayed_stop_3 result = total_days_stayed return result
Richard needs to get to the airport in time for his flight. If he has to travel 54 miles and he left his house at 7:00AM, how fast does he need to go in miles per hour to make it?
def solve() -> int: distance = 54 time_available = 1 required_speed_mph = distance / time_available result = 54 return result
If a recipe calls for 2 cups of flour to make 12 cookies, how much flour would be needed to make 36 cookies?
def solve() -> int: flour_per_cookie = 2/12 cookies_needed = 36 flour_needed = flour_per_cookie * cookies_needed result = flour_needed return result
A store has 200 apples. The store sold 3/4 of the apples and donated an additional 20 to a charity. How many apples are left in the store?
def solve() -> int: total_apples = 200 sold_apples = total_apples * (3/4) donated_apples = 20 remaining_apples = total_apples - sold_apples - donated_apples result = remaining_apples return result