question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Michael was caught cheating on his math exam. The school principal decided to give him a punishment of 2 weeks detention and a 3-month suspension, then extended his suspension by 1/4 since this was Michael's third offense. How long is Michael suspended from school?
def solve() -> int: detention_weeks = 2 suspension_months = 3 extension_fraction = 1/4 offense_count = 3 initial_suspension_months = suspension_months + (detention_weeks / 4) extended_suspension_months = initial_suspension_months * (1 + extension_fraction) total_suspension_mon...
Brett has received overtime pay for staying late at work multiple times. For every hour of overtime, he receives double his regular pay. If he received $300 in overtime pay, how many hours of overtime did he work?
def solve() -> int: regular_pay = 0 overtime_hours = 0 overtime_pay = 300 regular_pay = overtime_pay / 2 overtime_hours = overtime_pay / regular_pay result = overtime_hours return result
Elias wants to increase his weightlifting ability. He is currently able to lift a weight of 150 lbs and wants to reach a target weight of 275 lbs. He plans to increase his weight lifting by 25 lbs per week. How many weeks will it take him to reach his target?
def solve() -> int: start_weight = 150 target_weight = 275 increase_per_week = 25 weeks = 0 while start_weight < target_weight: weeks = weeks + 1 start_weight = start_weight + increase_per_week result = weeks return result
Two chefs, Lisa and Maya, divide the ingredients of a recipe in the ratio of 2:3. If Lisa used 1 kg of the ingredient, find the total amount of ingredient used and the amount used by Maya in total.
def solve() -> int: ratio_lisa = 2 ratio_maya = 3 amount_lisa = 1 total_ratio = ratio_lisa + ratio_maya total_amount = amount_lisa * (total_ratio / ratio_lisa) amount_maya = total_amount - amount_lisa result = f'The total amount of ingredient used is {total_amount} k...
Jaden earns $2000 per week at his full-time job and works an additional 10 hours per week making $50/hour doing freelance work. He spends $250 per week on groceries and rent. What is his total earnings after deducting his expenses?
def solve() -> int: fullTimePay = 2000 freelanceHours = 10 freelancePayRate = 50 expenses = 250 freelancePay = freelanceHours * freelancePayRate totalEarnings = fullTimePay + freelancePay earningsAfterExpenses = totalEarnings - expenses result = earningsAfterExpenses retur...
Earl receives a bill from the farmer for 510$. 20 percent of the bill is for eggs, and 105$ is for apples. The rest of the bill is for carrots. How much did the carrots cost?
def solve() -> int: total = 510 Eggs_percentage = 0.2 Apples_cost = 105 total_Eggs_cost = total * Eggs_percentage total_others = total - total_Eggs_cost - Apples_cost result = total_others return result
Max has nine more chocolates than Noah, and Noah has one third as many chocolates as Olivia. If Olivia has 27 chocolates, how many chocolates does Max have?
def solve() -> int: olivia_chocolates = 27 noah_chocolates = olivia_chocolates / 3 max_chocolates = noah_chocolates + 9 result = max_chocolates return result
Student: A nursery is delivering flowerpots to its customers. Each pot contains 12 flowers and 5 pots can go in each box. How many flowers in total can the nursery deliver in 60 boxes?
def solve() -> int: num_boxes = 60 num_pots_per_box = 5 num_flowers_per_pot = 12 total_flowers = num_boxes * num_pots_per_box * num_flowers_per_pot result = total_flowers return result
A bookshelf has 75 books and can hold 100 books. How many bookshelves are needed to hold 1050 books?
def solve() -> int: books_per_shelf = 100 total_books = 1050 total_shelves = (total_books / books_per_shelf) result = int(total_shelves + 1) return result
A group of friends went to a restaurant and spent $50 on food, $10 on drinks and $15 on tips. If there were 4 people in the group, how much did each person contribute?
def solve() -> int: food_cost = 50 drink_cost = 10 tip_cost = 15 total_cost = food_cost + drink_cost + tip_cost num_people = 4 cost_per_person = total_cost / num_people result = cost_per_person return result
ix trains are running on parallel tracks but each has a different number of cars. The first train has 15 cars, the second has 12, the third has 18, the fourth has 10, the fifth has 14, and the sixth has 16. A train with no cars can go 100 MPH, but each car makes it 3 MPH slower. How long will it take for each train to ...
def solve() -> int: def speed(cars): return 100 - cars * 3 def time(cars): return 300 / speed(cars) time1 = time(15) time2 = time(12) time3 = time(18) time4 = time(10) time5 = time(14) time6 = time(16) result = "The time for each train is:\nTrain 1: {:.2f} ...
Mia wants to buy concert tickets for herself and her friends. The tickets cost $25 each, plus a $5 service fee per order. Mia wants to buy a total of 8 tickets. How much will the tickets cost her in total?
def solve() -> int: cost = (25*8) + 5 result = f'Total cost: ${cost}' result = cost return result
Carl's recipe calls for 2 cups of flour and he has 4 cups in his pantry. If he wants to make 6 batches of the recipe, how many more cups of flour will he need to buy?
def solve() -> int: more_flour_needed = (6*2)-4 result = more_flour_needed return result
A fruit and vegetable seller installed 5 kg of celery, 9 kg of lettuce and 11 kg of potatoes. He sold two fifths of them. What mass of vegetables did he sell?
def solve() -> int: celery_kg = 5 lettuce_kg = 9 potatoes_kg = 11 vegetables_kg = celery_kg + lettuce_kg + potatoes_kg sold_kg = (2 / 5) * vegetables_kg result = sold_kg return result
Alex had 24 candies in his pocket. He ate 4 candies and then gave half of the remaining candies to his sister. Then, he found 6 more candies in his backpack and added them to his pocket. How many candies did Alex have in his pocket at the end?
def solve() -> int: candies = 24 candies -= 4 candies /= 2 candies += 6 result = candies return result
Charlie has a jar of 50 marbles. He randomly picks one marble and puts it back. He does this 10 times. Each time he picks a red marble, he gets 2 points. Each time he picks a blue marble, he gets 1 point. If there are 20 red marbles and 30 blue marbles in the jar, what is the expected value of his total score?
def solve() -> int: expected_score = (0.4 * 2 + 0.6 * 1) * 10 result = expected_score return result
Sarah is planting trees in her backyard. The first tree is a foot tall. The second tree is three times as tall as the first tree. The third tree is half the size of the second tree. She used 24 liters of water for the third tree. How many liters of water did she use for the second tree?
def solve() -> int: tree1 = 1 tree2 = 3 * tree1 tree3 = tree2 / 2 water3 = 24 water2 = water3 * (tree2 / tree3) result = water2 return result
Patricia, Quinn's sister, is 16 years old. Quinn's brother is three times as old as Patricia. Quinn is the youngest sibling and is a quarter as old as his sister. What's the combined age of the siblings?
def solve() -> int: patricia = 16 quinn_brother = 3 * patricia quinn = patricia / 4 combined_age = patricia + quinn_brother + quinn result = combined_age return result
To maintain a healthy diet, Ravi aims to consume fruits that are 20% of his body weight. If Ravi wants to eat 10 pounds of fruits daily, how much does he weigh?
def solve() -> int: w = 10 / 0.2 result = f'<<<{w}>>>' return result
Chris wants to lift weights for a total of 50 hours this month. On the first day, he lifted weights for 4 hours. On each subsequent day, he lifted weights for 30 minutes more than the previous day. If he lifts weights for 25 days this month, how many hours did he lift weights on the 25th day?
def solve() -> int: total_hours = 50 first_day_hours = 4 num_days = 25 total_minutes = (total_hours - first_day_hours) * 60 incremental_minutes = [30 * i for i in range(num_days - 1)] total_incremental_minutes = sum(incremental_minutes) total_minutes_25th_day = total_minutes / (num...
A rectangle has a length that is 5 times its width. If the perimeter is 48 cm, what is the length of the rectangle?
def solve() -> int: perimeter = 48 width = perimeter / 12 length = 5 * width result = length return result
A box of candy contains 20 pieces of candy. If the box costs $10, what is the cost per piece of candy?
def solve() -> int: num_pieces = 20 box_cost = 10 cost_per_piece = (box_cost/num_pieces) result = round(cost_per_piece,2) return result
Student: Justin had 30 apples and he shared them equally with 6 of his friends. If each of his friends got the same number of apples, how many apples did they have each?
def solve() -> int: apples = 30 friends = 6 apples_per_friend = apples / friends result = apples_per_friend return result
An ATM dispenses cash in $20 bills and $50 bills only. If you withdraw $500, how many $20 and $50 bills will you receive?
def solve() -> int: amount_withdrawn = 500 num_of_fifty_bills = amount_withdrawn // 50 amount_left = amount_withdrawn % 50 num_of_twenty_bills = amount_left // 20 result = (num_of_twenty_bills, num_of_fifty_bills) return result
Nancy has 18 flowers. She planted 6 flowers in her garden and then picked 4 flowers from her neighbor's garden. She gave 3 flowers to her mom and then received 2 flowers from her dad. How many flowers does she have now?
def solve() -> int: flowers = 18 flowers = flowers - 6 flowers = flowers + 4 flowers = flowers - 3 flowers = flowers + 2 result = flowers return result
A toy store has 4 types of action figures. They sell six times as many superheroes as they do villains, and four times as many robots as they do aliens. The aliens sell an eighth as much as the superheroes. If they sold 5 superheroes today, how many aliens did they sell?
def solve() -> int: superheroes = 5 villains = superheroes / 6 robots = villains * 4 aliens = superheroes / 8 result = aliens return result
phen sold 15 toys this week. Each toy cost $7. How much money did he make in total?
def solve() -> int: toys = 15 price = 7 total_budget = toys * price result = total_budget return result
Emory and her classmates are going to the water park. Tickets are $20 for adults and $15 for children. If there are 8 adults and 6 children, how much will it cost for tickets?
def solve() -> int: adult_ticket = 20 child_ticket = 15 ticket_total = adult_ticket * 8 + child_ticket * 6 result = ticket_total return result
Sydney is a train mechanic. She replaces all the wheels on 12 passenger trains and all the wheels on 8 cargo trains. How many wheels did she replace in total?
def solve() -> int: passenger_train_wheels = 12 * 4 cargo_train_wheels = 8 * 6 total_wheels_replaced = passenger_train_wheels + cargo_train_wheels result = total_wheels_replaced return result
-Q9: In Anna's drawer, she has different types of socks. She has 9 pairs of white socks, 6 pairs of black socks, one more pair of red socks than there are pairs of black socks, and two less pairs of blue socks than there are pairs of red socks. What is the total number of pairs of socks in Anna's drawer?
def solve() -> int: white = 9 black = 6 red = black + 1 blue = red - 2 total_pairs = white + black + red + blue result = total_pairs return result
Possible new questions and programs: Kim can paint 4 fences in an hour. Lee can paint 3 fences in an hour and Sam can paint 5 fences in an hour. If they work together for 2 hours, how many fences can they paint in total?
def solve() -> int: kim_rate = 4 / 60 lee_rate = 3 / 60 sam_rate = 5 / 60 total_rate = kim_rate + lee_rate + sam_rate result = total_rate * 120 return result
A store sells shirts for $20 each. If the store sells 150 shirts, how much money did they make?
def solve() -> int: price_per_shirt = 20 total_shirts_sold = 150 total_money_made = price_per_shirt * total_shirts_sold result = total_money_made return result
Student: A recipe calls for 2 and 1/2 cups of flour. If Sarah wants to make 1 and 1/2 batches of the recipe, how many cups of flour does she need?
def solve() -> int: flour_per_batch = 2.5 batches = 1.5 flour_needed = flour_per_batch * batches result = flour_needed return result
In a clothing store, 80% of the clothes are for women and the rest are for men. Of the men's clothes, 20% are suits and the rest are casual. If there are 150 clothes in the store in total, how many women's suits are there?
def solve() -> int: total_clothes = 150 women_clothes_percentage = 0.8 men_clothes_percentage = 1 - women_clothes_percentage men_clothes = total_clothes * men_clothes_percentage suits_percentage = 0.2 casual_percentage = 1 - suits_percentage men_suits = men_clothes * suits_percenta...
Aiden has six motorcycles. The first motorcycle averages 35 miles per gallon of gas. The second motorcycle averages 10 miles per gallon of gas. And the third motorcycle averages 20 miles per gallon of gas. He splits his 800-mile monthly driving equally among his six motorcycles. If gas costs $2.75 per gallon, how much ...
def solve() -> int: motorcycle1_mpg = 35 motorcycle2_mpg = 10 motorcycle3_mpg = 20 total_mpg = motorcycle1_mpg + motorcycle2_mpg + motorcycle3_mpg monthly_driving = 800 driving_per_motorcycle = monthly_driving / 6 gas_price = 2.75 motorcycle1_gas = driving_per_motorcycle / motorcycle1_mp...
Alex has a collection of 75 CDs, of which 60% are pop and 35% are rock. If there are 5 CDs that are both pop and rock, how many CDs are only rock?
def solve() -> int: cds = 75 pop_percent = 60/100 rock_percent = 35/100 pop_and_rock = 5 pop_cds = cds * pop_percent rock_cds = cds * rock_percent rock_only_cds = rock_cds - pop_and_rock result = rock_only_cds return result
Ethan's landlord hires him to fix the plumbing and paint the walls. Fixing the plumbing takes 3 hours and pays $90. If Ethan wants to make $25/hour working for the landlord, and painting the walls takes 6 hours, how much should Ethan charge for painting the walls?
def solve() -> int: plumbing_hours = 3 plumbing_pay = 90 hourly_rate = 25 painting_hours = 6 total_pay = plumbing_pay + (hourly_rate * plumbing_hours) painting_pay = (total_pay - (hourly_rate * painting_hours)) / painting_hours result = painting_pay return result
Student: Sam went shopping and bought 4 items for a total of $50.00. Two of the items were $16 each, and the other two were $12 each. How much change does Sam have?
def solve() -> int: item1 = 16 item2 = 16 item3 = 12 item4 = 12 total = 50 sum = item1 + item2 + item3 + item4 difference = total - sum result = difference return result
In a box of candy that has 80 pieces, there are 22 chocolate pieces, 12 mint pieces, and 6 nut pieces. Out of the pieces that aren't chocolate, mint, or nut, 32 are fruity. What percentage of the candy is fruity pieces, rounded to the nearest integer?
def solve() -> int: total_pieces = 80 chocolate_pieces = 22 mint_pieces = 12 nut_pieces = 6 other_pieces = total_pieces - chocolate_pieces - mint_pieces - nut_pieces fruity_pieces = 32 percentage_fruity = round((fruity_pieces / other_pieces) * 100) result = percentage_fruity return r...
A company produces 5000 units of a product per year. If the production cost is $5 per unit and the selling price is $10 per unit, what is the company's annual profit?
def solve() -> int: units_per_year = 5000 production_cost_per_unit = 5 selling_price_per_unit = 10 revenue_per_year = units_per_year*selling_price_per_unit cost_per_year = units_per_year*production_cost_per_unit profit_per_year = revenue_per_year - cost_per_year result = f'{profit_per_year}'...
There are 24 apples in a basket. If 3 apples are taken out of the basket, how many apples are left in the basket?
def solve() -> int: total_apples = 24 taken_out = 3 remaining_apples = total_apples - taken_out result = remaining_apples return result
Student: An electrician charges $50/hour for labor and $200 a month for equipment rental. If they worked for 6 hours this month, how much does the customer owe?
def solve() -> int: hourly_rate = 50 equipment_rental = 200 hours_worked = 6 labor_cost = hourly_rate * hours_worked total_cost = labor_cost + equipment_rental result = total_cost return result
A store sells apples and oranges. If the ratio of apples to oranges sold is 5:3, and they sold a total of 80 fruits, how many apples were sold?
def solve() -> int: totalFruits = 80 ratio = 5 / 3 apples = ratio / (1 + ratio) * totalFruits result = apples return result
David bought 2 shirts at $20 and 3 pants at $45 each. He had a $50 coupon. How much money did he need to pay for all the items?
def solve() -> int: shirts = 2 pants = 3 cost_shirt = 20 cost_pants = 45 total_cost = shirts*cost_shirt+pants*cost_pants total_cost_after_coupon = total_cost-50 result = total_cost_after_coupon return result
Emma bought a total of 18 cakes for her party. She bought 9 more chocolate cakes than vanilla cakes. How many of each type did she buy?
def solve() -> int: total = 18 vanilla = int(total/2) chocolate = vanilla + 9 result = vanilla, chocolate return result
Possible questions and programs: Lila has 12 stickers. Her sister has 3 times as many stickers as she has. How many stickers do they have together?
def solve() -> int: lila = 12 sister = 3 * lila total = lila + sister result = total return result
Mr. Davis' classroom has 35 students and 14 of them are second graders. If there are 7 kindergartners, how many first graders are in the class?
def solve() -> int: second_students = 14 kinder_students = 7 total_students = 35 first_students = total_students - kinder_students - second_students result = first_students return result
Jack has a triangular billboard that's 8 feet long on the base and 6 feet tall. He wants to paint it with a new ad. He knows that he needs to paint both sides of the billboard. Paint costs $1.5 per pint, and one pint covers 8 square feet. How much will he spend on paint?
def solve() -> int: base = 8 height = 6 area = 0.5 * base * height total_area = area * 2 paint_needed = total_area / 8 cost_per_pint = 1.5 total_cost = paint_needed * cost_per_pint result = total_cost return result
There are 200 pens in a box. If 15 pens are used up each day, how many pens will be left after 2 weeks?
def solve() -> int: pens = 200 pens_used_per_day = 15 days = 14 pens_left = pens - (pens_used_per_day * days) result = pens_left return result
Assume that a student has an average of 80 in three tests with marks of 62, 70 and 94 respectively. What is the average mark in these three tests?
def solve() -> int: total = 62 + 70 + 94 average = total/3 result = average return result
A cake costs $6 more than a pie. The pie is 50% more expensive than a $4 muffin. How much does the cake cost?
def solve() -> int: increase = 4 * 0.5 pie = 4 + increase cake = pie + 6 result = cake print (f'<<<{result}>>>') return result
A gardener plants 420 tulip bulbs in a flower bed. If each row has 35 bulbs, how many rows are in the flower bed?
def solve() -> int: total_bulbs = 420 bulbs_per_row = 35 rows = total_bulbs//bulbs_per_row result = rows return result
Sam built a model car out of straws and connectors. For every connector, he used 25 straws. The car required 600 connectors and a total of 12,000 straws. How many boxes of straws did Sam use?
def solve() -> int: connectors = 600 straws_per_connector = 25 total_straws = 12000 straws_for_connectors = connectors * straws_per_connector boxes_of_straws = total_straws // 500 result = boxes_of_straws return result
amantha is going on a hike. She has 3 water bottles with 2 liters in each bottle. She drinks 1/4 of the water in the first bottle. How much water does she have left?
def solve() -> int: total_bottles = 3 bottle_liter = 2 percent_drank = 1/4 liters_in_first_bottle = bottle_liter * percent_drank liters_left_first_bottle = bottle_liter - liters_in_first_bottle remaining_water = total_bottles * liters_left_first_bottle result = remaining_water return re...
**** Martha needs to buy gallon size bottles of milk. She has $46 to spend on milk and each bottle costs $3.50. How many gallons of milk can she buy?
def solve() -> int: result = 0 amount_of_money = 46 cost_per_gallon = 3.50 result = amount_of_money // cost_per_gallon return result
Henry goes grocery shopping. He buys 5 types of fruits: apples, bananas, oranges, pears, and kiwis. He also buy 3 types of snacks: chips, pretzels, and crackers. If each apple costs 50 cents, each banana costs 40 cents, each orange costs 60 cents, each pear costs 70 cents, and each kiwi costs 80 cents. And each chip co...
def solve() -> int: subtotal_fruits = 10*0.5 + 5*0.4 + 15*0.6 + 8*0.7 + 6*0.8 subtotal_snacks = 12*0.75 + 8*0.8 + 5*0.65 subtotal = subtotal_fruits + subtotal_snacks discount = 0.10 * subtotal_fruits tax = 0.06 * (subtotal - discount) total = subtotal - discount + tax result = round(total,2)...
Possible new questions and programs are: Rita and Sam are baking cookies for a bake sale. Rita can bake 12 cookies in 15 minutes, and Sam can bake 10 cookies in 12 minutes. They start baking at the same time, but Rita takes a 5-minute break after baking her first batch of cookies, and Sam takes a 3-minute break after b...
def solve() -> int: rita_cookies = 0 sam_cookies = 0 time = 0 break_r = False break_s = False while rita_cookies!= sam_cookies: time += 1 if break_r == False: if rita_cookies == 12: break_r = True else: rita_cookies += 12 / 15 else: ...
A student offers a 15% discount if someone buys more than 20 book sets at the school’s book collection day. If they ended up buying 36 sets of books, how much did they need to pay in total if the regular price is $20 for each book set?
def solve() -> int: units = 36 unit_price = 20 discount_rate = 0.15 discounted_price = unit_price * units * (1 - discount_rate) result = discounted_price return result
Student: Gabriella had 10 cake pops. She ate 1 on Monday, 3 on Tuesday, and 2 on Wednesday. How many cake pops does she have left?
def solve() -> int: cake_pops = 10 cake_pops = cake_pops - 1 cake_pops = cake_pops - 3 cake_pops = cake_pops - 2 result = cake_pops return result
A plumber charges $75 for the first hour of work and $45 for each additional hour. If the plumber works for 4 hours, how much will he charge?
def solve() -> int: total_cost = 75 + 3*45 result = total_cost return result
Ethan and his family went to the beach and collected 20 shells. If Ethan took 3 shells and his family split the rest, how many shells did the family get?
def solve() -> int: total_shells = 20 ethan_shells = 3 family_shells = total_shells - ethan_shells result = family_shells return result
Student: The ratio of the ages of a mother and her son is 5:2. If the mother is 40, how old is the son?
def solve() -> int: mother_age = 40 ratio = 5/2 son_age = mother_age / ratio result = son_age return result
A restaurant has 5 tables with 4 seats each. if each table is filled completely, how many people can dine at the restaurant?
def solve() -> int: seats_per_table = 4 tables = 5 total_customers = seats_per_table * tables result = total_customers return result
Paul went fishing in the river and caught 9 salmon. He ate 2 and gave the rest to his family. How many salmon are left for his family?
def solve() -> int: caught_s = 9 ate_s = 2 remaining_s = caught_s - ate_s result = remaining_s return result
Frank wants to buy a watch that costs $120 at MSRP. He has a referral code that gives him 20% off the MSRP, but he also has to pay a $10 engraving fee and a $5 gift wrapping fee. The tax rate is 11% on the final amount. How much does Frank have to pay for the watch?
def solve() -> int: price_after_referral_code = 120 * 0.8 sub_total = price_after_referral_code + 10 + 5 tax = sub_total * 0.11 total = sub_total + tax result = total return result
- Jake buys a pack of pencils and a notebook. The pack of pencils cost $1.20. The notebook cost twice as much as the pack of pencils. How much did he pay for everything?
def solve() -> int: notebook_cost = 1.2 * 2 total_cost = 1.2 + notebook_cost result = total_cost return result
Tom solves 20 math problems on weekdays and 40 problems on weekends. If it takes him 4 days to finish a math assignment, how many problems are in the assignment?
def solve() -> int: weekdays_problems = 20 weekends_problems = 40 days_to_finish_assignment = 4 total_weekdays_problems = weekdays_problems * 5 total_weekends_problems = weekends_problems * 2 total_problems = total_weekdays_problems + total_weekends_problems problems_per_day =...
A football field has a length of 100 yards and a width of 50 yards. A square has a width of 25 yards. What is the difference in area between the two shapes?
def solve() -> int: length_field = 100 width_field = 50 width_square = 25 area_field = length_field * width_field area_square = width_square ** 2 difference_area = area_field - area_square result = difference_area return result
A music lover wants to buy a new speaker system. He found 2 options: Option A costs $380 and comes with 2 speakers and 1 subwoofer. Option B costs $430 and comes with 4 speakers and 1 subwoofer. Which option has a better value per speaker?
def solve() -> int: optionA_cost = 380 optionA_num_of_speakers = 2 + 1 optionB_cost = 430 optionB_num_of_speakers = 4 + 1 optionA_cost_per_speaker = optionA_cost / optionA_num_of_speakers optionB_cost_per_speaker = optionB_cost / optionB_num_of_speakers result = optionA_cost_per_speaker < op...
Harry wants to buy a new car that costs $30,000. The dealer offers a 15% discount if Harry pays in cash. But Harry doesn't have that much cash right now. The dealer offers Harry an installment plan of 12 monthly payments, with an additional 5% interest charged on the original price. How much will Harry pay in total?
def solve() -> int: car_price = 30000 percent_off = 0.15 installments = 12 interest_percent = 0.05 down_payment = car_price * (1 - percent_off) total_price = down_payment + (car_price * interest_percent * installments) result = total_price return result
Student: A rectangle has a length of 8cm and width of 4cm. What is the area of the rectangle in square centimeters?
def solve() -> int: length = 8 width = 4 area = length * width result = area return result
While on vacation, Ashley kayaks for one-fourth the amount of time that her dad, Mark, kayaks. Their tour guide, Tom, kayaks for five times the combined total number of hours both of them kayak. If Mark kayaks for 10 hours on vacation, how many hours does Tom spend kayaking?
def solve() -> int: mark_kayak_hours = 10 ashley_kayak_hours = mark_kayak_hours / 4 total_kayak_hours = mark_kayak_hours + ashley_kayak_hours tom_kayak_hours = 5 * total_kayak_hours result = tom_kayak_hours return result
The difference between a number and six is half of that number. What is the number?
def solve() -> int: number = 6 / (1-0.5) result = number return result
Sarah is a freelance writer who charges $50 for every 500 words and writes 3 articles a week. If she works an additional day that earns her 40% more, how much money will she make in a month?
def solve() -> int: articles_per_week = 3 words_per_article = 500 words_per_week = articles_per_week * words_per_article additional_day_percentage = 40 additional_day_earnings = words_per_week * (additional_day_percentage / 100) total_earnings_per_week = (words_per_week * 50) + additio...
A school has 480 students and 20 teachers. The principal wants to divide the students into equal groups and assign one teacher to each group. What is the largest possible group size and how many groups will there be?
def solve() -> int: from math import gcd divisor = gcd(480, 20) group_size = 480 / divisor groups = 20 / divisor result = (group_size, groups) return result
When William takes medication, he drinks water. Each glass of water helps the medicine work better. Yesterday, he drank half of the water bottles in his fridge while taking his medicine. How much more effective was the medicine with the added water?
def solve() -> int: num_water_bottles = 6 num_glasses_water = num_water_bottles / 2 effectiveness_without_water = 0.7 effectiveness_with_water = effectiveness_without_water + 0.05 * num_glasses_water effectiveness_increase = effectiveness_with_water - effectiveness_without_water result = effecti...
Lucy has $80 and wants to divide it between buying new shoes and a new dress. If shoes are $40 and dresses are $60, how much money can she spend on each?
def solve() -> int: num_of_shoes = 2 num_of_dresses = 3 total_spending = 80 cost_of_shoes = 40 cost_of_dress = 60 shoe_money = num_of_shoes*cost_of_shoes dress_money = num_of_dresses*cost_of_dress shoe_spending = shoe_money/(shoe_money+dress_money)*total_spending dress_spending = dre...
Student: Max hits 45% of his shots from the 3-point line, 75% of his shots from the 2-point line and 85% of his shots from the free throw line. Of every quarter he plays, he gets 9 shots from the 3-point line, 12 shots from the 2-point line and 14 shots from the free throw line. How many shots does he hit in 95% of the...
def solve() -> int: three_point_percentage = 0.45 two_point_percentage = 0.75 free_throw_percentage = 0.85 three_point_shots = 9 two_point_shots = 12 free_throw_shots = 14 quarters = 10 percentage = 0.95 total_shots = three_point_shots * quarters + two_point_shots * quarters + free_t...
Paul has 7/8 of his salary. If he then spends 3/4 of it on a laptop, how much money does he have left?
def solve() -> int: x = 7/8 total_savings = x spending = total_savings * 3 / 4 result = total_savings - spending return result
If a baker uses 1.5kg of flour to bake 40 cookies, how much flour will she need to bake 300 cookies?
def solve() -> int: num_of_cookies = 300 flour_per_cookie = 1.5 / 40 flour_needed = num_of_cookies * flour_per_cookie result = flour_needed return result
At a pet adoption agency, there are 240 pets available. 80% of them are cats and of those cats, 60% are tabbies. How many cats are tabbies?
def solve() -> int: pets = 240 cats = 0.80 tabbies = 0.60 no_of_cats = pets * cats no_of_tabbies = no_of_cats * tabbies result = no_of_tabbies return result
John wants to save $1200 in 6 months. If he saves the same amount of money every month, how much should he save each month?
def solve() -> int: savings_goal = 1200 months = 6 monthly_savings = savings_goal/months result = monthly_savings return result
A florist sold 10 sunflower plants for $3 each, 30 lilies for $4 each, and 20 roses for $2 each. He used the money to pay his workers $40 each, buy fertilizer for $150 and buy a new wheelbarrow for $200. How much money was left from the florist's earnings?
def solve() -> int: total_earned = (10 * 3) + (30 * 4) + (20 * 2) total_paid = (2 * 40) + 150 + 200 result = total_earned - total_paid return result
**** Charles observed a star every day for 64 days. He observed 14 more stars each day for the first 10 days than he did for the rest of the days. How many stars has Charles observed in total?
def solve() -> int: days = 64 each_day = 14 first_10_days = each_day * 10 other_days = days - 10 other_stars = other_days * each_day total = first_10_days + other_stars result = total return result
Emily is a musician who records 1 album every year. She has been recording music for the past 8 years and sells each album for an average of $15. How much money has Emily earned from her music career?
def solve() -> int: num_years = 8 album_price = 15 num_albums = num_years * 1 total_earnings = num_albums * album_price result = total_earnings return result
Ben makes 10 cookies for every 7 brownies he bakes. He needs to make 50 treats for a bake sale. If he wants to make an equal number of cookies and brownies, how many cookies does he make?
def solve() -> int: cookies_per_brownie = 10 treats_needed = 50 brownies_needed = treats_needed / 2 cookies_needed = brownies_needed * cookies_per_brownie result = cookies_needed return result
Jason has a triangular prism. It is 5 cm long, 6 cm wide, and 9 cm high. What is the total volume of the prism?
def solve() -> int: length = 5 width = 6 height = 9 area = 1/2 * length * width volume = area * height result = volume return result
Sarah's gym is 25 miles round trip from her house. The swimming pool is 15 miles farther from her house. If Sarah goes to the gym every weekday and visits the swimming pool once a week, how many miles does she drive in a week?
def solve() -> int: gym_distance = 25 swimming_pool_distance = gym_distance + 15 daily_driving_distance = gym_distance * 2 weekly_driving_distance = daily_driving_distance * 5 + swimming_pool_distance result = weekly_driving_distance return result
If the selling price of an item is $200 and the profit percentage is 25%, what is the cost price of the item?
def solve() -> int: selling_price = 200 profit_ratio = 25/100 cost_price = selling_price / (1 + profit_ratio) result = cost_price return result
John has 8 cats. He adopted 3 more cats and then gave away 2. How many cats does John have now?
def solve() -> int: cats = 8 cats += 3 cats -= 2 result = cats return result
Anna sold handmade crafts at a market for 6 hours. For every hour after the first 3 hours, she made an extra $5 per hour. If she made $35 for the first 3 hours, how much did she make in total that day?
def solve() -> int: hours_worked = 6 extra_pay_per_hour = 5 first_hours_pay = 35 extra_hours_worked = hours_worked - 3 extra_hours_pay = extra_hours_worked * extra_pay_per_hour total_pay = first_hours_pay + extra_hours_pay result = total_pay return result
Below are some possible questions and programs: Liam wants to save money for a new bike. He starts by saving $5 in the first week, and then increases his savings by $2 each week. How much money does he save in total after 8 weeks?
def solve() -> int: savings = 5 increase = 2 total = 0 for week in range(1, 9): total = total + savings savings = savings + increase result = total return result
At a toy store, toys are sold with a discount of 20%. If the original price of a toy is $50, what is the discounted price?
def solve() -> int: original_price = 50 discount_percent = 20 discounted_price = original_price * (1 - discount_percent/100) result = discounted_price return result
Zoe bakes a cake with 36 cherries. She uses 9 cherries for the top layer and half as many cherries for the bottom layer as the top layer. Then she uses one third as many cherries for the middle layer as the top and bottom layers combined. If the rest of the cherries she uses are for decoration, how many cherries does s...
def solve() -> int: total_cherries = 36 top_layer = 9 bottom_layer = top_layer / 2 middle_layer = (top_layer + bottom_layer) / 3 decoration = total_cherries - (top_layer + bottom_layer + middle_layer) result = decoration return result
If Mary has 337 toys in her collection, and she gives away 90 toys, how many toys will she have left?
def solve() -> int: initial_toys = 337 given_away_toys = 90 leftover_toys = initial_toys - given_away_toys result = leftover_toys return result
Grace needs to buy paint for her art project. It will take 2 tubes of paint to make 1 painting. If she wants to make 8 paintings, how many tubes of paint does she need to buy?
def solve() -> int: paintings = 8 tubes_per_painting = 2 total_tubes = paintings * tubes_per_painting result = total_tubes return result
You can buy 6 carrots or 3 potatoes for the same price. You bought 48 vegetables evenly split between tomatoes, carrots and potatoes, and the price of 1 tomato is $0.30. How much does 1 carrot cost if your total bill was $24?
def solve() -> int: x = (24 - 4.8) / 16 price_of_carrot = x / 6 result = price_of_carrot return result
A bag contains 10 red balls, 8 blue balls, and 12 yellow balls. What is the probability of drawing a blue ball at random from the bag?
def solve() -> int: total_balls = 10 + 8 + 12 blue_balls = 8 probability = blue_balls / total_balls result = probability return result
A store is having a sale where everything is 20% off. If a shirt originally costs $25, how much will it cost during the sale?
def solve() -> int: original_price = 25 discount_percent = 0.2 discount_amount = original_price * discount_percent new_price = original_price - discount_amount result = new_price return result
Rachel has 15 math problems, 12 social studies problems, and 6 science problems. She can answer each math problem for 2 minutes while answering each social studies problem takes her 1 minute. If she can answer each science problem in 3 minutes, how long will it take Rachel to answer all her homework?
def solve() -> int: math_problems = 15 social_studies_problems = 12 science_problems = 6 math_time = math_problems * 2 social_studies_time = social_studies_problems * 1 science_time = science_problems * 3 total_time = math_time + social_studies_time + science_time result =...