question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Possible questions and programs: Louie has a coin collection with 20 quarters, 15 dimes, and 10 nickels. He wants to exchange some of his coins for bills at the bank. He decides to keep 5 quarters, 3 dimes, and 2 nickels for himself. How much money will he get from the bank in bills?
def solve() -> int: quarter = 25 dime = 10 nickel = 5 quarters_to_exchange = 20 - 5 dimes_to_exchange = 15 - 3 nickels_to_exchange = 10 - 2 total_value = quarters_to_exchange * quarter + dimes_to_exchange * dime + nickels_to_exchange * nickel total_dollars = total_value / 100 result ...
Jasmine is moving to a new apartment and she bought 6 boxes of packing peanuts to pack her fragile items. Each box contains 16 bags of peanuts, and each bag has 14 cups. How many cups of packing peanuts does Jasmine have in total?
def solve() -> int: box_quantity = 6 bag_quantity = 16 cup_quantity = 14 total_cups = box_quantity * bag_quantity * cup_quantity result = total_cups return result
If 5 ounces of Dawn and 8 ounces of Dr. Bronner's liquid soap are mixed together, how many bubbles will be made?
def solve() -> int: dawn_oz = 5 bronner_oz = 8 dawn_bubbles = 200000 bronner_bubbles = 2 * dawn_bubbles total_bubbles = dawn_oz * dawn_bubbles + bronner_oz * bronner_bubbles result = total_bubbles return result
A company sells bicycles for $200 each. The company expenses $5000 each month. How many bicycles must they sell each month to make a profit of $8000?
def solve() -> int: bike_price = 200 monthly_expense = 5000 monthly_profit = 8000 bikes_to_sell = (monthly_expense + monthly_profit)/bike_price result = bikes_to_sell return result
``` A book is marked down by 15% to $29.75. What was the original price of the book?
def solve() -> int: new_price = 29.75 percentage_off = 15 original_price = new_price/(1 - percentage_off/100) result = original_price return result
Student: A school has 60% boys. If there are 36 more girls than boys, how many students are in the school?
def solve() -> int: boys = 0 girls = 0 boys = 0.6 * (girls + boys) girls = boys + 36 result = boys + girls return result
If a recipe calls for 2 cups of flour to make 12 muffins, how many cups of flour are needed to make 30 muffins?
def solve() -> int: muffins = 30 flour_needed = 2/12 * muffins result = flour_needed return result
Emma wants to make a cake that requires 2 cups of flour. One bag of flour weighs 2.5 pounds. If one cup of flour weighs 125 grams, what is the weight of the flour Emma will use for the cake?
def solve() -> int: flour_cups = 2 flour_weight_per_cup = 125 flour_weight_per_bag = 2.5 * 16 * 453.592 total_flour_weight = flour_cups * flour_weight_per_cup result = total_flour_weight return result
Student: A zoo keeper needs to fill a water bucket for the elephant with 20 liters of water. How many liters of water need to be added to the bucket to fill it up to 3/4 capacity?
def solve() -> int: bucket_capacity = 20 bucket_fill = 3/4 water_needed = bucket_capacity * bucket_fill water_added = water_needed - bucket_capacity result = water_added return result
A library ordered 300 more than four times the amount of books as it did audiobooks at $20 each. If the cost of an audiobook was $10, and the library ordered 50 audiobooks, calculate the total amount of money they paid for the reading materials.
def solve() -> int: audiobooks = 50 audiobook_cost = 10 books = 4 * audiobooks + 300 book_cost = 20 total_cost = (audiobooks * audiobook_cost) + (books * book_cost) result = total_cost return result
Anshu had 16 pieces of candy. He split the candy among himself and 3 of his friends, giving the same amount to each. How many pieces of candy did Anshu get?
def solve() -> int: total_candy = 16 total_people = 4 candy_per_person = total_candy / total_people result = candy_per_person return result
James is feeding his guinea pigs. Each guinea pig needs 1/5 ounce of food per 1/10 pound of body weight. He has 15 pounds of guinea pigs. Each pack of food contains 16 ounces and costs $4. How much does it cost to feed the guinea pigs?
def solve() -> int: pounds = 15 food_per_pound = 1/10 * 1/5 total_food = pounds * food_per_pound packs = total_food / 16 cost = packs * 4 result = cost return result
The Johnson family has four cars parked in their garage. Henry's car has four times as many tires as Samantha's bicycle, but half as many as Jeff's motorcycle. The Toyota has the same amount of tires as the average of the other three. If Samantha's bicycle has two wheels, how many tires does the Toyota have?
def solve() -> int: samantha_bicycle_wheels = 2 henry_car_tires = samantha_bicycle_wheels * 4 jeff_motorcycle_tires = henry_car_tires * 2 toyota_tires = (henry_car_tires + jeff_motorcycle_tires + samantha_bicycle_wheels) / 3 result = toyota_tires return result
(4) Gwen invested her bonus in stocks A, B, and C according to the following equation A + B + C = 900. After one year, stock A was worth 25% less while stock B and stock C were each worth 50% more. How much was Gwen's stocks worth in total, in dollars?
def solve() -> int: A_start = 900 / 3 B_start = 900 / 3 C_start = 900 / 3 A_end = A_start * 0.75 B_end = B_start * 1.5 C_end = C_start * 1.5 total = A_end + B_end + C_end result = total return result
Amanda is installing tiles in a bathroom. She installs a rectangular tile measuring 6 inches by 12 inches and a square tile measuring 8 inches by 8 inches. If the bathroom floor is 10 feet by 8 feet, how many tiles of each type does she need to cover the entire floor?
def solve() -> int: rect_tile_area = 6 * 12 bathroom_area = 10 * 8 * 12 * 12 num_rect_tiles = bathroom_area // rect_tile_area sq_tile_area = 8 * 8 num_sq_tiles = bathroom_area // sq_tile_area result = f'{num_rect_tiles} rectangular tiles and {num_sq_tiles} square tiles are needed to co...
Sofia has 27 donuts. If every donut can be easily cut into fifths and every fifth of a donut can be split into 3 small bite-size pieces, how many people can taste Sofia's donuts if she divides them all into bite-size pieces?
def solve() -> int: donuts = 27 pieces_per_donut = 5 pieces_per_fifth = 3 total_pieces = donuts * pieces_per_donut total_bite_size_pieces = total_pieces * pieces_per_fifth people_can_taste = total_bite_size_pieces result = people_can_taste return result
Sam paid 520 dollars for a television set which was sold at a discount of 20%. What is the original price of the television set?
def solve() -> int: final_price = 520 discount = 0.2 original_price = final_price / (1 - discount) result = original_price return result
A store has 100 bottles of soda. They put 25% of them on sale for 20% off. How many bottles of soda are on sale?
def solve() -> int: x = 100 * 0.25 * (1 - 0.2) result = x return result
A recipe calls for 3 cups of flour and 2 cups of sugar. If you want to make half of the recipe, how much sugar do you need?
def solve() -> int: flour = 3 sugar = 2 recipe_size = 2 half_sugar = (sugar * recipe_size) / 2 result = half_sugar return result
Student: If there are 170 apples in 8 crates, how many apples are in each crate?
def solve() -> int: apples = 170 crates = 8 apples_per_crate = apples / crates result = apples_per_crate return result
Mary has 45 apples. She gave 3 apples to her friend everyday for a week. How many apples does she have left?
def solve() -> int: apples = 45 apples_given_per_day = 3 days_given = 7 result = apples - (apples_given_per_day * days_given) return result
Ethan's fish tank had 75% of the fish he normally keeps, but the remaining 25% died. If he usually keeps 60 fish, how many died this time?
def solve() -> int: total_fish = 60 initial_fish = total_fish / 0.75 died_fish = initial_fish * 0.25 result = died_fish return result
A train travels at a speed of 90 km/h. How long does it take to travel 500 km?
def solve() -> int: speed = 90 distance = 500 time_taken = distance / speed result = time_taken return result
Avery picked 70 apples. Twenty-eight of the apples were red and green, twenty of the apples were yellow and red, and twenty-two of the apples were yellow and green. How many more apples contained the color yellow than contained the color green?
def solve() -> int: red_green = 28 yellow_red = 20 yellow_green = 22 total_apples = 70 red_apples = red_green - yellow_red - yellow_green + total_apples yellow_apples = yellow_red + yellow_green - red_green green_apples = total_apples - red_apples - yellow_apples diff...
Possible questions and programs are: Lisa bought 3 boxes of cookies, each containing 24 pieces. She wants to share them equally among her 4 friends. How many cookies will each friend get?
def solve() -> int: total_cookies = 3 * 24 cookies_per_friend = total_cookies / 4 result = cookies_per_friend return result
A store owner set a 50% discount on a shirt. The original price of the shirt was $20. After a discount, what is the price of the shirt?
def solve() -> int: original_price = 20 discount_percent = 0.5 discount_amount = original_price * discount_percent price_after_discount = original_price - discount_amount result = price_after_discount return result
If a sandwich costs $5, and Josh spends $30 on sandwiches, how many sandwiches did Josh buy?
def solve() -> int: cost_per_sandwich = 5 total_spent = 30 sandwiches_bought = total_spent / cost_per_sandwich result = sandwiches_bought return result
Student: Ella can read a book at a speed of 40 pages per hour and a magazine at a speed of 60 pages per hour. She read 4 books, each of which had 200 pages, and 3 magazines, each of which had 80 pages. How much time did she spend reading?
def solve() -> int: book_speed = 40 magazine_speed = 60 book_pages = 200 magazine_pages = 80 book_number = 4 magazine_number = 3 total_pages = book_number * book_pages + magazine_number * magazine_pages book_time = book_number * book_pages / book_speed magazine_time = magazine...
Amy has 48 beads to make a necklace. She uses 3/8 of the beads to make the first part of the necklace and then adds 4 more beads. How many beads does she have left to finish the necklace?
def solve() -> int: beads = 48 fraction_used = 3/8 beads_added = 4 beads_used = beads * fraction_used + beads_added beads_left = beads - beads_used result = int(beads_left) return result
A doctor saw 50 patients on Monday. On Tuesday, 10 patients didn't show up, and twice as many patients as the day before visited the doctor. On Wednesday, 80 patients visited the doctor, and 2 new patients arrived. How many patients are currently in the doctor's office?
def solve() -> int: monday_patients = 50 tuesday_no_show = 10 tuesday_patients = 2 * (monday_patients - tuesday_no_show) wednesday_patients = 80 + 2 total_patients = monday_patients + tuesday_patients + wednesday_patients result = total_patients return result
Student: Maya is starting a new job with a salary of $4000 a month. She has to pay 25% of her income in taxes, 10% in health insurance, and 5% in retirement contributions. She also wants to spend $1200 a month on rent, $500 a month on groceries, and $300 a month on utilities. After she pays for her bills and deductions...
def solve() -> int: salary = 4000 taxes = salary * 0.25 health_insurance = salary * 0.1 retirement_contributions = salary * 0.05 rent = 1200 groceries = 500 utilities = 300 total_bills_and_deductions = taxes + health_insurance + retirement_contributions + rent + groceries + utilities ...
If a ticket to a show costs $10 for adults and $5 for children, a total of 100 tickets have been sold, and the show has made $650, how many of the tickets are for adults and how many are for children?
def solve() -> int: for i in range(101): adult_tickets = i child_tickets = 100 - i if (10*adult_tickets) + (5*child_tickets) == 650: break result = (adult_tickets, child_tickets) return result
There are 800 students in a school. If 60% of the students are girls, how many boys are there in the school?
def solve() -> int: total_students = 800 girl_percent = 0.6 boy_percent = 1 - girl_percent boys = total_students * boy_percent result = boys return result
Leo is baking cookies. He has a recipe that makes 24 cookies with 2 cups of flour, 1 cup of sugar, and 0.5 cup of butter. He wants to make 36 cookies with the same recipe, but he only has 1.5 cups of flour left. How much sugar and butter does he need?
def solve() -> int: flour = 1.5 sugar = 1.5 butter = 0.5 ratio = 1.5 / 3 result = (sugar - ratio * sugar, butter - ratio * butter) return result
Alex can walk the first 150m of a race in 30 seconds and the second 150m of a race in 24 seconds. If Johnny walks the entire 300m of the race with the same speed, how long would it take him?
def solve() -> int: distance1 = 150 time1 = 30 distance2 = 150 time2 = 24 velocity1 = distance1 / time1 velocity2 = distance2 / time2 velocity3 = (distance1 + distance2) / (time1 + time2) time3 = 300 / velocity3 result = time3 return result
Samantha is a chef and wants to make lasagna for a dinner party. Her recipe yields 6 servings with 1 lb of beef. If she is having 12 guests over and wants to have 2 servings per person, how many pounds of beef does she need?
def solve() -> int: servings_per_lb = 6 guests = 12 servings_per_person = 2 total_servings = guests * servings_per_person lbs_of_beef = total_servings / servings_per_lb result = lbs_of_beef return result
A store has 50 apples and sells 20 apples. How many apples do they have now?
def solve() -> int: apples = 50 apples_sold = 20 apples_left = apples - apples_sold result = apples_left return result
Student: A bakery has 360 cupcakes to sell. If they sold 3/10 in the morning, then 7/12 in the afternoon, and 2/15 in the evening, how many cupcakes are left unsold?
def solve() -> int: morning_sold = 360 * 3/10 afternoon_sold = 360 * 7/12 evening_sold = 360 * 2/15 total_sold = morning_sold + afternoon_sold + evening_sold result = 360 - total_sold return result
David wants to buy a set of towels. The set contains 6 towels and each towel costs $10. If David wants to buy 2 sets of towels and the store offers a 15% discount on the second set, how much does he save in total?
def solve() -> int: towels_per_set = 6 cost_per_towel = 10 num_sets = 2 total_cost = num_sets * towels_per_set * cost_per_towel discounted_cost = total_cost - (towels_per_set * cost_per_towel * 0.15) total_savings = total_cost - discounted_cost result = total_savings ...
Clara wants to learn how to speak Mandarin fluently. It takes her 3 years of studying to become conversational, and then four times as long to become proficient. Finally, she spends 1 year living in China, speaking only Mandarin. How many years does it take Clara to achieve her goal?
def solve() -> int: years_to_conversational = 3 years_to_proficient = 4 * years_to_conversational years_in_china = 1 total_years = years_to_conversational + years_to_proficient + years_in_china result = total_years return result
Student: 2. When making jelly, Tony needs 24 kg of apples to make 3 liters of jelly. How many kilos of apples are needed to make 4 liters of jelly?
def solve() -> int: apples_per_liter = 24/3 apples_for_4_liters = apples_per_liter * 4 result = apples_for_4_liters return result
Isla swam for 50 laps in the pool, then took a break and swam another 25 laps. On the second day, Isla swam 60 laps, which is double the number of laps she swam on the first day. And on the third day, she swam an additional 30 laps. What's the total number of laps Isla swam in these three days?
def solve() -> int: laps_first_day = 50 + 25 laps_second_day = laps_first_day * 2 laps_third_day = 30 total_laps = laps_first_day + laps_second_day + laps_third_day result = total_laps return result
Noah is making bracelets for his friends. He has 150 beads of different colors. He wants to use 1/6 of the beads for blue bracelets, 2/5 of the beads for green bracelets, and the rest for red bracelets. He uses 5 beads for each blue bracelet, 6 beads for each green bracelet, and 4 beads for each red bracelet. How many ...
def solve() -> int: blue_beads = 1/6 * 150 green_beads = 2/5 * 150 red_beads = 150 - blue_beads - green_beads blue_bracelets = blue_beads / 5 green_bracelets = green_beads / 6 red_bracelets = red_beads / 4 result = (blue_bracelets, green_bracelets, red_bracelets) return ...
A train travels 60 miles per hour for the first 4 hours, then 90 miles per hour for the next 2 hours, then 100 miles per hour for the last hour. What's the total distance it travels?
def solve() -> int: speed1 = 60 time1 = 4 distance1 = speed1 * time1 speed2 = 90 time2 = 2 distance2 = speed2 * time2 speed3 = 100 time3 = 1 distance3 = speed3 * time3 total_distance = distance1 + distance2 + distance3 result = total_distance return result
A farmer needs to transport 50 bags of fertilizer to a location 25 miles away. His pickup truck can carry 5 bags of fertilizer at a time. If he is driving at a speed of 30 miles per hour, how long will it take for him to complete the delivery?
def solve() -> int: bags_per_trip = 5 distance = 25 speed = 30 trips = 50 // bags_per_trip total_distance = distance * trips time_taken = total_distance / speed result = time_taken return result
A train traveling at 60 kilometers per hour left the station before a train traveling at 90 kilometers per hour. After 3 hours, they are 270 kilometers apart. How long ago did the first train leave the station?
def solve() -> int: distance_apart = 270 speed_diff = 90 - 60 time_diff = 3 time_elapsed = distance_apart / speed_diff + time_diff result = time_elapsed return result
A company is running a promotion offering 20% off a purchase. A customer makes a purchase of $500. How much money did the customer save?
def solve() -> int: total_cost = 500 discount_percent = 0.2 amount_saved = total_cost * discount_percent result = amount_saved return result
Student: **** An electronic item is marked at an original price of $1350. It is now being sold at a discounted price of $860. What is the total percentage of savings if the item is purchased at the discounted price?
def solve() -> int: original_price = 1350 discounted_price = 860 savings = original_price - discounted_price percentage_savings = (savings / original_price) * 100 result = percentage_savings return result
Alex is tasked with moving 560 paintings from a gallery to a museum. The museum charges a $120 fee, plus $8 for each painting that arrives undamaged. For any damaged paintings, Alex will have to pay $12 each. If 40 paintings arrive damaged, how much should Alex expect to be paid if the rest of the paintings arrive at t...
def solve() -> int: num_paintings = 560 fee = 120 undamaged_paintings = num_paintings - 40 undamaged_fee = undamaged_paintings * 8 damaged_fee = 40 * 12 total_fee = fee + undamaged_fee + damaged_fee result = total_fee return result
A company has budgeted $18,000 for a marketing campaign. If they spend $3,500 per platform for social media, how many platforms can they afford to advertise on?
def solve() -> int: num_platforms = 18000//3500 result = num_platforms return result
John owns a gym and wants to calculate the average weight of the equipment he has in his gymnasium. He has a bench press that weighs 75 kg, a squat rack that weighs 125 kg, and a treadmill that weighs 50 kg. If the dimensions of the bench press are 1.2m x 1.0m x 1.0m, what is the average weight per cubic meter of equip...
def solve() -> int: bench_press_weight = 75 squat_rack_weight = 125 treadmill_weight = 50 bench_press_dimensions = [1.2, 1.0, 1.0] bench_press_volume = bench_press_dimensions[0] * bench_press_dimensions[1] * bench_press_dimensions[2] total_equipment_weight = bench_press_weight + squat_rack_weigh...
A group of 20 students have a total of 10 red pencils and 6 blue pencils. If each student receives 1 red pencil and 1 blue pencil, how many more red pencils are needed?
def solve() -> int: total_students = 20 red_pencils = 10 blue_pencils = 6 pencils_per_student = 2 red_needed = (total_students * 1) - red_pencils result = red_needed return result
A truck carrying boxes of different weights weighs 3500 pounds in total. If each box weighs either 25 or 50 pounds, what is the minimum number of boxes that the truck is carrying?
def solve() -> int: total_weight = 3500 min_boxes = total_weight // 50 if (total_weight - min_boxes*50) % 25 == 0: min_boxes += 0 else: min_boxes += 1 result = min_boxes return result
If a rectangle has a length of 10 meters and a width of 5 meters, what is the area of the rectangle?
def solve() -> int: length = 10 width = 5 area = length * width result = area return result
John wants to buy a new bike that costs $250. He has saved $95 and his parents will give him $75. How much more does John need to buy the bike?
def solve() -> int: total_cost = 250 savings = 95 parents_contribution = 75 more_needed = total_cost - savings - parents_contribution result = more_needed return result
Student: A pizza has been sliced into 8 equal pieces. 2/8 pieces have pepperoni and the rest do not. Amy eats 1 randomly selected piece. What is the probability that her piece has pepperoni on it?
def solve() -> int: total_pieces = 8 pepperoni_pieces = 2 probability = pepperoni_pieces / total_pieces result = probability return result
Q2: John borrowed $8000 from Anne and promised a yearly interest rate of 16%. How much will he need to pay back after 2 years?
def solve() -> int: def calculate_total_repayment(amount, interest, years): total_repayment = amount * ((1 + (interest/100)) ** years) return total_repayment result = calculate_total_repayment(8000, 16, 2) return result
Twenty-five percent less than twice the total number of birds in a park have flown away. If there were 200 birds in the park, how many flew away?
def solve() -> int: total_birds = 200 twice_birds = 2 * total_birds percent_less = 0.25 flew_away = percent_less * twice_birds result = flew_away return result
Amelia is currently twice as old as her mother was when her mother retired. If her mother were still working, she would have retired at the age of 60. How old is Amelia's mother currently?
def solve() -> int: mother_retirement_age = 60 amelia_age = 2 * (mother_retirement_age - 0) result = amelia_age return result
Student: Emma and Lucas are assembling a bookshelf. Emma estimates it will take her 3 days, working 10 hours a day, while Lucas estimates it will take him 1 day, working 15 hours a day. How many hours in total will it take them to put together the bookshelf?
def solve() -> int: emma_days = 3 emma_hours = 10 lucas_days = 1 lucas_hours = 15 total_hours = (emma_days * emma_hours) + (lucas_days * lucas_hours) result = total_hours return result
A truck carries 720 pounds of gravel. If the truck is carrying 10 sacks, and each sack weighs the same amount, then how many pounds of gravel is in each sack?
def solve() -> int: total_gravel = 720 number_of_sacks = 10 gravel_in_each_sack = total_gravel / number_of_sacks result = gravel_in_each_sack return result
Cindy has 9 apples and she wants to bake pies with them. Each pie requires 3 apples and 2 cups of flour. She has 12 cups of flour in her pantry. How many pies can she bake?
def solve() -> int: apples_per_pie = 3 pies_from_apples = 9 // apples_per_pie flour_per_pie = 2 pies_from_flour = 12 // flour_per_pie pies = min(pies_from_apples, pies_from_flour) result = pies return result
If there are 40 students in a class and the ratio of boys to girls is 2:3, how many boys are in the class?
def solve() -> int: total_students = 40 boy_to_girl_ratio = 2/3 boys = boy_to_girl_ratio/(1+boy_to_girl_ratio)*total_students result = boys return result
A class has 25 students. If 13 of them are girls, how many boys are there?
def solve() -> int: num_students = 25 num_girls = 13 num_boys = num_students - num_girls result = num_boys return result
John has a salary of $4000. He spends 1/4 of his salary on rent, 1/5 on food and saves the remaining amount. How much money does John save each month?
def solve() -> int: salary = 4000 rent = salary/4 food = salary/5 savings = salary - rent - food result = savings return result
An ice cream truck sells 120 ice cream cones in one day. Each ice cream cone costs $2.50. How much does the ice cream truck make in one day?
def solve() -> int: revenue = 120 * 2.50 result = revenue return result
Michael requires $10 to have twice the money that Emma has. In contrast, Rachel has $75, which is 2.5 times as much as Emma. What is the combined money of all three of them?
def solve() -> int: emma_money = 75 / 2.5 michael_money = 2 * emma_money - 10 combined_money = emma_money + michael_money + 75 result = combined_money return result
If a car travels 390km on a full tank of gas, and it travels at an average speed of 65km/h, how long can it travel on a half tank of gas assuming the speed is the same?
def solve() -> int: distance_on_full_tank = 390 speed_of_car = 65 distance_on_half_tank = distance_on_full_tank / 2 time_on_half_tank = distance_on_half_tank / speed_of_car result = time_on_half_tank return result
Jasmine wants to bake cookies for her friends. She has 2 cups of flour, 1 cup of sugar, and 0.5 cups of butter. Her cookie recipe calls for 1 cup of flour, 0.5 cups of sugar, and 0.25 cups of butter per batch. How many batches can she make with her ingredients?
def solve() -> int: flour = 2 sugar = 1 butter = 0.5 flour_per_batch = 1 sugar_per_batch = 0.5 butter_per_batch = 0.25 batches_flour = flour // flour_per_batch batches_sugar = sugar // sugar_per_batch batches_butter = butter // butter_per_batch batches = min(batches_flour, batche...
A company made a profit of $30,000 last month. If the company spent $20,000 on salaries, what was the company's profit margin?
def solve() -> int: profit = 30000 salaries = 20000 profit_margin = (profit - salaries) / profit result = profit_margin return result
am has 15 books on his shelf. He borrows 5 books from the library and reads 2 books per day. He returns the library books after 3 days and buys 4 more books. How many books does Sam have on his shelf at the end of the week?
def solve() -> int: initial_books = 15 final_books = 0 final_books = initial_books + 5 final_books = final_books - 2 * 3 final_books = final_books - 5 final_books = final_books + 4 result = final_books return result
Jan is 10 years younger than Mikel. Mikel is twice as old as Ada. If Ada is 25 years old, what is their total age?
def solve() -> int: ada_age = 25 mikel_age = ada_age*2 jan_age = mikel_age - 10 total_age = ada_age + mikel_age + jan_age result = total_age return result
Student: A car traveled at a speed of 60km/h for 3 hours. How far did it go?
def solve() -> int: speed = 60 time = 3 distance = speed * time result = distance return result
Kara caught fish twice a day. In the morning, she got 23 fish and in the evening, she got 37 fish. She cooked 46 fish for her family. How many fish are left?
def solve() -> int: morning_fish = 23 evening_fish = 37 cooked_fish = 46 total_fish = morning_fish + evening_fish remaining_fish = total_fish - cooked_fish result = remaining_fish return result
Jenny swam for a total of 13 hours last week. If she decides to swim for 1½ hours each day for this week, how many fewer​ hours of swimming will she have for this week?
def solve() -> int: total_hours_last_week = 13 hours_per_day_this_week = 1.5 days_this_week = 7 total_hours_this_week = hours_per_day_this_week * days_this_week difference_in_hours = total_hours_last_week - total_hours_this_week result = difference_in_hours return result
Greg has 80 stamps. He gave 3/8 of his stamps to his friend and then bought 20 more stamps. After that, he gave 2/5 of his stamps to his mother. How many stamps does Greg have left?
def solve() -> int: stamps = 80 friend_stamps = stamps * 3 / 8 greg_stamps = friend_stamps + 20 mother_stamps = greg_stamps * 2 / 5 remaining_stamps = greg_stamps - mother_stamps result = remaining_stamps return result
Jacob has prepared cupcakes for his sister's birthday party and is putting them in containers. Most of the containers contain 3 cupcakes each and the remaining 9 cupcakes are put in smaller containers. If Jacob has prepared a total of 45 cupcakes, how many large containers did he use?
def solve() -> int: total_cupcakes = 45 cupcakes_per_container = 3 remaining_cupcakes = 9 large_containers = (total_cupcakes - remaining_cupcakes) // cupcakes_per_container result = large_containers return result
A rectangular area has dimensions 9 feet by 12 feet. A circular fountain with a diameter of 4 feet is to be placed in the center of the area, with at least 2 feet of space between the fountain and all edges. How much area of the rectangular space remains?
def solve() -> int: length = 12 width = 9 diameter = 4 radius = diameter/2 space_needed = 2 usable_length = length - 2*space_needed usable_width = width - 2*space_needed usable_area = usable_length * usable_width area_of_fountain = 3.14 * radius**2 remaining_area = usable_area - ...
During a day, Maya does 4 loads of laundry, each taking 40 minutes, and then does one more load that takes 25 minutes. How much time did she spend doing laundry in total?
def solve() -> int: num_loads = 5 time_per_load = 0 time_per_load += 40 time_per_load += 25 total_time = num_loads * time_per_load result = total_time return result
Student: The length of a rectangle is twice its width. If its perimeter is 48cm, what are the length and width of the rectangle?
def solve() -> int: length = 0 width = 0 perimeter = 48 width = 24/6 length = 2*width result = length + width return result
In a park with 800 people, 30% of the people are children, and 70% of the children have pets. How many children do not have pets?
def solve() -> int: people = 800 children_percentage = 0.3 pets_percentage = 0.7 children = people * children_percentage children_with_pets = children * pets_percentage children_without_pets = children - children_with_pets result = children_without_pets return result
A pet store offers a 10% discount for the amount exceeding $50 of a customer's total charge. Rachel bought a fish tank for $40, a bag of dog food for $15, and a cat tree for $75. How much will she pay for those items?
def solve() -> int: tank_price = 40 dog_food_price = 15 cat_tree_price = 75 total_price = tank_price + dog_food_price + cat_tree_price if total_price > 50: discount = (total_price - 50) * 0.1 final_price = total_price - discount else: final_price = total_price ...
Isabella was 40 inches tall last year. If she grew 3 inches more than her best friend who grew 5 inches last year, how tall is Isabella now?
def solve() -> int: isabella_last_year = 40 friend_growth = 5 isabella_growth = friend_growth + 3 isabella_now = isabella_last_year + isabella_growth result = isabella_now return result
A rectangle has length 10 cm and width 5 cm. What is the perimeter and area of the rectangle?
def solve() -> int: perimeter = 2 * (10 + 5) area = 10 * 5 result = (perimeter, area) return result
Nathan has 45 paperclips, and he adds 5 more paperclips to his collection. How many paperclips does he have now?
def solve() -> int: total_paperclips = 45 additional_paperclips = 5 total_paperclips_now = 0 total_paperclips_now = total_paperclips + additional_paperclips result = total_paperclips_now return result
The surface area of Jupiter is 200 square acres, and it is 10 times larger in diameter than Earth. The land on Jupiter is worth 2 times that of the land on Earth. If the total value of all the land on Earth is 50 billion dollars, what is the total value in billions of all the land on Jupiter?
def solve() -> int: earth_diameter = 1 jupiter_diameter = 10 jupiter_surface_area = 200 earth_surface_area = jupiter_surface_area / (jupiter_diameter ** 2) earth_total_land_value = 50 jupiter_land_price_ratio = 2 jupiter_total_land_value = earth_total_land_value * jupiter_land_price_ratio *...
A toy store has 95 stuffed animals. They order 27 more stuffed animals. How many stuffed animals does the toy store have now?
def solve() -> int: original_stuffed_animals = 95 new_stuffed_animals = 27 total_stuffed_animals = original_stuffed_animals + new_stuffed_animals result = total_stuffed_animals return result
Ava is training for a marathon. She runs 5 miles, then 2.5 miles, and then 7 miles. She later realizes that she ran 3 miles more than she intended. How far was Ava planning to run?
def solve() -> int: miles_run_1 = 5 miles_run_2 = 2.5 miles_run_3 = 7 total_miles_run = miles_run_1 + miles_run_2 + miles_run_3 intended_miles_run = total_miles_run - 3 result = intended_miles_run return result
There are 5 apples and 3 pears in a basket. Each apple weighs 150 grams and each pear weighs 200 grams. How much does the basket weigh if it is 250 grams by itself?
def solve() -> int: total_fruits = 5 + 3 apple_weight = 150 pear_weight = 200 apples_weight_total = apple_weight * 5 pears_weight_total = pear_weight * 3 fruits_weight_total = apples_weight_total + pears_weight_total basket_weight = 250 total_weight = fruits_weight...
Possible questions and programs: Amelia baked a cake and cut it into 16 equal pieces. She gave 3 pieces to her sister and 2 pieces to her brother. Then she ate 1/4 of the remaining cake. How many pieces of cake are left?
def solve() -> int: total_pieces = 16 sister_pieces = 3 brother_pieces = 2 remaining_pieces = total_pieces - sister_pieces - brother_pieces amelia_fraction = 1 / 4 amelia_pieces = amelia_fraction * remaining_pieces final_pieces = remaining_pieces - amelia_pieces ...
A family went on vacation, they rented a car for 14 days, the price for one day is $20, and the insurance cost 40% of the cost of renting the car for one day. How much did they spend in total?
def solve() -> int: price_day = 20 price_insurance = price_day*0.4 num_days = 14 cost_total = (price_day + price_insurance)*num_days result = cost_total return result
A store has 6 aisles in a row. Behind each aisle, there are 3 racks. There are three times as many mannequins as racks in the store. Each aisle can hold 100 items, each rack can hold 50 items, and each mannequin can hold 10 items. If these are the only items in the store, what is the maximum number of items that can be...
def solve() -> int: aisles = 6 racks_per_aisle = 3 mannequins_per_rack = 3 items_per_aisle = 100 items_per_rack = 50 items_per_mannequin = 10 total_items_per_aisle = items_per_aisle + (racks_per_aisle * items_per_rack) + (racks_per_aisle * mannequins_per_rack * items_per_mannequin)...
Student: 6) Carl purchased 4 shirts for $45 each and 2 pairs of shoes for $90 each. He received a 10% discount for the shirts and 8% discount for the shoes. What was the total cost of his purchase?
def solve() -> int: shirts = 4 shirt_price = 45 shoes = 2 shoe_price = 90 shirt_discount = 0.1 shoe_discount = 0.08 shirt_total = shirts * shirt_price shoe_total = shoes * shoe_price discount_total = shirt_total * shirt_discount + shoe_total * shoe_discount total_cost = shirt_tot...
The perimeter of a square garden is 80 meters and is divided into 4 equal sides. A gardener is walking at a speed of 5 meters per minute. After walking for 16 minutes, how many sides of the garden has he covered?
def solve() -> int: perimeter = 80 side_length = perimeter / 4 speed = 5 time = 16 distance_covered = speed * time sides_covered = distance_covered / side_length result = int(sides_covered) return result
Tom wants to divide a rope into 3 equal sections. The rope is 87 feet long. How many feet of rope will be in each section?
def solve() -> int: rope_length = 87 section_length = rope_length / 3 result = section_length return result
Jessica borrowed $1800 from her sister and promised to pay 10% annual interest compounded monthly. If Jessica doesn't make any payments, how much interest will she owe in the second month?
def solve() -> int: principal = 1800 monthly_rate = 0.1 / 12 interest_1 = principal * monthly_rate balance_1 = principal + interest_1 interest_2 = balance_1 * monthly_rate result = interest_2 return result
Eric has a leak in his water tank that drips 4 drops a minute into a bucket he placed under it. Each drop is 18 ml, and the bucket can hold 2.5 liters. How many minutes will it take for the bucket to be filled?
def solve() -> int: drops_per_minute = 4 drop_volume_ml = 18 bucket_capacity_liters = 2.5 bucket_capacity_ml = bucket_capacity_liters * 1000 drops_needed = bucket_capacity_ml / drop_volume_ml minutes_needed = drops_needed / drops_per_minute result = minutes_needed ret...
The local movie theater charges $8 for a matinee and $12 for evening shows. If Jeremy goes to one matinee and two evening shows, how much did he spend?
def solve() -> int: matinee_price = 8 evening_price = 12 num_matinees = 1 num_evening = 2 total_cost = (matinee_price * num_matinees) + (evening_price * num_evening) result = total_cost return result
If a rectangle has length 10 cm and a perimeter of 30 cm, what is its width?
def solve() -> int: length = 10 perimeter = 30 width = (perimeter / 2) - length result = width return result
Lucas is a barber earning $20 per haircut. He spends 15% of his earnings on new supplies for his shop. In January, he earned $1200. How much money does he have left after buying a new barber chair for $300?
def solve() -> int: earnings = 1200 haircut_price = 20 supplies_percentage = 0.15 new_barber_chair = 300 total_haircuts = earnings // haircut_price total_spent_on_supplies = earnings * supplies_percentage total_money_left = earnings - total_spent_on_supplies - new_barber_chair ...