question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
An apple costs $0.50 and a banana costs $0.25. If I buy 5 apples and 7 bananas, what is the total cost?
def solve() -> int: total_cost = 5*0.50 + 7*0.25 result = total_cost return result
A pizza has 8 slices. Alice ate 2 slices and Bob ate 3 slices. How many slices are left? If each slice costs $2.50, how much did Alice and Bob pay for their slices?
def solve() -> int: pizza_slices = 8 alice_slices = 2 bob_slices = 3 left_slices = pizza_slices - alice_slices - bob_slices slice_cost = 2.50 alice_paid = alice_slices * slice_cost bob_paid = bob_slices * slice_cost result = (left_slices, alice_paid, bob_paid) return result
Out of 90 students in Grade 10, Mrs. Thompson noticed that only 40% managed to get a C+ or better on their English literature final exam. How many students scored lower than C+ on the final exam?
def solve() -> int: total_students = 90 percentage_C_plus_or_better = 0.40 students_C_plus_or_better = total_students * percentage_C_plus_or_better students_below_C_plus = total_students - students_C_plus_or_better result = students_below_C_plus return result
There are 25 students in a class, and at least 5 of them want to be in the soccer team. If there are only 11 spots, what is the maximum number of students that will be left out of the team?
def solve() -> int: num_students = 25 num_spots = 11 min_selected = 5 num_left_out = num_students - min_selected - num_spots if num_left_out < 0: num_left_out = 0 result = f'{num_left_out} students will be left out of the team.' result = num_left_out return result
Rachel is trying to decide which books to donate to the library. She has half as many new books as she does damaged ones. If she removes 50 books total, how many were damaged?
def solve() -> int: damaged_books = 0 new_books = 0 x = (2 * 50) / 3 damaged_books = x result = damaged_books print return result
Lila loves to read books and has a shelf of 80 books in her room. She reads 10 books every month and buys 5 new books every month. She also donates 2 books to the library every month. How many books will Lila have on her shelf after 6 months?
def solve() -> int: books = 80 read = 10 bought = 5 donated = 2 for month in range(1, 7): books -= read books += bought books -= donated result = books return result
``` John has two sheets of cardboard. The first is 9 inches by 12 inches and the second is 6 inches by 8 inches. What is the perimeter of the first piece of cardboard in inches squared?
def solve() -> int: cardboard1_perimeter = 2 * (9 + 12) cardboard2_perimeter = 2 * (6 + 8) difference = cardboard1_perimeter - cardboard2_perimeter result = difference return result
Luke makes a stir fry every night. He uses 1/4 cup of soy sauce and mixes with 1/2 cup of broccoli. He buys soy sauce in bottles of 32 ounces for $5.99 and broccoli in bags of 2 pounds for $3.99. After 14 days, how much has he spent on soy sauce and broccoli?
def solve() -> int: soy_sauce_per_cup = 32 / 4 broccoli_per_cup = 2 / 0.5 soy_sauce_cost_per_cup = 5.99 / 32 broccoli_cost_per_cup = 3.99 / 2 soy_sauce_per_day = soy_sauce_per_cup * soy_sauce_cost_per_cup broccoli_per_day = broccoli_per_cup * broccoli_cost_per_cup total_cost_p...
Holly has $72. She goes to the store and buys 4 bars of soap for $1 each, 3 bottles of shampoo for $3 each, and 2 bags of chip for $7 each. How much money will Holly have left after her purchase?
def solve() -> int: money_left = 72 number_of_soap = 4 cost_of_soap = 1 total_soap_cost = number_of_soap * cost_of_soap number_of_shampoo = 3 cost_of_shampoo = 3 total_shampoo_cost = number_of_shampoo * cost_of_shampoo number_of_chips = 2 cost_of_chips = 7 total_chi...
arah goes on a road trip. If she drives for 9 hours and travels 400 kilometers, what is her average speed?
def solve() -> int: distance = 400 time = 9 average_speed = distance/time result = average_speed return result
Kim sold her old laptop for $300 and used the money to buy a new laptop that cost $900. She also traded in her old phone for a $100 discount on the new laptop. If she paid 15% sales tax on the final price of the new laptop, how much money did she have to pay out of pocket?
def solve() -> int: price_after_trade_in = 900 - 100 sales_tax = price_after_trade_in * 0.15 final_price = price_after_trade_in + sales_tax money_out_of_pocket = final_price - 300 result = money_out_of_pocket return result
Jenny rides her bike at a speed of 20 mph, while Tommy rides at a speed of 25 mph. If both of them start at the same place and travel in opposite directions, how far apart will they be after 2 hours?
def solve() -> int: speed1 = 20 speed2 = 25 time = 2 total_distance = (speed1 + speed2) * time result = total_distance return result
A construction company bought $3000 worth of cement bags with 50 bags in total. If the company sells each bag at $80, how much profit will they make?
def solve() -> int: cost_price = 3000 bags = 50 selling_price = 80 * bags profit = selling_price - cost_price result = profit return result
At a grocery store, a pound of bananas costs $0.50 and a pound of grapes costs $1.25. If John buys 2 pounds of bananas and 3 pounds of grapes, how much does he spend altogether?
def solve() -> int: bananas_price = 0.50 grapes_price = 1.25 bananas_weight = 2 grapes_weight = 3 bananas_cost = bananas_price * bananas_weight grapes_cost = grapes_price * grapes_weight total_cost = bananas_cost + grapes_cost result = total_cost return result
``` A cube has a side length of 6 meters. What is the volume of the cube?
def solve() -> int: side_length = 6 volume = side_length**3 result = volume return result
Lisa is driving 300 kilometers at a speed of 80 kilometers per hour. How much faster must she drive to decrease her travel time by 2.5 hours?
def solve() -> int: distance = 300 speed = 80 time = distance / speed new_time = time - 2.5 new_speed = distance / new_time increase_in_speed = new_speed - speed result = increase_in_speed return result
A class of 24 students is divided into 4 groups for a project. Each group has the same number of students. How many students are in each group?
def solve() -> int: students_per_group = 24 // 4 result = students_per_group return result
Jason gets paid $3 for every lawn he mows. He also earns a $20 bonus for every 10 lawns mowed. If he mows 30 lawns, how much money will he make with bonuses included?
def solve() -> int: lawns_mowed = 30 lawn_payment = 3 bonus_lawns = 10 bonus_amount = 20 bonus_count = lawns_mowed // bonus_lawns total_payment = lawns_mowed * lawn_payment total_bonus = bonus_count * bonus_amount total_earnings = total_payment + total_bonus ...
John saved $100 each week for a month. If a month has 4 weeks, how much money did John save in total?
def solve() -> int: savings_per_week = 100 weeks_per_month = 4 total_savings = savings_per_week * weeks_per_month result = total_savings return result
An antique retailer is having a 25% off sale. If Bob buys a $260 vase at the store and a $140 table, how much money will Bob save from the sale?
def solve() -> int: originalCost = 260 + 140 discount = originalCost * 0.25 result = originalCost - discount return result
Student: A bird flew 120km in 4 hours. How fast was the bird flying in km/h?
def solve() -> int: distance = 120 time = 4 speed = distance / time result = speed return result
John can either buy a new gaming console for $400 or upgrade his current one for $80. If he decides to upgrade, how much money will he save over buying a new one?
def solve() -> int: savings = 400 - 80 result = savings return result
**** Adam sold 30 boxes of ice cream. If each box cost $7, how much money did he make in total?
def solve() -> int: num_of_boxes_sold = 30 price_of_each_box = 7 total_price = num_of_boxes_sold * price_of_each_box result = total_price return result
A box contains 12 chocolates, 3 of which are white, 4 are dark, and 5 are milk. Zara picks 2 chocolates at random from the box without looking. What is the probability that both chocolates are dark?
def solve() -> int: from fractions import Fraction p_first_dark = Fraction(4, 12) p_second_dark = Fraction(3, 11) p_both_dark = p_first_dark * p_second_dark result = p_both_dark return result
Oliver's pizza restaurant uses 6 pounds of mozzarella cheese and 2 pounds of tomato sauce each day. How much mozzarella cheese and tomato sauce does he use in a week?
def solve() -> int: mozzarella_per_day = 6 tomato_sauce_per_day = 2 mozzarella_per_week = mozzarella_per_day * 7 tomato_sauce_per_week = tomato_sauce_per_day * 7 result = f"{mozzarella_per_week} pounds of mozzarella cheese and {tomato_sauce_per_week} pounds of tomato sauce are used in a we...
Lily has a rectangular garden that is 12 m long and 8 m wide. She wants to plant roses along the perimeter of the garden. Each rose plant needs 0.4 m of space. How many rose plants can she plant?
def solve() -> int: perimeter = 2 * (12 + 8) plants = perimeter / 0.4 result = plants return result
Jake is paying for his weekly gym membership bill. The gym charges Jake $30 per week for gym access and $10 per week for a personal trainer. Jake has signed up for a gym membership and a personal trainer. They're giving him a 5% discount on the whole bill after he completes a 5-day workout routine but also charging him...
def solve() -> int: gym_access_fee = 30 personal_trainer_fee = 10 discount_percentage = 5 fine = 5 total_fee = gym_access_fee + personal_trainer_fee discount_amount = (total_fee * discount_percentage) / 100 total_fee -= discount_amount total_fee += fine result = t...
If Thomas bought 8 bags of marbles, and there were 25 marbles in each bag, and he paid $0.15 for each marble, how much did he spend in total?
def solve() -> int: bags = 8 marbles_per_bag = 25 cost_of_marble = 0.15 total_cost = bags * marbles_per_bag * cost_of_marble result = total_cost return result
There were 120 apples in the basket. On the first day, 10 of them were eaten by the family, and on the second day, 5% of the remaining apples spoiled. What percentage of the apples were still edible after two days?
def solve() -> int: apples = 120 apples1 = apples - 10 apples2 = round(apples1 * 0.95) percentage_edible = round(apples2 / apples * 100) result = percentage_edible return result
David wants to build a pyramid out of legos with 5 levels where the bottom level has 10 legos per side and each level has one more lego per side than the level below it. How many legos will he need in total?
def solve() -> int: bottom_level = 10 num_levels = 5 legos_per_level = [] for i in range(num_levels): legos_per_level.append(bottom_level + i) total_legos = sum(legos_per_level) result = total_legos return result
How many 6-sided dice are needed to roll a total of 30?
def solve() -> int: total_dice = 30 side = 6 result = total_dice // side return result
Q3: A aquarium has 600 fish of which 50% are guppies and the rest are swordtails. If 30% of the guppies and 10% of the swordtails get eaten, how many fish are left?
def solve() -> int: number_of_guppies = 0 number_of_swordtails = 0 number_of_guppies = 600/2 number_of_swordtails = 600 - number_of_guppies number_of_guppies = number_of_guppies - 0.3*number_of_guppies number_of_swordtails = number_of_swordtails - 0.1*number_of_swordtails number_of_fish_...
Emma has 60 toys. A fifth of them are stuffed animals. Of those, a third are bears and the rest are other animals. How many non-bear stuffed animals does Emma have?
def solve() -> int: toys = 60 stuffed_animals = toys / 5 bears = stuffed_animals / 3 non_bear_stuffed_animals = stuffed_animals - bears result = non_bear_stuffed_animals return result
Adam has 270 cups to share equally among 3 friends. How many cups will each of them get?
def solve() -> int: total_cups = 270 num_friends = 3 share_per_friend = total_cups//num_friends result = share_per_friend return result
Leo paints at 6 square feet per hour and Mia paints at 8 square feet per hour. They start painting a 120-square foot wall at the same time, but Leo starts from the left end and Mia starts from the right end. How many hours will it take before they finish painting the wall?
def solve() -> int: t = 7.5 result = t return result
Happy House has 30 books. This means there are 9 less than 2 times as many books on Happy House as on Dreamland. How many books are there on Dreamland?
def solve() -> int: happy_house_books = 30 dreamland_books = (happy_house_books - 9) / 2 result = dreamland_books return result
Mark wants to rent a studio that costs $1,000 per month. He has $1,500 saved. The landlord requires a 1-month deposit, a $100 cleaning fee, and a $50 processing fee. How much more money does Mark need to rent the studio?
def solve() -> int: monthly_rent = 1000 savings = 1500 deposit = monthly_rent cleaning_fee = 100 processing_fee = 50 total_cost = deposit + cleaning_fee + processing_fee remaining_money = total_cost - savings result = remaining_money return result
Mark is preparing for a fishing trip and needs to buy enough bait for everyone. He calculates that each person will need 1/4 pound of bait and there will be 10 people on the trip. If bait is sold in 1-pound bags for $8.00 each, how much will Mark spend on bait?
def solve() -> int: num_people = 10 bait_per_person = 1/4 bait_per_bag = 1 cost_per_bag = 8.00 total_bait_needed = num_people * bait_per_person num_bags_needed = total_bait_needed / bait_per_bag total_cost = num_bags_needed * cost_per_bag result = total_cost return r...
Ronald can swim 100 meters in 2 minutes. If a pool is 300 meters long, calculate how long it will take Ronald to swim the length of the pool.
def solve() -> int: time_per_meter = 2/100 total_time = time_per_meter*300 result = total_time return result
Jenna is baking 36 cupcakes, but she'll only eat the ones without icing. If it takes her 15 minutes to prepare each cupcake, how many hours will she spend baking and preparing the cupcakes?
def solve() -> int: num_cupcakes = 36 time_per_cupcake = 15 total_time = num_cupcakes * time_per_cupcake hours = total_time / 60 result = hours return result
Liam wants to buy a new guitar, amplifier, and guitar case. The guitar costs $800, the amplifier is 60% of that price, and the guitar case is $100. Liam is able to get the guitar for 25% off. How much will Liam spend in total on his new musical equipment?
def solve() -> int: guitar_price = 800 amplifier_price = guitar_price * 0.6 guitar_price = guitar_price * 0.75 guitar_case_price = 100 total_price = guitar_price + amplifier_price + guitar_case_price result = total_price return result
Mary has a garden in which she can plant flowers or vegetables. She can plant 12 flowers or 8 vegetables per square meter. She has 15 square meters available. What should she plant to maximize the number of plants?
def solve() -> int: flowers_per_square_meter = 12 vegetables_per_square_meter = 8 total_square_meters = 15 max_flowers = flowers_per_square_meter * total_square_meters max_vegetables = vegetables_per_square_meter * total_square_meters if max_flowers > max_vegetables: resul...
Sarah wants to buy cupcakes for herself and her 6 friends. Each cupcake costs $4 and can feed 2 people. If Sarah earns $15 an hour babysitting, how many hours will she have to babysit to afford the cupcakes?
def solve() -> int: num_people = 7 num_cupcakes = num_people / 2 cost_per_cupcake = 4 total_cost = num_cupcakes * cost_per_cupcake earnings_per_hour = 15 hours_needed = total_cost / earnings_per_hour result = hours_needed return result
A video game costs $49.99 and is on sale for 15% off. What is the sale price?
def solve() -> int: original_price = 49.99 discount = original_price * 0.15 sale_price = original_price - discount result = sale_price return result
Student: Jack needs to buy 6 basketballs for his team. He bought 3 basketballs and each one of them was priced at $14. How much did he spend for the basketball?
def solve() -> int: num_of_basketballs = 6 num_of_bought_basketballs = 3 price_per_basketball = 14 total_cost = num_of_bought_basketballs * price_per_basketball remaining_cost = (num_of_basketballs - num_of_bought_basketballs) * price_per_basketball total_cost_all_basketballs = total_cost + rema...
A science video is 60 minutes long. Rose decides to watch it at triple the average speed. Tom, their friend, watches the same video at the average speed. If they both watch six of the same videos, what's the total number of minutes they watch?
def solve() -> int: video_length = 60 rose_speed = 3 tom_speed = 1 num_videos = 6 rose_time = video_length / rose_speed tom_time = video_length / tom_speed total_time = (rose_time + tom_time) * num_videos result = total_time return result
Student: Samantha is traveling from Los Angeles to San Francisco, a distance of 380 miles. If she drives 60 miles per hour, how many hours will it take her to get to San Francisco?
def solve() -> int: distance = 380 speed = 60 time = distance / speed result = time return result
The total marks obtained by a student in 5 subjects are 80, 90, 95, 75 and 85. What is the average percentage marks of a student?
def solve() -> int: total_marks = sum([80,90,95,75,85]) total_possible_marks = 5*100 average_percentage = (total_marks/total_possible_marks)*100 result = average_percentage return result
If a painter can paint a room in 5 hours and her assistant can paint it in 8 hours, how long will it take for them to paint the room if they work together?
def solve() -> int: hours_painter = 5 hours_assistant = 8 total_duration = 1/((1/hours_painter) + (1/hours_assistant)) result = total_duration return result
Rachel purchased 30 toy cars. She gave her classmates 4 toy cars each, then gave the remaining one-fifth of them to her cousin. If she sold 10 toy cars, how many toy cars are left?
def solve() -> int: toy_cars = 30 classmates = 4 remaining = toy_cars - (toy_cars // classmates) cousin = remaining // 5 sold = 10 left = remaining - sold result = left return result
The difference in the number of pencils that Sarah and Rachel each have matches their age difference. Sarah has 70 pencils and Rachel has 2/9 times as many pencils as Sarah. If Sarah's age is 23 and Rachel is older than Sarah, calculate Rachel's age in 3 years to come.
def solve() -> int: sarah_pencils = 70 sarah_age = 23 rachel_pencils = 2/9 * sarah_pencils age_diff = rachel_pencils - sarah_pencils rachel_age = sarah_age + age_diff rachel_age_in_3_years = rachel_age + 3 result = rachel_age_in_3_years return result
Student: Lucy needs to buy 12 apples from a fruit market. If apples are sold in packs of 4, how many packs does Lucy need to buy?
def solve() -> int: apples_needed = 12 apples_in_pack = 4 packs_needed = apples_needed // apples_in_pack remaining_apples = apples_needed % apples_in_pack result = packs_needed return result
Brian buys 12 pencils for $6 and sells them for $0.75 each. How much profit does he make per pencil?
def solve() -> int: cost = 6 / 12 sell = 0.75 profit = sell - cost result = profit return result
If a restaurant serves 240 customers in 4 days, how many customers will they serve in 7 days if they serve the same amount of customers each day?
def solve() -> int: customers_per_day = 240/4 total_customers = customers_per_day * 7 result = total_customers return result
A team of geologists are researching a volcano. They discovered that the height of the volcano increased by 200 meters in the first year and then doubled in height in the second year. This year, the height of the volcano increased by 300 meters. What is the current height of the volcano?
def solve() -> int: first_year_increase = 200 second_year_increase = first_year_increase * 2 this_year_increase = 300 total_increase = first_year_increase + second_year_increase + this_year_increase current_height = total_increase + 0 result = current_height return resu...
Student: If Leandro has 25 more than Prakash, and Prakash has 40% less than Hannah, and Hannah has 260, how much does Leandro have?
def solve() -> int: hannah = 260 prakash = hannah * 0.6 leandro = prakash + 25 result = leandro return result
Christian wants to buy a car that costs $25,000. He has $12,000 saved and plans to get a loan with an interest rate of 5%. If he pays $350 each month, how many months will it take for him to pay off the loan with the interest?
def solve() -> int: car_cost = 25000 down_payment = 12000 loan = car_cost - down_payment interest_rate = 0.05 monthly_payment = 350 monthly_interest = interest_rate / 12 months = 0 while loan > 0: loan += loan * monthly_interest loan -= monthly_payment months += 1...
Books are sold in bundles of 8 and 12. Alex bought 5 bundles of 12 books. If he wants to distribute 2 books each to 120 students in the library, how many bundles of 8 books should he need to buy?
def solve() -> int: bundles_of_12 = 5 books_per_bundle_12 = 12 students = 120 books_per_student = 2 total_books = bundles_of_12 * books_per_bundle_12 total_students = students * books_per_student bundles_of_8 = total_students // 8 result = bundles_of_8 return result
Lisa bought a necklace with a 25% discount and paid $15. She also had to pay a 10% sales tax on the discounted price. How much was the necklace before the discount and the tax?
def solve() -> int: price_paid = 15 discount_rate = 25 / 100 tax_rate = 10 / 100 tax_amount = price_paid * tax_rate discounted_price = price_paid + tax_amount original_price = discounted_price / (1 - discount_rate) result = original_price return result
There are seventy tickets to be sold for a soccer match. Clair sold three times as many tickets as Mona while Nancy sold half the number of tickets Clair sold. If Mona sold 18 tickets, how many tickets need to be sold?
def solve() -> int: total_tickets = 70 mona_tickets = 18 nancy_tickets = 0.5 * (3 * mona_tickets) clair_tickets = 3 * mona_tickets result = total_tickets - (mona_tickets + nancy_tickets + clair_tickets) return result
A pizza restaurant sold 120 pizzas in one day. If their revenue for the day was $1,200 and each pizza costs the same amount, how much did they charge for each pizza?
def solve() -> int: pizzas = 120 revenue = 1200 cost_per_pizza = revenue / pizzas result = cost_per_pizza return result
Student: A rectangle has a perimeter of 26 cm and an area of 35 sq cm. What are the dimensions of the rectangle?
def solve() -> int: perimeter = 26 area = 35 length = area / 2 width = perimeter / 4 - length result = (length, width) return result
In a pet shop, there are 4 times the amount of fishes than rabbits, and 5 times the amount of cats than rabbits. The total amount of animals are 65, and the number of guinea pigs is equal to the number of rabbits multiplied by 3. How many more cats are there than guinea pigs?
def solve() -> int: rabbits = 65/9*1 fishes = 4*rabbits cats = rabbits*5 guinea_pigs = rabbits*3 result = cats-guinea_pigs return result
A grocery store is 5000 square feet. If there is 1 checkout aisle for every 200 square feet, how many checkout aisles are in the store?
def solve() -> int: store_area = 5000 aisle_area = 200 checkout_aisles = store_area // aisle_area result = checkout_aisles return result
David is running a marathon. For every 3 miles he runs, he stops and takes a 1-minute break. If he wants to run 26 miles, how many breaks will he take?
def solve() -> int: total_distance = 26 distance_per_break = 3 num_breaks = (total_distance // distance_per_break) - 1 result = num_breaks return result
Whitney has 25 dollars in her wallet, all in one dollar bills. Her friend, Katie has half the amount but then spends $5.00 on a toy. How much money does Katie have left?
def solve() -> int: whitney_money = 25 katie_money = whitney_money / 2 katie_money -= 5 result = katie_money return result
Student: Jane drove 300 miles in 5 hours. What was her average speed in miles per hour?
def solve() -> int: distance = 300 time = 5 result = distance / time return result
If a phone costs $300 with no tax added, and the tax rate is 10%, what is the total cost of the phone including tax?
def solve() -> int: phone_cost = 300 tax_rate = 0.1 total_cost = phone_cost * (1 + tax_rate) result = total_cost return result
A recipe calls for 1/4 cup of butter and 3/4 cups of flour for every 8 servings. If you want to make 24 servings, how much butter and flour do you need?
def solve() -> int: servings = 24 butter = 1/4 * servings/8 flour = 3/4 * servings/8 result = butter + flour return result
Emily and her friends are planning a weekend getaway. They invite 5 friends and 10 family members. Each person is allowed to bring 2 guests along. How many people will be attending the weekend trip?
def solve() -> int: friends = 5 family_members = 10 guests_per_person = 2 total_people = (friends + family_members) * guests_per_person result = total_people return result
Jennifer was taking a math test and had to solve the following If Rachel has $125 in her wallet and she spends $28 at the store, how much money does she have left?
def solve() -> int: currentBalance = 125 spent = 28 remainingBalance = currentBalance - spent result = remainingBalance return result
A rectangular garden has a length of 12 meters and a width of 8 meters. A gardener wants to plant flowers along the perimeter of the garden. Each flower needs 20 cm of space. How many flowers can the gardener plant?
def solve() -> int: perimeter = 2 * (12 + 8) perimeter_in_cm = perimeter * 100 flowers = perimeter_in_cm / 20 result = flowers return result
A car manufacturer produces 600 cars per day. If they work for 5 days a week, then how many cars do they produce in a year?
def solve() -> int: cars_per_day = 600 days_per_week = 5 weeks_per_year = 52 total_cars_produced = cars_per_day * days_per_week * weeks_per_year result = total_cars_produced return result
alim has 124 cups and he divides them equally among 9 people. How many cups will each person get?
def solve() -> int: number_of_cups_each = 124/9 result = number_of_cups_each return result
Mark buys $65 worth of apples and bananas. He pays $8 for each box of apples, and $3 for every one banana. How many boxes of apples and bananas did he buy?
def solve() -> int: total_amount_spent = 65 price_apples = 8 price_banana = 3 total_boxes_apples = total_amount_spent // price_apples total_bananas = total_amount_spent % price_apples // price_banana result = [total_boxes_apples, total_bananas] return result
Jamie collected 3 bags of apples, Kaitlyn collected 2 and a half bags, and Sarah collected 6 bags. If each bag contains 10 apples, how many apples did they collect in total?
def solve() -> int: num_bags_jamie = 3 num_bags_kaitlyn = 2.5 num_bags_sarah = 6 num_apples_per_bag = 10 total_num_apples = (num_bags_jamie + num_bags_kaitlyn + num_bags_sarah) * num_apples_per_bag result = total_num_apples return result
an had 28 books while Tom had twice as many books as Sean. If Tom gave Sean 5 books, how many books does Tom have now?
def solve() -> int: sean_books = 28 tom_books = sean_books * 2 sean_books = sean_books + 5 tom_books = tom_books - 5 result = tom_books return result
Emma has 35 balloons for her birthday party. She wants to give each guest 2 balloons. How many guests can she invite to her party?
def solve() -> int: balloons = 35 balloons_per_guest = 2 guests = balloons // balloons_per_guest result = guests return result
Mary saved up 25% of her weekly allowance. If her allowance was $20, how much did Mary save?
def solve() -> int: allowance = 20 percent_saved = 25 amount_saved = allowance * (percent_saved/100) result = amount_saved return result
William has a box containing 108 marbles in 3 colors: red, blue and green. Green marbles are twice as many as the red marbles and blue marbles are 3 times as many as the green marbles. How many marbles of each color are there?
def solve() -> int: total_marbles = 108 green_marbles = (total_marbles / 7) * 4 red_marbles = total_marbles / 7 blue_marbles = green_marbles * 3 result = f"Green marbles: {green_marbles}, Red marbles: {red_marbles}, Blue marbles: {blue_marbles}" return result
A washing machine can clean 12 shirts in 20 minutes or 18 pairs of socks in 30 minutes. If Sarah washed 9 shirts and 12 pairs of socks, how many minutes did it take?
def solve() -> int: shirts_cleaned = 9 socks_cleaned = 12 shirts_per_minute = 12 / 20 socks_per_minute = 18 / 30 total_shirts_time = shirts_cleaned / shirts_per_minute total_socks_time = socks_cleaned / socks_per_minute total_time = max(total_shirts_time, total_socks_time) ...
Lizzy got a bonus of $1800 from her boss. She spent 40% of it on a new watch and 25% of what was left on her friend's birthday gift. How much money does Lizzy have left?
def solve() -> int: original_amount = 1800 watch_cost = 0.4 * original_amount amount_left = original_amount - watch_cost gift_cost = 0.25 * amount_left result = amount_left - gift_cost return result
There were 12 donuts in a box. If 2 are taken out, how many are left?
def solve() -> int: total_donuts = 12 taken_out = 2 result = total_donuts - taken_out return result
In a cooking contest, the winner scored 90% on their dish while the runner-up scored the rest. If there were 10 dishes in total, but only 70% of them were scored, how many more points did the winner get than the runner-up?
def solve() -> int: total_dishes = 10 scored_dishes = total_dishes * 0.7 winner_score = 0.9 * scored_dishes runner_up_score = (1 - 0.9) * scored_dishes difference = winner_score - runner_up_score result = difference return result
Here are some possible questions and programs: Mary sells 15 bracelets and 8 necklaces every week. A bracelet costs $12 and a necklace costs $18. She also spends 20 percent of her total earnings on materials and packaging. How much is her profit every week?
def solve() -> int: bracelets = 15 necklaces = 8 bracelet_price = 12 necklace_price = 18 expense_rate = 0.2 earnings = (bracelets * bracelet_price) + (necklaces * necklace_price) expenses = earnings * expense_rate profit = earnings - expenses result = profit return result
John has two bags of marbles, one with 30 white marbles and the other with 35 black marbles. If he removes 3 white marbles and four times as many black marbles as white marbles (without looking), how many marbles does he have left in total?
def solve() -> int: white_marbles = 30 black_marbles = 35 white_marbles -= 3 black_marbles -= 4 * 3 total_marbles = white_marbles + black_marbles result = total_marbles return result
In a store, a shirt was originally priced at $29.99, but it is now on sale for 15% off. What is the sale price of the shirt?
def solve() -> int: original_price = 29.99 discount_percent = 15 discount_amount = (discount_percent/100) * original_price sale_price = original_price - discount_amount result = sale_price return result
Student: In a crowded marketplace, one third of the crowd is over the age of 40. Two fifths of the crowd are between the ages of 15 and 25. What fraction of the crowd is over 25?
def solve() -> int: over_40 = 1/3 between_15_25 = 2/5 over_25 = 1 - (over_40 + between_15_25) result = over_25 return result
A company has 500 employees. If 25% of those employees work remotely, how many employees work in the office?
def solve() -> int: employees = 500 remote_percentage = 0.25 remote_employees = employees * remote_percentage office_employees = employees - remote_employees result = office_employees return result
Tom wants to buy enough paint to repaint his bedroom. The bedroom is in a rectangular shape with a width of 6 meters, and length of 10 meters. How many liters of paint does he need to buy if one liter covers 6 square meters?
def solve() -> int: width = 6 length = 10 area_to_paint = width * length paint_coverage = 6 amount_of_paint_required = area_to_paint // paint_coverage result = amount_of_paint_required return result
A rectangular box has a length of 5 cm, a width of 3 cm, and a height of 2 cm. What is the volume of the box?
def solve() -> int: volume = 5 * 3 * 2 result = volume return result
Mr. Lee is a carpenter who makes wooden tables and chairs. He charges $200 for a table and $80 for a chair. He also pays $50 for the wood and $20 for the labor for each table, and $30 for the wood and $10 for the labor for each chair. If he made 10 tables and 40 chairs in a month, how much money did he earn after payin...
def solve() -> int: price_table = 200 price_chair = 80 wood_table = 50 wood_chair = 30 labor_table = 20 labor_chair = 10 tables_made = 10 chairs_made = 40 total_income = price_table * tables_made + price_chair * chairs_made total_expense = wood_table * tables_made + wood_chair * ...
In a pizza restaurant, a small pizza costs $8 and a large pizza costs $12. If Ted ordered 2 small pizzas and 3 large pizzas, how much did he spend?
def solve() -> int: num_small_pizzas = 2 num_large_pizzas = 3 price_small_pizza = 8 price_large_pizza = 12 total_cost = num_small_pizzas * price_small_pizza + num_large_pizzas * price_large_pizza result = total_cost return result
Amanda went on a 10km bike ride. She biked 4km at an average rate of 10km/hour and the rest at an average rate of 15km/hour. How long did the bike ride take?
def solve() -> int: distance1 = 4 speed1 = 10 distance2 = 10 - distance1 speed2 = 15 time1 = distance1/speed1 time2 = distance2/speed2 total_time = time1 + time2 result = round(total_time, 2) return result
Ava reads 30 pages of a book every day. The book has 360 pages and costs $18.00. She also has a membership card that gives her 10% off any book purchase. How much does she pay, in cents, for each page she reads after the discount is applied?
def solve() -> int: pages_per_day = 30 book_pages = 360 book_price = 18.00 discount = 0.1 discounted_price = book_price * (1 - discount) page_price = discounted_price * 100 / book_pages reading_price = page_price * pages_per_day result = round(reading_price, 2) return result
Tammy has $40 to spend at the farmers' market. If she buys 3 baskets of strawberries for $8 each and a bunch of carrots for $2, how much money does she have left?
def solve() -> int: money = 40 strawberries_cost = 8 num_strawberries = 3 carrots_cost = 2 total_cost = (strawberries_cost * num_strawberries) + carrots_cost money_left = money - total_cost result = money_left return result
Mike wanted to save money for a new video game and he only had $25 for the first week. Every week he put in an extra 10% of the money he already had saved and doesn’t spend any of it. After five weeks, Mike had saved up $83, what is the total amount Mike saved in 5 weeks?
def solve() -> int: totalSaved = 0 totalSaved = totalSaved + 25 remain = 25 for i in range(4): totalSaved = totalSaved + remain * 0.1 remain = remain + remain * 0.1 result = totalSaved return result
If the length of a rectangle is 15 inches more than its width, and the diagonal is 25 inches, what are the dimensions of the rectangle?
def solve() -> int: diagonal = 25 length = ((diagonal ** 2) / 2 - 225) ** 0.5 width = length - 15 result = f"The dimensions of the rectangle are {length}in by {width}in" return result
Tom got a gym membership. The first 10 sessions cost $50 and the next 10 sessions cost half that much. If he splits the cost equally with his workout buddy, how much did he pay?
def solve() -> int: sessions = 20 cost_per_session = 50 total_cost = 10 * cost_per_session + 10 * (cost_per_session / 2) cost_per_person = total_cost / 2 result = cost_per_person return result
Student: Calvin is designing a rectangular deck that is 18 feet long and 12 feet wide. How many 8-foot boards will he need to build the deck?
def solve() -> int: length = 18 width = 12 area = length * width num_boards = area / 8 num_boards = round(num_boards) result = num_boards return result