question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
There are 10 robots in a room and each robot has 3 antennae. Each antennae has 7 arms and the arms each have 5 gadgets. How many gadgets are there in the room?
def solve() -> int: total_gadgets = 0 for robot in range(10): for antennae in range(3): for arm in range(7): total_gadgets += 5 result = total_gadgets return result
A car can travel 25 miles on one gallon of gas. If the distance between two cities is 325 miles, how many gallons of gas will the car need?
def solve() -> int: miles_per_gallon = 25 distance_between_cities = 325 num_gallons_needed = distance_between_cities // miles_per_gallon result = num_gallons_needed return result
Student: A store offered a 20% discount on a TV, which had an original price of $500. How much was the discounted price?
def solve() -> int: original_price = 500 discount_percentage = 0.2 discounted_price = original_price * (1 - discount_percentage) result = discounted_price return result
John cycled a total of 42 miles in 3 days. How many miles did John cycle on average each day?
def solve() -> int: total_miles = 42 total_days = 3 average_miles = total_miles / total_days result = average_miles return result
A pizza has 8 slices and each slice has 200 calories. A salad has 4 servings and each serving has 100 calories. How many calories will you consume if you eat 3 slices of pizza and 2 servings of salad?
def solve() -> int: pizza_slices = 3 pizza_calories_per_slice = 200 pizza_calories = pizza_slices * pizza_calories_per_slice salad_servings = 2 salad_calories_per_serving = 100 salad_calories = salad_servings * salad_calories_per_serving total_calories = pizza_calories + salad_calories r...
John has a collection of CDs. He sells 25% of them to his friend and then buys 30 more. If he has 80 CDs now, how many did he originally have?
def solve() -> int: cds = 80 cds -= 30 cds /= 0.75 result = cds return result
Alyssa loves baking and wants to make a cake for her friend's birthday. She needs 2 cups of flour, 1.5 cups of sugar, 0.75 cups of butter, 4 eggs, and 0.5 cups of milk for the cake. She has 6 cups of flour, 4 cups of sugar, 2 cups of butter, 12 eggs, and 1 cup of milk in her pantry. How many cakes can she make with the...
def solve() -> int: flour_needed = 2 sugar_needed = 1.5 butter_needed = 0.75 eggs_needed = 4 milk_needed = 0.5 flour_available = 6 sugar_available = 4 butter_available = 2 eggs_available = 12 milk_available = 1 cakes_flour = flour_available // flour_needed ...
Tim is packing for a hunting trip. He packs 15 pounds of water, 5 pounds of snacks, and 25 pounds of hunting gear. During his trip, he drinks 1.5 pounds of water per hour and eats 0.2 pounds of food per hour. How much weight is he carrying after seven hours?
def solve() -> int: water_weight = 15 snacks_weight = 5 hunting_gear_weight = 25 total_weight = water_weight + snacks_weight + hunting_gear_weight water_consumed = 1.5 * 7 snacks_consumed = 0.2 * 7 total_consumed = water_consumed + snacks_consumed final_weight = total...
A pack of gum contains 12 pieces and costs 1.2 dollars. How much does each piece of gum cost in cents?
def solve() -> int: cost_in_dollars = 1.2 / 12 cost_in_cents = cost_in_dollars * 100 result = cost_in_cents return result
Student: Jerry has 6 cans of 500ml coke each. He needs to separate them into groups of 3. How many cans are in each group?
def solve() -> int: cans = 6 volume = 500 groups = 3 cans_per_group = cans // groups volume_per_group = cans_per_group * volume result = cans_per_group, volume_per_group return result
There are 50 marbles in a jar. If 2/5 of the marbles are red and the rest are blue, how many marbles are blue?
def solve() -> int: marbles = 50 red_marbles = marbles * 2/5 blue_marbles = marbles - red_marbles result = blue_marbles return result
Student: A school has an enrollment of 150 students. A quarter of them are in the 4th grade, while the rest are in the 5th grade. How many students are in the 5th grade?
def solve() -> int: enrollment = 150 fourth_grade = enrollment * 0.25 fifth_grade = enrollment - fourth_grade result = fifth_grade return result
Mike has a piece of rope that is 16 meters long. He wants to cut it into pieces that are each 2/3 meter long. How many equal-length pieces of rope can he cut?
def solve() -> int: rope_length = 16 cut_length = 2/3 pieces_num = rope_length // cut_length result = pieces_num return result
Shaun takes a survey of his classmates to see who wants to attend a field trip. He discovers that only 30% of them are interested. He then removes those who are not interested. If he has 50 classmates, how many are left to join the trip?
def solve() -> int: total_classmates = 50 interested_percentage = 30 interested_classmates = total_classmates * interested_percentage / 100 not_interested_classmates = total_classmates - interested_classmates left_to_join = interested_classmates result = left_to_join ...
Adam has 3 piles of stones, the first pile has 15 stones, the second pile has 6 more stones than the first and the third pile has 3 fewer stones than the first pile. How many stones does Adam have in total?
def solve() -> int: num_stones_1 = 15 num_stones_2 = num_stones_1 + 6 num_stones_3 = num_stones_1 - 3 total_num_stones = num_stones_1 + num_stones_2 + num_stones_3 result = total_num_stones return result
Student: Jacob uses 9 weight plates each weighing 32 pounds in the exercise machine. Each plate size is increased by 40% when being lowered. What is the total weight when all plates are being lowered?
def solve() -> int: num_plates = 9 weight_per_plate = 32 increase_percentage = 0.4 total_weight = num_plates * weight_per_plate * (1 + increase_percentage) result = total_weight return result
A school has 450 students. If 60% of the students are girls, how many girls are there in the school?
def solve() -> int: total_students = 450 percentage_girls = 60 girls = total_students * percentage_girls / 100 result = girls return result
A gardener has a plot of land that is 40 feet long and 20 feet wide. If she wants to fence in the area, how many feet of fencing will she need?
def solve() -> int: length = 40 width = 20 perimeter = 2*length + 2*width result = perimeter return result
Student: Michael buys 5 pairs of shoes for $30 each and gets 20% off. What is the total cost?
def solve() -> int: shoes = 5 price = 30 discount = 0.2 original_cost = shoes * price discount_amount = original_cost * discount final_cost = original_cost - discount_amount result = final_cost return result
A stationery store sells pens in packets of 6. Each pen has 4 colors. If a customer buys 10 packets of pens, how many pens do they get and how many colors do they get?
def solve() -> int: pens_per_packet = 6 num_packets = 10 colors_per_pen = 4 total_pens = pens_per_packet * num_packets total_colors = total_pens * colors_per_pen result = (total_pens, total_colors) return result
Student: A factory produces 15 chairs every hour. How long will it take to produce 300 chairs?
def solve() -> int: chairs_produced_per_hour = 15 total_chairs_to_produce = 300 hours_required = total_chairs_to_produce / chairs_produced_per_hour result = hours_required return result
A party of 16 people shared 6 pizzas equally. Each pizza has 8 slices. How many slices remain?
def solve() -> int: number_of_people = 16 number_of_pizzas = 6 pizza_slices = 8 total_slices = number_of_pizzas * pizza_slices slices_per_person = total_slices // number_of_people slices_remain = total_slices - slices_per_person * number_of_people result = slices_remain return result
Student: Sam and Amanda are baking cupcakes for a charity sale. Sam can bake 12 cupcakes in an hour, while Amanda can bake 8 cupcakes in an hour. They both start baking at 10 a.m. and finish at the same time. How many cupcakes did they bake in total?
def solve() -> int: sam_cupcakes_per_hour = 12 amanda_cupcakes_per_hour = 8 total_cupcakes = sam_cupcakes_per_hour + amanda_cupcakes_per_hour result = total_cupcakes return result
A fruit salad has a ratio of 2:3:5 for pineapple, watermelon, and mango. If the salad has a total weight of 120kg, how much does each fruit weigh?
def solve() -> int: total_weight = 120 ratio = [2,3,5] parts = sum(ratio) fruit_weights = [(r/parts) * total_weight for r in ratio] result = [int(w) for w in fruit_weights] return result
arah bought 18 lemons for a total cost of $15. How much was each lemon?
def solve() -> int: num_lemons = 18 total_cost = 15 cost_per_lemon = total_cost/num_lemons result = f"Each lemon cost ${cost_per_lemon}" return result
Kim has 80 dollars. She spends a quarter of it on groceries. She then spends 22 dollars on clothes. If she has 45 dollars left, how much money did she spend on groceries?
def solve() -> int: money = 80 groceries = money / 4 money -= groceries money -= 22 money_left = 45 spent_on_groceries = groceries - (money - money_left) result = spent_on_groceries return result
In a city, the population increased from 500,000 to 525,000 over a year. What was the percentage increase in population?
def solve() -> int: total_increase = 525000 - 500000 percent_increase = (total_increase / 500000) * 100 result = percent_increase return result
Sara drove a car 30 miles in 45 minutes. Find her average speed in miles per hour?
def solve() -> int: distance = 30 time = 45 / 60 speed = distance / time result = speed return result
The distance between Michael's house and Macy's house is 50 miles. Michael drives at a speed of 40 miles per hour. After driving for 1.25 hours, how much distance has he covered?
def solve() -> int: distance = 50 speed = 40 time = 1.25 covered_distance = speed * time result = covered_distance return result
A retailer normally sells a dress at $80. This week the retailer announced a 25% discount. What is the sale price of the dress?
def solve() -> int: original_price = 80 discount = 25 sale_price = original_price - (discount/100)*original_price result = f'The sale price of the dress is {sale_price} dollars' result = sale_price return result
Jane saves $10 each week. In the first month, she saves for 3 weeks while she saves for 4 weeks in the second month. How much money does she save in total for 2 months?
def solve() -> int: savings_first_month = 10 * 3 savings_second_month = 10 * 4 total_savings = savings_first_month + savings_second_month result = total_savings return result
Grace and Tim take part in a coding challenge, earning 3 points for every successful output. After completing 50 challenges, Grace scored 7 points less than 2/5 of the total points earned. How many total points did Tim score?
def solve() -> int: num_challenges = 50 points_per_output = 3 total_points = num_challenges * points_per_output grace_score = (2/5) * total_points - 7 tim_score = total_points - grace_score result = tim_score return result
A full box of chocolates holds 16 pieces. If Jenny eats four pieces on Monday and three pieces on Tuesday, what percentage of the box is left?
def solve() -> int: box_capacity = 16 pieces_eaten_monday = 4 pieces_eaten_tuesday = 3 pieces_left = box_capacity - pieces_eaten_monday - pieces_eaten_tuesday percentage_left = (pieces_left / box_capacity) * 100 result = percentage_left return result
The area of a square is 81 sq. units. What is the perimeter of the square?
def solve() -> int: area_of_square = 81 side_of_square = area_of_square ** 0.5 perimeter_of_square = 4 * side_of_square result = perimeter_of_square return result
Mike has 16 quarters and half as many dimes. He gives 4 quarters and 2 dimes to his sister. How much money does Mike have left?
def solve() -> int: quarter = 16 dime = quarter / 2 given = 4 * 0.25 + 2 * 0.1 remaining = (quarter - 4) * 0.25 + (dime - 2) * 0.1 result = remaining return result
A triangle has a base of 6 inches and a height of 8 inches. What is the area of the triangle in square inches?
def solve() -> int: base = 6 height = 8 area = (base * height) / 2 result = area return result
A small convenience store charges $3 for a pack of gum, $1.50 for a bar of chocolate and $2 for a bottle of water. If a customer purchases 2 packs of gum, 4 bars of chocolate and 3 bottles of water, how much money do they spend in total?
def solve() -> int: gum_price = 3 chocolate_price = 1.5 water_price = 2 num_gum = 2 num_chocolate = 4 num_water = 3 total_cost = (gum_price*num_gum) + (chocolate_price*num_chocolate) + (water_price*num_water) result = total_cost return result
There are 473 members in a fitness center. If 289 new members join, what will be the total number of members in the fitness center?
def solve() -> int: members = 473 new_members = 289 total_members = members + new_members result = total_members return result
Sarah is painting her bedroom walls. The room is 12 feet long, 10 feet wide, and 9 feet high. If each gallon of paint can cover 350 square feet, how many gallons of paint will Sarah need to paint the whole room?
def solve() -> int: length = 12 width = 10 height = 9 area_of_walls = 2 * (length * height + width * height) gallons_of_paint = area_of_walls / 350 result = gallons_of_paint return result
A gift shop has 300 greeting cards. If each box can hold 20 greeting cards, how many boxes of greeting cards does the gift shop have?
def solve() -> int: cards = 300 cards_per_box = 20 boxes = cards / cards_per_box result = boxes return result
Kevin had 40 marbles and gave 12 of them to his friends. He then played a game and won 8 marbles from his opponent. He then lost 4 marbles while walking home and found 2 marbles on the way. How many marbles did he have at the end?
def solve() -> int: initial = 40 given = 12 won = 8 lost = 4 found = 2 final = initial - given + won - lost + found result = final return result
Mike has 7 apples and he wants to split them evenly among his 3 friends. How many apples will each person get?
def solve() -> int: apples = 7 friends = 3 apples_per_person = apples // friends result = apples_per_person return result
David is painting a rectangular wall that is 12 feet long and 9 feet high. He can paint 40 square feet of wall per hour using a roller. He also needs to paint a door that is 3 feet by 7 feet using a brush, which takes him 20 minutes. How long will it take him to paint the entire wall and the door?
def solve() -> int: wall_length = 12 wall_height = 9 roller_rate = 40 door_width = 3 door_height = 7 brush_time = 20 brush_time = brush_time / 60 wall_area = wall_length * wall_height door_area = door_width * door_height wall_area_no_door = wall_area - door_area rol...
Tina has 45 beads. She makes a necklace with 18 of them and a bracelet with 12 of them. She then breaks the bracelet and loses 20% of its beads. How many beads does Tina have left?
def solve() -> int: beads_after_making = 45 - 18 - 12 beads_lost = 12 * 0.2 beads_after_losing = beads_after_making - beads_lost result = beads_after_losing return result
(Please leave one blank line between programs) - Some possible questions and programs are: Tina's Bakery sells 150 muffins per day. Each muffin costs $1.50, and the cost of making one muffin is $0.50. How much profit does Tina's Bakery make in 10 days?
def solve() -> int: revenue = 150 * 1.50 * 10 cost = 150 * 0.50 * 10 profit = revenue - cost result = profit return result
There are 120 students in a class. If 3/4 of the students are present, how many students are absent?
def solve() -> int: total_students = 120 present_students = (3/4) * total_students absent_students = total_students - present_students result = absent_students return result
Student: Sophie has $100. She invested a quarter of it in stocks and half of what was left in cryptocurrency. How much money does she have left now?
def solve() -> int: money = 100 stocks = money / 4 money = money - stocks crypto = money / 2 money = money - crypto result = money return result
Kevin buys a new TV for $500. The shop is selling it with a 5% discount due to display damage, but he has a 10% coupon for the purchase. What is the price Kevin pays and what is the money he saved?
def solve() -> int: price = 500 discount_due_to_damage = price*0.05 price = price-discount_due_to_damage discount_coupon = price*0.10 price = price-discount_coupon money_saved = discount_due_to_damage+discount_coupon result = price, money_saved return result
Possible questions and programs are: Jessy earns $1.25 for every hour she babysits. She babysits for 3 hours on Monday, 2 hours on Wednesday, and 4 hours on Friday. She spends 1/5 of her earnings on a new book and saves the rest in her piggy bank. How much money does she have in her piggy bank after buying the book?
def solve() -> int: total_earnings = 1.25 * (3 + 2 + 4) book_cost = total_earnings / 5 piggy_bank = total_earnings - book_cost result = piggy_bank return result
Sean's ATV can store up to 12 liters of fuel. If he is traveling a total distance of 240 kilometers and his ATV consumes 2 liters of fuel for every 30 kilometers, how many refills does he need to make for a round trip?
def solve() -> int: max_fuel_capacity = 12 total_distance = 240 fuel_consumption_rate = 2/30 total_fuel_needed = total_distance * fuel_consumption_rate * 2 num_refills = total_fuel_needed / max_fuel_capacity result = num_refills return result
Michael is currently 14 years old and his grandfather is 80 years old. How old will Michael be when his grandfather is ten times as old as Michael is now?
def solve() -> int: michael_age = 14 grandfather_age = 80 x = (10 * michael_age - grandfather_age) / 9 michael_age_in_x_years = michael_age + x result = michael_age_in_x_years return result
4. For a baking competition, Marissa has to make 11 cakes. Each cake is 15 inches long and 12 inches wide, and each cake needs to have 2 liters of icing. How many liters of icing does Marissa need altogether?
def solve() -> int: nr_cakes = 11 length_cake = 15 width_cake = 12 ltr_icing_cake = 2 cake_area = length_cake * width_cake total_icing_needed = nr_cakes * ltr_icing_cake result = total_icing_needed return result
John and Henry were competing in a race, John finished in 3 minutes and Henry finished in 4 minutes. If the distance was 1 mile, how much faster was John's pace compared to Henry's pace (in miles per minute)?
def solve() -> int: john_time = 3 henry_time = 4 distance = 1 john_pace = distance / john_time henry_pace = distance / henry_time result = john_pace - henry_pace return result
A hotel chain decides to update its bedding. They have 15 hotels. Each hotel has 150 rooms. The queen-sized beds cost $1000 each, the king-sized beds cost 50% more than the queen-sized beds, and the linens for each bed cost an extra $50. How much does it cost to update the bedding in all the hotels?
def solve() -> int: num_hotels = 15 num_rooms = 150 queen_bed_cost = 1000 king_bed_cost = queen_bed_cost * 1.5 linen_cost = 50 total_queen_bed_cost = num_hotels * num_rooms * queen_bed_cost total_king_bed_cost = num_hotels * num_rooms * king_bed_cost total_linen_cost = num_hotels * ...
Student: Jim bought 8 bottles of soda for $2 each, 6 boxes of candy for $3 each and 4 bags of chips for $4 each. He then returned 4 bottles of soda, 3 boxes of candy and got a 10% discount on the chips. How much money did he spend?
def solve() -> int: bottles_soda = 8 price_bottles_soda = 2 boxes_candy = 6 price_boxes_candy = 3 bags_chips = 4 price_bags_chips = 4 bottles_soda_returned = 4 boxes_candy_returned = 3 discount_chips = 0.1 total_cost = (bottles_soda - bottles_soda_returned) * price_bottles_soda +...
Tom and Jerry are roommates. They agreed to split the rent evenly. The monthly rent for their apartment is $1500. Tom offered to pay for the first month and Jerry offered to pay for the second month. How much does Tom owe Jerry after the second month?
def solve() -> int: monthly_rent = 1500 first_month_pay = monthly_rent second_month_pay = monthly_rent total_paid = first_month_pay + second_month_pay amount_owed = total_paid/2 result = amount_owed return result
A library has 32 books and 28 DVDs. How many items are in the library?
def solve() -> int: total_books = 32 total_DVDs = 28 total_items = total_books + total_DVDs result = total_items return result
The distance between Los Angeles and Las Vegas is 400 miles by airplane. If someone decides to drive, the distance will increase by 25%. How far away is Las Vegas from Los Angeles if someone travels by car?
def solve() -> int: result = 0 distance = 400 percent_increase = (25/100) * distance result = distance + percent_increase return result
There are 48 students in a classroom. 4/9 of the students are boys and the rest of the students are girls. How many girls are there in the classroom?
def solve() -> int: total_students = 48 boy_percentage = 4/9 boys = total_students * boy_percentage girls = total_students - boys result = girls return result
A bag contains 12 apples. If 4 apples are taken out and then 6 apples are put in, how many apples are now in the bag?
def solve() -> int: num_apples = 12 num_apples -= 4 num_apples += 6 result = num_apples return result
A group of friends went to a restaurant for dinner and the total bill was $250. If the group decides to split the bill equally among them, how much will each person pay if there were 6 people in the group?
def solve() -> int: bill = 250 people = 6 amount_per_person = bill/people result = amount_per_person return result
A pizza has 12 slices. If 5 slices are eaten by Ali and 4 slices are eaten by Sarah, how many slices of pizza are left?
def solve() -> int: num_slices = 12 num_eaten_ali = 5 num_eaten_sarah = 4 num_left = num_slices - num_eaten_ali - num_eaten_sarah result = num_left return result
Q2: After his 10km run, Xavier ran 6km in the next 24 minutes. How fast did he run those 6km?
def solve() -> int: distance = 6 time = 24 result = distance / time return result
Possible new questions are: As a photographer, Melody sells her photos on an online platform. She earns a commission of 25% for each photo she sells. She already has $300 on her account from previous sales. She sells 5 photos for $80 each, 3 photos for $60 each, and 2 photos for $40 each. How much money does she have o...
def solve() -> int: balance = 300 commission_80 = 0.25 * 80 commission_60 = 0.25 * 60 commission_40 = 0.25 * 40 total_commission = 5 * commission_80 + 3 * commission_60 + 2 * commission_40 balance = balance + total_commission result = balance return result
Jennifer has four horses. She also has twice as many rabbits than horses and three fewer donkeys than rabbits. How many animals does Jennifer have?
def solve() -> int: horses = 4 rabbits = horses * 2 donkeys = rabbits - 3 result = horses + rabbits + donkeys return result
Student: A store is having a sale and offering 20% off all items. A shirt is originally priced at $25. How much will the shirt cost during the sale?
def solve() -> int: original_price = 25 discount_rate = 0.2 discount_amount = original_price * discount_rate sale_price = original_price - discount_amount result = sale_price return result
A rectangle has a length of 12 meters and a width of 8 meters. What is its perimeter?
def solve() -> int: length = 12 width = 8 perimeter = (2 * length) + (2 * width) result = perimeter return result
A coffee shop makes 50,000 cups of coffee a month. How many cups of coffee would it make in 3 years?
def solve() -> int: cups_per_month = 50000 months_per_year = 12 years = 3 total_cups = cups_per_month * months_per_year * years result = total_cups return result
Tom decides to hire a maid to clean his house. The maid charges $20 per hour for the first 3 hours and $25 per hour thereafter. If the maid cleans Tom's house for 5 hours, how much does Tom need to pay her?
def solve() -> int: hourly_rate_first_3_hours = 20 hourly_rate_after_3_hours = 25 hours_cleaned = 5 if hours_cleaned <= 3: total_cost = hours_cleaned*hourly_rate_first_3_hours else: total_cost = 3*hourly_rate_first_3_hours + (hours_cleaned-3)*hourly_rate_after_3_hours result = total_...
If a car travels 300 miles in 5 hours, and then the driver stops for 30 minutes, and then drives for another 2 hours, how many miles has the car traveled in total?
def solve() -> int: distance1 = 300 time1 = 5 distance2 = 0 time2 = 2 speed = distance1 / time1 distance2 = speed * (time2 + 0.5) total_distance = distance1 + distance2 result = total_distance return result
Julie has 36 puzzles. She put aside 1/4 of them for storage and sold the remaining puzzles. If the remaining puzzles were divided into 6 equal piles, how many puzzles are in each pile?
def solve() -> int: puzzles = 36 puzzles_stored = (1 * puzzles) // 4 puzzles_in_each_pile = (puzzles - puzzles_stored) // 6 result = puzzles_in_each_pile return result
Cindy makes 15 bracelets every week and sells them for $5 each. She spends $2 on materials for each bracelet. She also pays $10 for renting a stall every week. How much profit does she make in a month, assuming a month has 4 weeks?
def solve() -> int: bracelets_per_week = 15 selling_price = 5 material_cost = 2 rental_fee = 10 weeks_per_month = 4 revenue = bracelets_per_week * selling_price * weeks_per_month cost = bracelets_per_week * material_cost * weeks_per_month + rental_fee * weeks_per_month profit = revenu...
A teacher has 20 students. The first 6 students score 60 marks each. Another 6 students score 80 marks each, and the remaining students each score one-fifth the total marks scored by the first two groups of students combined. If the teacher gives a bonus mark for each mark scored by the second group of students, how ma...
def solve() -> int: total_students = 20 score_first_six = 60 score_next_six = 80 total_marks_first_two_groups = (score_first_six * 6) + (score_next_six * 6) total_marks_remaining = total_marks_first_two_groups / 5 bonus_marks = score_next_six total_marks = total...
A store has 15 apples and 12 oranges in its store. How many pieces of fruit are in the store?
def solve() -> int: num_apples = 15 num_oranges = 12 total_fruits = num_apples + num_oranges result = total_fruits return result
Heather needed to buy a new car and decided to take out a loan to cover the expenses. She was approved for a loan of $80,000 with an interest rate of 4%. She intends to repay the loan in 5 years at a monthly payment of $900. How much did she pay in interest?
def solve() -> int: bank_loan = float(80000) interest_rate = float(4) / 100 time = 5 monthly_payment = float(900) interest_total = bank_loan * (interest_rate * time) total_repayment = float(bank_loan + interest_total) total_amount_paid_monthly = monthly_payment * time * 12 ...
A recipe calls for 3/4 cup of sugar and makes 24 cookies. If you only want to make 12 cookies, how much sugar do you need?
def solve() -> int: recipe_sugar_per_cookie = 3/4/24 num_cookies = 12 sugar_needed = num_cookies * recipe_sugar_per_cookie result = sugar_needed return result
Possible questions and programs: A soccer team has 15 players, but only 11 can play on the field at a time. The coach decides to rotate the players every 10 minutes, so that each player gets an equal amount of playing time. How many rotations does the coach need to make in a 60-minute game?
def solve() -> int: left_out = 15 - 11 minutes_per_player = 10 rotations = 60 // minutes_per_player minutes_left_over = 60 % minutes_per_player if minutes_left_over > 0: rotations += 1 result = rotations return result
Jason has 150 marbles and 1/3 as many stones as marbles. When his friends, Shawn and Eliza, come over, he gives each of them 1/6 of each item he has. How many marbles and stones does Jason have left now in total?
def solve() -> int: marbles = 150 stones = marbles / 3 total_items = marbles + stones shawn_marbles = marbles / 6 shawn_stones = stones / 6 eliza_marbles = marbles / 6 eliza_stones = stones / 6 marbles_left = marbles - shawn_marbles - eliza_marbles stones_left = stones - sh...
A salesperson earns 5% commission of their sales. If they sell $1500 worth of goods in one day, how much commission will they earn?
def solve() -> int: sales = 1500 commission_rate = 0.05 commission = sales * commission_rate result = commission return result
Emily borrowed $100 from her friend John. She promised to give it back in 6 months with an interest rate of 5% per annum. How much should Emily pay John after 6 months?
def solve() -> int: p = 100 r = 0.05 t = 0.5 compound_interest = p * (1 + r) ** t result = compound_interest return result
8. Michelle needs just one cup of sugar for the cake she's baking. She buys a packet containing 5 cups of sugar. Each cup of sugar costs $1. How much did Michelle spend in total?
def solve() -> int: packs = 1 cups = 5 price = 1 cost = packs * cups * price result = cost return result
Rachel baked 60 cookies and gave 7 of them to her friend. Her sister ate 21 of the remaining cookies. How many cookies does Rachel have left?
def solve() -> int: cookies_baked = 60 cookies_given_to_friend = 7 cookies_eaten_by_sister = 21 cookies_left = cookies_baked - cookies_given_to_friend - cookies_eaten_by_sister result = cookies_left return result
Maya bought 96 pencils and wants to split them equally among her 6 classmates. How many pencils will each classmate get?
def solve() -> int: pencils_bought = 96 classmates = 6 pencils_per_classmate = pencils_bought / classmates result = pencils_per_classmate return result
A recipe calls for 3/4 cup of sugar. If you want to make 1 and 1/2 times the original recipe, how much sugar will you need?
def solve() -> int: original_recipe = 0.75 multiplier = 1.5 new_recipe = original_recipe * multiplier result = new_recipe return result
arah buys 3 packs of gum for $1 each, and a pack of mints for $2. If she gives her sister 1 of the packs of gum and pays her back for the mints, how much money does Sarah have left?
def solve() -> int: num_gum = 3 cost_gum = 1 num_mints = 1 cost_mints = 2 total_cost = num_gum * cost_gum + cost_mints total_cost -= cost_gum total_cost += cost_mints result = total_cost return result
A corporation has a total of 400 employees, 60% of whom are male. How many female employees are there in the corporation?
def solve() -> int: total_employees = 400 percent_male = 60 percent_female = 100 - percent_male num_female = (percent_female/100) * total_employees result = num_female return result
A company produces 500 units of product A daily. The production cost per unit is $7.50. If the company sells the product for $10.00 per unit, what is the daily profit for product A?
def solve() -> int: product_A_units = 500 production_cost_per_unit = 7.50 selling_price_per_unit = 10.00 daily_profit = (product_A_units * (selling_price_per_unit - production_cost_per_unit)) result = daily_profit return result
Jack wants to buy a skateboard that costs $40. He earns $2 for every hour he helps his dad in the garden. He also collects cans and bottles and sells them for $0.05 each. He has already collected 120 cans and bottles. However, he spends $10 on candy when he is halfway towards his goal. How many hours does he work in th...
def solve() -> int: skateboard_price = 40 hourly_rate = 2 can_rate = 0.05 cans_collected = 120 candy_expense = 10 can_money = cans_collected * can_rate work_money = skateboard_price - can_money half_work_money = work_money / 2 half_work_hours = half_work_money / hourly...
The average of three numbers is 24. If two of the numbers are 15 and 28, what is the third number?
def solve() -> int: num1 = 15 num2 = 28 average = 24 num3 = (average * 3) - (num1 + num2) result = num3 return result
Student: Jack is 5 centimeters shorter than Alex. Alex is 10 centimeters shorter than Rose. Rose is 4 centimeters taller than Ryan. How tall is Jack?
def solve() -> int: jack = 0 alex = 0 rose = 0 ryan = 0 jack = alex - 5 alex = rose - 10 rose = ryan + 4 result = jack return result
- A pentagon has five sides and five vertices. If a group of pentagons has 25 more sides than four times as many vertices as a single pentagon has, what is the total number of vertices in this group of pentagons?
def solve() -> int: sides = 25 + 4 * 5 vertices = sides / 4 result = vertices * 5 return result
Student: Dana has $140. She spends $20 every week for the next 5 weeks. How much money will she have left after the five weeks?
def solve() -> int: starting_money = 140 weekly_spending = 20 num_weeks = 5 total_spending = weekly_spending * num_weeks money_left = starting_money - total_spending result = money_left return result
A vacuum cleaner that runs for three hours consumes 2.4 kilowatts. How many kilowatts would the vacuum cleaner consume if it was used for 2 hours a day for 4 days?
def solve() -> int: hours_per_day = 2 days = 4 total_hours = hours_per_day * days consumption_per_hour = 2.4 total_consumption = total_hours * consumption_per_hour result = total_consumption return result
A farmer has 24 cows and 30 sheep. If the farmer sells 4 cows, how many sheep are there for every cow left?
def solve() -> int: cows_after_sale = 24 - 4 sheep_per_cow = 30/cows_after_sale result = sheep_per_cow return result
A bag of candy contains 30 pieces. If each piece costs $0.25, how much would it cost for 5 pieces of candies?
def solve() -> int: cost_per_candy = 0.25 number_of_candies = 30 cost_of_bag = cost_per_candy * number_of_candies number_of_pieces = 5 cost_of_pieces = cost_per_candy * number_of_pieces result = cost_of_pieces return result
Mia is buying school supplies. She needs pencils, notebooks, and markers. Pencils cost $0.50 each, notebooks cost $2 each, and markers cost $1 each. If she needs to buy 20 pencils, 5 notebooks, and 10 markers, how much will she spend in total?
def solve() -> int: pencil_cost = 0.50 notebook_cost = 2 marker_cost = 1 num_pencils = 20 num_notebooks = 5 num_markers = 10 total_pencil_cost = pencil_cost * num_pencils total_notebook_cost = notebook_cost * num_notebooks total_marker_cost = marker_cost * num_markers ...
A baker makes 2000 cupcakes for a party, but only sells 5/8 of them. He then decides to donate the remaining cupcakes to a charity that distributes them equally among 20 local schools. How many cupcakes does each school receive from the charity?
def solve() -> int: sold_cupcakes = 2000 * 5 / 8 donated_cupcakes = 2000 - sold_cupcakes cupcakes_per_school = donated_cupcakes / 20 result = cupcakes_per_school return result
A rectangle has a length of 16 units and area of 96 square units. What is the width of the rectangle?
def solve() -> int: length = 16 area = 96 width = area / length result = width return result
If it takes Maria 4 minutes on Monday, 8 minutes on Wednesday and 6 minutes on Friday to walk to work, how long, on average, does it take her to walk to work in a week?
def solve() -> int: total_time = 4 + 8 + 6 average_time = total_time / 3 result = average_time return result
Geena made 91 free throws on Monday. She made 3/4 as many on Tuesday. On Wednesday, Geena made 68 free throws. How many free throws did Geena make in total on Monday and Tuesday?
def solve() -> int: ft_made_mon = 91 ft_made_tue = ft_made_mon * 3 / 4 total_ft_made = ft_made_mon + ft_made_tue result = total_ft_made return result