question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Possible new questions: Nora baked 12 cupcakes for her friends and decorated each one with 3 candies. She bought the candies for $0.05 each from a store that had a 10% discount. How much did Nora spend on the candies?
def solve() -> int: total_candies = 12 * 3 original_price = 0.05 / 0.9 total_amount = original_price * total_candies total_amount = round(total_amount, 2) result = total_amount return result
Student: Alice is a tutor. She charges $25 per hour and gives a 20% discount to students who buy a package of 20 hours or more. A new student wants to buy a package of 24 hours. How much will he have to pay?
def solve() -> int: hours = 24 price_per_hour = 25 discount = 0.2 total_price_before_discount = hours * price_per_hour total_price_after_discount = total_price_before_discount * (1 - discount) result = total_price_after_discount return result
If it takes Roque 20 minutes to ride one kilomter, how many minutes does Roque spend riding his bike in a month?
def solve() -> int: total_weeks = 4 total_distance = 2 * total_weeks minutes_per_kilometer = 20 total_minutes = total_distance * minutes_per_kilometer result = total_minutes return result
Student: Jane was ill for five days last week, so she had to take medicine every day. If Jane bought 9 tablets in total and each tablet boxed contained of 15 tablets, how many boxes did Jane buy?
def solve() -> int: tablets = 9 box_size = 15 days = 5 boxes = (tablets + box_size - 1) // box_size result = boxes return result
If Lisa's sister was three times her age 12 years ago, and now Lisa's sister is 36 years old, how old is Lisa today?
def solve() -> int: lisa_sister_age = 36 lisa_sister_age_12_years_ago = lisa_sister_age - 12 lisa_age_12_years_ago = lisa_sister_age_12_years_ago / 3 lisa_age = lisa_age_12_years_ago + 12 result = lisa_age return result
A lemonade stand sold 80 cups of lemonade for $0.5 each and 20 bags of cookies for $1 each on Monday. On Tuesday, it sold 60 cups of lemonade and 30 bags of cookies. The lemonade stand had to pay $10 for the lemonade ingredients and $15 for the cookies ingredients for both days. It also had to pay $5 for the rent of th...
def solve() -> int: revenue_monday = 80 * 0.5 + 20 * 1 revenue_tuesday = 60 * 0.5 + 30 * 1 total_revenue = revenue_monday + revenue_tuesday total_cost = 10 + 15 + 5 * 2 total_profit = total_revenue - total_cost result = total_profit return result
Kevin had 30 books on his shelf. He added 4 more, but then his brother borrowed 6 of them. He bought 3 new books to replace them. How many books does Kevin have now?
def solve() -> int: books_on_shelf = 30 added_books = 4 borrowed_books = 6 replacement_books = 3 total_books = books_on_shelf + added_books - borrowed_books + replacement_books result = total_books return result
In the first hour, Bob puts in 7 coins and in each subsequent hour he puts in 5 more coins than he did in the previous hour. If he puts coins in the jar for 5 hours in total, how many coins are in the jar after the fifth hour?
def solve() -> int: coins_in_first_hour = 7 coins_in_second_hour = coins_in_first_hour + 5 coins_in_third_hour = coins_in_second_hour + 5 coins_in_fourth_hour = coins_in_third_hour + 5 coins_in_fifth_hour = coins_in_fourth_hour + 5 total_coins = coins_in_first_hour + coins_in_second_hour + coins...
Anna is 15 years now. Her friend Leo is 3 times Anna's age. In 2 years how old will Leo be?
def solve() -> int: anna_age = 15 leo_age = anna_age * 3 anna_age_2 = anna_age + 2 leo_age_2 = leo_age + 2 result = leo_age_2 return result
A recipe for a cake requires 8 eggs, 3 cups of flour, and 2 cups of sugar. Alice wants to bake 5 cakes for her friends. How many eggs, cups of flour, and cups of sugar does she need in total?
def solve() -> int: eggs = 8 * 5 flour = 3 * 5 sugar = 2 * 5 result = (eggs, flour, sugar) return result
At Golden Arch Enterprises, each employee gets 8 personal days and 16 vacation days per year. If Rachel uses a third of her personal days but all her vacation days in a year, how many hours' worth of days does she have left if each day covers a 12-hour long workday?
def solve() -> int: personal_days = 8 vacation_days = 16 used_personal_days = personal_days / 3 used_vacation_days = vacation_days total_days_used = used_personal_days + used_vacation_days hours_per_day = 12 hours_worth_of_days_left = (personal_days + vacation_days - tota...
Student: Mike bought a car for $6000 and sold it for $7500. How much did he make?
def solve() -> int: purchase_price = 6000 selling_price = 7500 profit = selling_price - purchase_price result = profit return result
Student: A survey in a school showed that 70% of students walk to school while 15% take the bus. If there are 400 students in the school, calculate the number who neither walk nor take the bus.
def solve() -> int: walk_percent = 0.7 bus_percent = 0.15 total_students = 400 walk_students = walk_percent * total_students bus_students = bus_percent * total_students neither_students = total_students - walk_students - bus_students result = neither_students return result
A pizza parlor makes 8 large pizzas every hour. They are open for 5 hours a day. If each pizza costs $12, how much money do they make in one day?
def solve() -> int: total_pizzas = 8 * 5 total_sales = total_pizzas * 12 result = total_sales return result
A store has a total of 80 items. There are 50 electronics and appliances combined, 10 jewelry and electronics combined, and 30 appliances and jewelry combined. How many electronics are there?
def solve() -> int: total_items = 80 electronics_appliances = 50 jewelry_electronics = 10 appliances_jewelry = 30 electronics = electronics_appliances - (jewelry_electronics + (appliances_jewelry - jewelry_electronics))/2 result = electronics return result
Student: A car travels at 50 miles per hour. How long will it take the car to travel a distance of 150 miles?
def solve() -> int: speed = 50 distance = 150 time = distance / speed result = time return result
Leo is renting a car for a road trip. He has to pay a base fee of $100 plus $0.2 per mile driven. He also has to pay 10% tax on the total amount. If Leo drove 350 miles, how much did he pay for the car rental?
def solve() -> int: before_tax = 100 + 350 * 0.2 tax = before_tax * 0.1 total = before_tax + tax result = total return result
John bought 500 meters of wire and cut it into 5-meter sections. He shared 1/5 of the wire with his neighbor and kept half of what was left for himself. How many meters of wire did John keep?
def solve() -> int: wire_length = 500 section_length = 5 shared_length = wire_length / 5 remaining_length = wire_length - shared_length kept_length = remaining_length / 2 result = kept_length return result
Noah has 48 crayons of different colors. He gives 10 of them to his sister and breaks 3 of them by accident. He then uses 20% of his remaining crayons to draw a picture. How many crayons does he have left after drawing the picture?
def solve() -> int: crayons_left = 48 - 10 - 3 crayons_used = crayons_left * 0.2 crayons_left = crayons_left - crayons_used result = crayons_left return result
Student: Ella bought 16 stickers for $4. She gave half of them to her friend and then bought 8 more stickers for $2. How much money did she spend per sticker in total?
def solve() -> int: stickers_bought = 16 price_per_sticker = 4 stickers_given = stickers_bought / 2 stickers_bought_2 = 8 price_per_sticker_2 = 2 total_money_spent = (stickers_bought * price_per_sticker) + (stickers_bought_2 * price_per_sticker_2) total_stickers_bought = stickers_bought + st...
In a group of 220 students, 5/11 of them are interested in math, 4/27 of them got less than a C in their last math exam and 18 of them failed it. How many students passed their math exam?
def solve() -> int: totalNumberOfStudents= 220 percentageInterest = 5/11 percentageBelowC = 4/27 numberFailed = 18 numberInterest = totalNumberOfStudents*percentageInterest numberBelowC = numberInterest - numberFailed numberBelowC = numberBelowC*percentageBelowC result = n...
The length of a rectangle is three times its width. If the area of the rectangle is 54 square meters, what are the dimensions of the rectangle?
def solve() -> int: area = 54 ratio = 3 width = (area/ratio)**0.5 length = width*ratio result = (length, width) return result
Samantha saves 15 dollars every time she receives her allowance. She gets her allowance every Sunday over the span of two weeks. On the third Sunday, she forgets to save any money. How much money did she save during those two weeks?
def solve() -> int: allowance = 15 weeks = 2 total_allowance = allowance * 2 forgotten_allowance = 0 total_saved = total_allowance - forgotten_allowance result = total_saved return result
Mark buys 10 pounds of potatoes for $2.99 per pound, 5 packages of frozen chicken for $6.00 each and 4 cartons of eggs at $1.50 each. How much does he spend?
def solve() -> int: cost_potatoes = 10 * 2.99 cost_chicken = 5 * 6 cost_eggs = 4 * 1.50 result = cost_potatoes + cost_chicken + cost_eggs return result
Some possible questions and programs are: - Mr. Lee bought 36 apples and 48 oranges from the market. He gave 9 apples and 12 oranges to his neighbor. He then divided the remaining fruits equally among his 3 children. How many oranges did each child get?
def solve() -> int: apples_left = 36 - 9 oranges_left = 48 - 12 apples_per_child = apples_left // 3 oranges_per_child = oranges_left // 3 result = oranges_per_child return result
Student: You are baking a cake and the recipe calls for 2 cups of sugar. If you only have a quarter cup measuring cup, how many times do you have to use it to measure 2 cups of sugar?
def solve() -> int: quarter_cup = 0.25 total_cups = 2 num_times = total_cups / quarter_cup result = num_times return result
Lisa has 24 pairs of socks in her drawer. For every pair, one of the socks is of a different color. How many individual socks does she have?
def solve() -> int: pairs_of_socks = 24 individual_socks = pairs_of_socks * 2 result = individual_socks return result
A rectangle has a length that is 3 times its width. The perimeter is 64. What is the area of the rectangle?
def solve() -> int: perimeter = 64 width = perimeter / 8 length = width * 3 area = width * length result = area return result
A garden is 30 feet wide and 40 feet long. If each square foot of the garden requires 2 pounds of fertilizer, how many pounds of fertilizer are needed for the entire garden?
def solve() -> int: width = 30 length = 40 area = width * length pounds_per_square_ft = 2 total_pounds = area * pounds_per_square_ft result = total_pounds return result
Possible new questions: A group of students went on a field trip to the zoo. They saw four different kinds of animals: lions, elephants, giraffes, and monkeys. They counted 12 lions, 8 elephants, and 16 giraffes. The number of monkeys was twice the number of lions. How many animals did they see in total?
def solve() -> int: lions = 12 elephants = 8 giraffes = 16 monkeys = 2 * lions total = lions + elephants + giraffes + monkeys result = total return result
9. On Monday Lisa has 78 marbles and she gives away a half of them on Tuesday. On Wednesday she buys 10 marbles and then gives away a third of what she has after Wednesday. How many marbles does Lisa have on Thursday?
def solve() -> int: marbles = 78 given_away_1 = marbles / 2 bought = 10 given_away_2 = (marbles - given_away_1 + bought) / 3 result = marbles - given_away_1 + bought - given_away_2 return result
Kevin buys a pull-up bar. It weighed 55 pounds and worked well for him in the beginning but after a bit of training he decides he wants to increase the weight by 70%. The weights come in 2-pound iron plates. Each plate cost $7 and if you buy more than 6 you get a 8% discount. How much does it cost to get the weight he ...
def solve() -> int: initial_weight = 55 increase_percentage = 70 new_weight = initial_weight + (initial_weight * increase_percentage / 100) plate_weight = 2 desired_weight = new_weight - initial_weight number_of_plates = desired_weight / plate_weight plate_cost = 7 discount_thr...
A phone plan offers unlimited data for $90 per month. However, if you don't use more than 10GB of data, you can instead pay only $50 per month. If a person typically uses 8GB of data per month but for one month uses 15GB, how much money will they save by paying for the plan that matches their monthly usage rather than ...
def solve() -> int: unlimited_price = 90 limited_price = 50 limited_data_allowance = 10 normal_data_usage = 8 special_data_usage = 15 normal_plan_cost = limited_price if normal_data_usage <= limited_data_allowance else unlimited_price special_plan_cost = limited_price if special_data_usage <...
A farmer harvested 300 bushels of corn. He harvested four times as many bushels in field A as he did in field B. He harvested 8 more bushels in Field B than he did in Field C. How many bushels did he harvest in Field A?
def solve() -> int: field_B = 300 / (4 + 1 + 1) field_C = field_B - 8 field_A = 4 * field_B result = field_A return result
A bus travels 150 miles in 3 hours. What is the average speed of the bus?
def solve() -> int: distance_traveled = 150 time_taken = 3 average_speed = distance_traveled / time_taken result = average_speed return result
In a race between Mark, Ethan, and Sophia, Mark finishes the race in 80 seconds. Ethan takes 15 more seconds than Mark to finish the race. If Sophia is as fast as Ethan and Mark combined, how long does it take her to finish the race?
def solve() -> int: mark_time = 80 ethan_time = mark_time + 15 sophia_time = mark_time + ethan_time result = sophia_time return result
If Michael uses 10 oranges to make 2 cups of fresh juice, how many oranges does he need to make 10 cups of fresh juice?
def solve() -> int: oranges_for_2_cups = 10 cups_needed = 10 oranges_needed = (cups_needed / 2) * oranges_for_2_cups result = oranges_needed return result
On the first day, Katrina walks 3 miles. Each subsequent day, she walks 0.5 miles farther than the previous day. If she walks for 7 days straight, how many miles will she have walked in total?
def solve() -> int: miles_walked = 0 for i in range(7): miles_walked += 3 + i*0.5 result = miles_walked return result
Student: A man can walk 6 km/hour and run 10 km/hour. If he covers 50 km in a total of 6 hours, how many kilometers did he walk and how many did he run?
def solve() -> int: walking_speed = 6 running_speed = 10 total_distance = 50 total_time = 6 distance_walked = total_time * walking_speed distance_run = total_time * running_speed - distance_walked result = distance_walked + distance_run return result
Chris' car travel 22 miles per gallon of gas. If the trip is 345 miles long, how many gallons of gas will the car consume for the entire trip?
def solve() -> int: miles_per_gallon = 22 trip_distance = 345 gallons_required = trip_distance / miles_per_gallon result = gallons_required return result
Student: A rectangular field is 15 meters long and 10 meters wide. What is the area of the field in square meters?
def solve() -> int: length = 15 width = 10 area = length * width result = area return result
Student: Emma has $3.84 in her wallet. She is going to buy a pack of gum which costs $1.00. How much money will Emma have after she buys the pack of gum?
def solve() -> int: amount_in_wallet = 3.84 cost_of_gum = 1.00 result = amount_in_wallet - cost_of_gum return result
Emma is planning a vacation. A round-trip plane ticket costs $600 and a hotel room for a week costs $800. The airline and hotel both have a promotion if booked between 1 pm and 4 pm. The airline is offering a 25% discount on tickets and the hotel is offering a 30% discount on rooms. How much money can Emma save by book...
def solve() -> int: ticket_price = 600 hotel_price = 800 airline_discount = 0.25 hotel_discount = 0.3 discounted_ticket_price = ticket_price * (1 - airline_discount) discounted_hotel_price = hotel_price * (1 - hotel_discount) total_discounted_price = discounted_ticket_price + ...
Jenny has 36 apples. She wants to divide them equally between her 4 friends. However, she only has 9 apples left after she did that. How many apples were there at the beginning?
def solve() -> int: total_apples = 36 number_of_friends = 4 apples_left = 9 apples_per_friend = total_apples / number_of_friends initial_apples = (apples_per_friend * (number_of_friends + 1)) + apples_left result = initial_apples return result
Given that the sum of two numbers is 26 and their difference is 4, what is the product of the two numbers?
def solve() -> int: a = 15 b = 11 sum = a + b difference = a - b product = a * b result = product return result
At the beginning of the year, the choir had 30 new members join. However, by the end of the year, 1/8 of the members left the group. If 240 members were in the choir before the new members joined, how many members were left at the end of the year?
def solve() -> int: members_at_start = 240 new_members = 30 total_members = members_at_start + new_members members_left = total_members - (total_members / 8) result = members_left return result
Mark earns $9 per hour and works 10 hours per day. His manager is asking him to work an extra hour that promises him an extra seventy five percent on top of his hourly rate. How much money will he earn after a month if he renders overtime each day?
def solve() -> int: hourly_rate = 9 overtime_rate = hourly_rate * 1.75 hours_worked_per_day = 10 days_in_month = 30 total_earning = (hours_worked_per_day * days_in_month * hourly_rate) + (days_in_month * overtime_rate) result = total_earning return result
Sophia wants to ride the log flume at the water park. The minimum height to ride the log flume is 150 cm. Sophia's friend is 170 cm, Sophia is 3/4 the height of her friend. How many more centimeters does Sophia need to grow to ride the log flume?
def solve() -> int: friend_height = 170 sophia_height = friend_height * 3/4 minimum_height = 150 height_difference = minimum_height - sophia_height result = height_difference return result
Alice buys a shirt for $25 and a jacket for $80. The sales tax rate is 9%. If she gives a 15% tip on the pre-tax amount, how much does Alice pay in total?
def solve() -> int: shirt_price = 25 jacket_price = 80 sales_tax_rate = 0.09 tip_rate = 0.15 subtotal = shirt_price + jacket_price sales_tax = subtotal * sales_tax_rate subtotal_with_tax = subtotal + sales_tax tip_amount = subtotal * tip_rate total = subtotal_with_tax + tip_amount ...
Maria hopes to save $10,000 by the end of the year to buy a new car. Currently, she has saved $4,500. How much does she need to save each month for the next four months to reach her goal?
def solve() -> int: goal = 10000 current_savings = 4500 months_left = 4 amount_needed = goal - current_savings monthly_savings = amount_needed / months_left result = monthly_savings return result
In a toy store, there are 60 total puzzles. One-third of the puzzles are 50 pieces, and the rest of them are 100 pieces. If there are twice as many 100-piece puzzles as there are 50-piece puzzles, how many 50-piece puzzles are there?
def solve() -> int: total_puzzles = 60 num_50_piece_puzzles = total_puzzles / 3 num_100_piece_puzzles = total_puzzles - num_50_piece_puzzles num_100_piece_puzzles = 2 * num_50_piece_puzzles num_50_piece_puzzles = (total_puzzles - num_100_piece_puzzles) / 3 result = num_50_piece_puzzles retur...
Student: Darla has 78000 watermelon seeds. She needs to use 3568 seeds per planting zone. How many planting zones can she fill with all her watermelon seeds?
def solve() -> int: seeds = 78000 seeds_per_zone = 3568 zones = seeds // seeds_per_zone remainder = seeds % seeds_per_zone result = zones return result
Amy gave $150 for 10 pizzas. Each pizza costs $10. After the pizza arrived, Amy found out she had given 10 more dollars than what was necessary. How much money did she actually need to spend on those pizzas?
def solve() -> int: original_payment = 150 original_price_each_pizza = 10 actual_payment = original_payment - 10 actual_price_each_pizza = actual_payment / 10 result = actual_price_each_pizza return result
John runs 800 meters in 4 minutes and 30 seconds, and then walks 500 meters in 6 minutes and 15 seconds. How far did he go in total?
def solve() -> int: run_dist = 800 run_time = 4*60 + 30 walk_dist = 500 walk_time = 6*60 + 15 total_dist = run_dist + walk_dist total_time = run_time + walk_time result = total_dist return result
Samantha bought 4 liters of ice cream. If she finishes everything in a week, calculate how much ice cream she consumes per day if she already consumed 3 cups of ice cream.
def solve() -> int: liters_of_ice_cream = 4 days_in_a_week = 7 cups_of_ice_cream_consumed = 3 liters_per_day = (liters_of_ice_cream * 1000 - cups_of_ice_cream_consumed * 250) / days_in_a_week result = liters_per_day return result
Student: Wendy has 7 cans of juice. In each can, there are 28mL of juice. She needs to pour 210 mL for her friend. How many cans does she need to pour?
def solve() -> int: cans_of_juice = 7 ml_per_can = 28 ml_for_friend = 210 ml_total = cans_of_juice * ml_per_can cans_needed = ml_for_friend / ml_per_can result = round(cans_needed) return result
Tim had 150 pieces of construction paper. If he used 20 pieces of construction paper each day, how many pieces of construction paper did he have left after 10 days?
def solve() -> int: total_paper = 150 paper_used_each_day = 20 paper_used = paper_used_each_day * 10 paper_left = total_paper - paper_used result = paper_left return result
Kelly used 1/6 of her income on transportation and then spent 1/3 of the remaining amount to buy groceries. If she has $100 left, what was her initial income?
def solve() -> int: income = 100 transportation = income * (1/6) remaining_amount = income - transportation groceries = remaining_amount * (1/3) remaining_amount -= groceries initial_income = remaining_amount + 100 result = initial_income return result
A company produces 500 widgets per day. If they work for 8 hours every day, how many widgets do they make per hour on average?
def solve() -> int: widgets_per_hour = 500/8 result = widgets_per_hour return result
Student: If the ratio of boys to girls in a classroom is 2:3, and there are 30 students in the class, how many boys are there?
def solve() -> int: ratio = 2 / 3 total = 30 boys = ratio * total boys = round(boys) result = boys return result
Possible new questions with Python programs: Max spends 25% of his allowance on candy, 15% on books, and saves the rest. If he gets $12 allowance every week, how much does he save in a month (4 weeks)?
def solve() -> int: candy_percent = 0.25 books_percent = 0.15 allowance = 12 candy_amount = candy_percent * allowance books_amount = books_percent * allowance save_amount = allowance - candy_amount - books_amount save_month = save_amount * 4 result = save_month return result
Stephanie is 29 and her husband Daniel is 40 years old. Their daughter, Grace, was born when Daniel was 28. How old was Stephanie when Grace was born?
def solve() -> int: stephanie_age = 29 daniel_age = 40 grace_age = daniel_age - (daniel_age - 28) stephanie_age_when_grace_born = stephanie_age - (daniel_age - grace_age) result = stephanie_age_when_grace_born return result
- A rectangular garden has a length of 18 meters and a width of 12 meters. The garden is divided into four equal parts by two paths that cross at the center. The paths are each 1 meter wide. How much area of the garden is covered by the paths?
def solve() -> int: garden_area = 18 * 12 part_area = (18 - 1) * (12 - 1) / 4 parts_area = part_area * 4 paths_area = garden_area - parts_area result = paths_area return result
Jane is taking a road trip from City A to City B. The distance from City A to a stop at City C is 120 miles, and it takes her 2 hours to reach City C. From City C to City B, the distance is twice that of City A to City C, and it takes 5 hours to reach City B. If Jane's average speed is constant throughout the entire tr...
def solve() -> int: distance_A_C = 120 time_A_C = 2 distance_C_B = 2 * distance_A_C time_C_B = 5 total_distance = distance_A_C + distance_C_B total_time = time_A_C + time_C_B average_speed = total_distance / total_time result = average_speed return result
Student: An ice cream shop sold 600 cones last month. If 40% of the cones were vanilla, how many cones were vanilla?
def solve() -> int: total_cones = 600 vanilla_percentage = 0.4 vanilla_cones = total_cones * vanilla_percentage result = vanilla_cones return result
A car travels 75 miles in the first hour of driving, 65 miles in the second hour and 85 miles in the third hour. What is the average speed of the car in miles per hour?
def solve() -> int: total_distance = 75 + 65 + 85 total_time = 3 avg_speed = total_distance / total_time result = avg_speed return result
Jack has $25 to buy three different types of ice creams: chocolate, vanilla, and strawberry, each costing 1.5 dollars, 2 dollars, and 2.5 dollars, respectively. Jack has 2 coupons for 50 cents off a single ice cream per coupon. If Jack used all his coupons, and bought 4 chocolate, 3 vanilla, and 2 strawberry ice creams...
def solve() -> int: chocolate_price = 1.5 vanilla_price = 2 strawberry_price = 2.5 chocolate_quantity = 4 vanilla_quantity = 3 strawberry_quantity = 2 coupon_discount = 0.5 coupon_quantity = 2 total_cost = (chocolate_price * chocolate_quantity) + (vanilla_price * vanil...
Student: Laura has 3 red blocks, 8 blue blocks, and 2 white blocks. She adds 6 more red and 4 more blue blocks. If she randomly takes out one of the blocks, what is the percentage chance it is blue?
def solve() -> int: red_blocks = 3 blue_blocks = 8 white_blocks = 2 red_blocks += 6 blue_blocks += 4 total_blocks = red_blocks + blue_blocks + white_blocks blue_chance = (blue_blocks / total_blocks) * 100 result = blue_chance return result
Kyle filled half of his gas tank with gas on Monday. The next day, he added 5 more gallons. He now has a full tank consisting of 15 gallons. How many gallons was the tank when it was empty?
def solve() -> int: half_tank = 15 - 5 empty_tank = half_tank * 2 result = empty_tank return result
A book collector had 20 books, but gave away 9 of them to a friend. Then, the collector bought 6 more books from a used book store. How many books does the collector have now?
def solve() -> int: books_initial = 20 books_given_away = 9 books_bought = 6 books_final = books_initial - books_given_away + books_bought result = books_final return result
Do not include any other symbols expect **numbers, letters, SPACE, commas, dots, question marks, [], ',{} / + - * ** // %, ==, =, sym, result**. Here are some possible questions and programs: A farmer has 12 chickens and 6 ducks in his farm. He sells half of his chickens and a quarter of his ducks. He then buys 4 more ...
def solve() -> int: chickens = 12 ducks = 6 chickens_sold = chickens // 2 ducks_sold = ducks // 4 chickens_left = chickens - chickens_sold ducks_left = ducks - ducks_sold chickens_bought = 4 ducks_bought = 3 chickens_final = chickens_left + chickens_bought ducks_final = ducks_lef...
80% of Foobie's friends are girls. If he has 36 friends who are girls, how many friends does he have in total?
def solve() -> int: total_friends = 0 total_girls = 36 percentage = 80 girls = total_girls boys = total_friends - girls total_friends = girls / (percentage/100) result = total_friends return result
Robert has 52 pieces of candy. He divided them equally among his 4 friends. How many pieces of candy did each friend receive?
def solve() -> int: candy = 52 friends = 4 equal_candy = candy//friends result = equal_candy return result
Ali has a rectangular garden that measures 11 meters by 7 meters. He wants to add a border of equal width around the garden. If he has enough soil to cover 75 square meters, what is the width of the border he should add?
def solve() -> int: length = 11 width = 7 total_area = length * width area_to_cover = 75 border_width = (area_to_cover + total_area)**0.5 - length - width result = border_width return result
Jenny wanted to make cupcakes and she had sourced 18 chocolate bars with 3 pieces in each bar. How many pieces of chocolate did Jenny need for the cupcakes?
def solve() -> int: chocolate_bars = 18 pieces_in_bar = 3 total_pieces = chocolate_bars * pieces_in_bar result = 54 return result
Matthew throws 18 dimes into the wishing pond. Julia flips 1 quarter into the pond. Michael throws in 5 nickels. Leah then drops 150 pennies in. If Julia dips her hands into the water and pulls out a quarter, how much money, in cents, did they put into the pond?
def solve() -> int: dimes = 18 quarter = 1 nickels = 5 pennies = 150 total_money = (dimes * 10) + (quarter * 25) + (nickels * 5) + (pennies * 1) result = total_money return result
If a classroom has 30 students and each student has 3 pencils, how many pencils are there in total?
def solve() -> int: students = 30 pencils_per_student = 3 total_pencils = students * pencils_per_student result = total_pencils return result
A rope 60 meters long is cut into two pieces. One piece is 32 meters longer than the other. What is the length of the shorter piece?
def solve() -> int: total_length = 60 difference = 32 longer_piece = (total_length + difference) / 2 shorter_piece = total_length - longer_piece result = shorter_piece return result
A recipe calls for 2 cups of flour and 1 cup of sugar. If you want to make 3 batches of the recipe, how many cups of sugar will you need?
def solve() -> int: sugar_per_batch = 1 total_batches = 3 total_sugar = sugar_per_batch * total_batches result = total_sugar return result
Mr. Johnson has $6500 to invest this year. If he invests $3000 in low risk stocks at 5% interest and the rest in high risk stocks at 10% interest, how much money did he invest in high risk stocks?
def solve() -> int: total_investment = 6500 investment_in_low_risk_stocks = 3000 interest_rate_for_low_risk = 5/100 money_in_low_risk = investment_in_low_risk_stocks*(1+interest_rate_for_low_risk) money_in_high_risk = total_investment - money_in_low_risk result = money_in_high_risk return re...
If a recipe calls for 1/2 cup of sugar and you need to make 4 servings, how much sugar will you need in total?
def solve() -> int: servings = 4 sugar_per_serving = 1/2 total_sugar = servings * sugar_per_serving result = total_sugar return result
Student: Maria bought 5 apples from the store, each costing her $2. She gave the storekeeper a $20 bill. How much change did she get?
def solve() -> int: num_apples = 5 price_per_apple = 2 amount_paid = 20 total_cost = num_apples * price_per_apple change = amount_paid - total_cost result = change return result
Student: Ryan has a square cake that has a side length of 10 inches. He wants to cut the cake into 16 equal pieces and frost each piece with a different color. He wants to use one-fifth of the frosting for the red color. How many square inches of the cake will be frosted with red?
def solve() -> int: side_length = 10 num_pieces = 16 piece_area = (side_length ** 2) / num_pieces red_frosting = piece_area / 5 total_red_frosting = red_frosting * num_pieces result = total_red_frosting return result
Zoe and Leo are playing with toy cars. Leo has 5 cars, while Zoe has 20 cars. How many more toy cars does Zoe have than Leo?
def solve() -> int: leo_cars = 5 zoe_cars = 20 more_cars = zoe_cars - leo_cars result = more_cars return result
A rectangular garden has a length of 10 feet and a width of 8 feet. What is the perimeter of the garden in inches?
def solve() -> int: length = 10 width = 8 perimeter = 2 * (length + width) * 12 result = perimeter return result
On Wednesday, Peter is going to clean his car. First, he needs to vacuum the inside, scrub the windows, and wash the exterior. If each task takes 25 minutes to complete and there are a total of 9 tasks, how many total hours will Peter spend cleaning his car? Kim has a flower garden where she receives flower donations f...
def solve() -> int: tasks = 9 time_per_task = 25 total_time = tasks * time_per_task total_hours = total_time / 60 initial_donations = 150 new_donors = 5 flowers_per_donor = 13 new_donations = new_donors * flowers_per_donor total_donations = initial_donations + new_donations ...
Student: Shane and Shannon are shopping for a party. They buy 6 bags of chips, 4 quarts of dip, and 5 dozen pretzels. Bags of chips cost $3 each, quarts of dip are $4 each, and dozen of pretzels are $2 each. How much did they spend in total?
def solve() -> int: bags_of_chips = 6 quarts_of_dip = 4 dozen_of_pretzels = 5 price_of_chips = 3 price_of_dip = 4 price_of_pretzels = 2 cost_of_chips = bags_of_chips * price_of_chips cost_of_dip = quarts_of_dip * price_of_dip cost_of_pretzels = dozen_of_pretzels * price_of_pretzels ...
The cost of a TV is decreased by 20% and the cost of a DVD player is increased by 30%. If the original cost of the TV was $800 and the DVD player was $200, what is the new total price?
def solve() -> int: tv_price = 800 dvd_price = 200 tv_decrease = 0.2 dvd_increase = 0.3 new_tv_price = tv_price - (tv_price*tv_decrease) new_dvd_price = dvd_price + (dvd_price*dvd_increase) total_price = new_tv_price + new_dvd_price result = total_price return result
A piece of cloth has a length of 7 meters and a width of 1.5 meters. If the cloth is sold for $12.50 per square meter, how much does it cost?
def solve() -> int: length_of_cloth = 7 width_of_cloth = 1.5 price_per_square_meter = 12.5 area_of_cloth = length_of_cloth * width_of_cloth total_cost_of_cloth = area_of_cloth * price_per_square_meter result = f'${total_cost_of_cloth}' result = total_cost_of_cloth return result
A rectangle has a length of 10 inches and a width of 5 inches. What is the perimeter of the rectangle?
def solve() -> int: length = 10 width = 5 perimeter = 2*length + 2*width result = perimeter return result
Student: John invested $1000 at 5.5% annual interest rate for 5 years. What is the total amount John will have at the end of the 5 years?
def solve() -> int: principal = 1000 rate = 0.055 time = 5 interest = principal * rate amount = principal + interest * time result = amount return result
Ryan went out for lunch and ordered a burger and fries meal which cost $10. He had a coupon for 15% off the original price. He also ordered a soda for $2 and added cheese for an extra $1. His total came out to $10.29 after tax. How much did Ryan save with his coupon?
def solve() -> int: original_price = 10 coupon = 0.15 soda_price = 2 cheese_price = 1 tax_rate = 0.029 meal_price = original_price + soda_price + cheese_price discount_amount = meal_price * coupon discounted_price = meal_price - discount_amount total_price = discounted_price + (...
A car dealership has 150 cars on its lot. After 1 hour, 3/4 of the total number of cars have been sold. After 2 more hours, a quarter of the number of cars that had already been sold are sold. How many cars are left in the dealership?
def solve() -> int: total_cars = 150 cars_sold_1_hour = (3/4) * total_cars cars_sold_2_hours = (1/4) * cars_sold_1_hour cars_left = total_cars - cars_sold_1_hour - cars_sold_2_hours result = cars_left return result
Clarissa needs to buy 52 chairs for her store. Each chair is $17, how much money does Clarissa need to buy the chairs?
def solve() -> int: total_chairs = 52 cost_per_chair = 17 total_cost = total_chairs * cost_per_chair result = total_cost return result
40 candies are given to 8 friends. How many candies does each friend get?
def solve() -> int: candies_per_friend = 40 / 8 result = candies_per_friend return result
At an electronics store 10% of the items are discounted at 25%. If the store sells 800 items, how many of them are discounted?
def solve() -> int: total_items_sold = 800 percentage_discounted_items = 10 discount_percent = 25 total_discounted_items = total_items_sold * percentage_discounted_items/100 result = total_discounted_items return result
========================================================================= Some possible questions and programs are: A group of friends decides to share a cake. Each person will eat 3 slices of chocolate and 2 slices of vanilla cake. The cake has 12 slices in total, 6 of each flavor. They have to pay $24 for the cake. H...
def solve() -> int: slices_per_person = 3 + 2 people = 12 // slices_per_person cost_per_person = 24 / people result = people return result
A rectangular garden has a length of 15 meters and a width of 12 meters. What is the perimeter of the garden?
def solve() -> int: perimeter = 2 * (15 + 12) result = f'<<<{perimeter}>>>' result = perimeter return result
Elliot has 25 beads in his treasure box. He has thrice as many wooden beads as plastic beads. Today, he went to the store and bought 2 plastic and 3 wooden beads. How many beads are there in Elliot's treasure box now?
def solve() -> int: plastic_beads = 25 / 4 wooden_beads = 3 * plastic_beads plastic_beads += 2 wooden_beads += 3 total_beads = plastic_beads + wooden_beads result = total_beads return result
Joe has 4 foxes. Each one consumes 2 pounds of food every day. How many pounds of food does he need to feed his foxes for 12 days?
def solve() -> int: food = 2 num_foxes = 4 num_days = 12 total_food = food*num_foxes*num_days result = total_food return result