question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A parking meter charges $0.25 for every 15 minutes. How much would it cost to park for 1 hour and 45 minutes?
def solve() -> int: parking_time = 1*60 + 45 rate = 0.25/15 cost = rate * parking_time result = cost return result
Sarah purchased twelve bags of candies with the same number of candies in each bag. She ate six candies and shared the rest equally among her four cousins. If each cousin received ten candies, how many candies were there in each bag?
def solve() -> int: bags = 12 candies_per_bag = 0 total_candies = 0 candies_sarah_ate = 6 cousins = 4 candies_per_cousin = 10 total_candies = (cousins * candies_per_cousin) + candies_sarah_ate candies_per_bag = total_candies / bags result = can...
Dave earns $15 per hour for mowing the lawn. If he wants to earn $60, how many square meters of grass does he need to mow?
def solve() -> int: hourly_rate = 15 desired_earnings = 60 square_meters_per_hour = 10 earnings_per_square_meter = hourly_rate / square_meters_per_hour square_meters_to_mow = desired_earnings / earnings_per_square_meter result = square_meters_to_mow return result
am, Anna, and Ben are students in a music class. They need to practice playing the piano for an upcoming recital. Sam can play 12 songs in an hour. Anna can play 15 songs in 90 minutes, and Ben can play 18 songs in 120 minutes. If they all practice together, how many songs can they play in 45 minutes?
def solve() -> int: sam_rate = 12 / 60 anna_rate = 15 / 90 ben_rate = 18 / 120 total_rate = sam_rate + anna_rate + ben_rate result = total_rate * 45 return result
Ethan is planting a garden. Each plant requires 2 cups of soil and 1 seedling. If Ethan wants to plant 30 seedlings, how many cups of soil does he need in total?
def solve() -> int: seedlings = 30 soil_per_plant = 2 total_soil = seedlings * soil_per_plant result = total_soil return result
Jackie is a flower delivery person. Each bouquet costs 20 dollars and the delivery charge is 3 extra dollars if the area is farther than 2 km from the florist. Jackie delivers 5 bouquets to a restaurant, which is located 1 km away from the florist. Also, she delivers 3 bouquets to a wedding venue 3 km away from the flo...
def solve() -> int: bouquet_cost = 20 delivery_charge = 3 restaurant_distance = 1 wedding_venue_distance = 3 restaurant_payment = (bouquet_cost * 5) + (delivery_charge * (restaurant_distance > 2)) wedding_venue_payment = (bouquet_cost * 3) + (delivery_charge * (wedding_venue_distance >...
Student: Mike has 15 candy bars. He gives 3 candy bars to his friend Joe and 2 candy bars to his brother Jack. How many candy bars does Mike have left?
def solve() -> int: candy_bars = 15 candy_bars = candy_bars - 3 candy_bars = candy_bars - 2 result = candy_bars return result
Peter has $30 and spends $3 on 2 erasers and $10 on a set of colored pencils. How much money does Peter have left?
def solve() -> int: eraser_price = 3 pencil_price = 10 money_had = 30 result = money_had - (eraser_price*2) - pencil_price return result
Timothy has 500 dollars. He spends 200 dollars on a new phone and 100 dollars on new clothes. How much money does he have left?
def solve() -> int: money_timothy = 500 phone_cost = 200 clothes_cost = 100 total_spent = phone_cost + clothes_cost money_left = money_timothy - total_spent result = money_left return result
Rachel is currently 3 years older than her cousin, Rachel's age is currently half of their grandma's age who is 70 years old. How old is Rachel's cousin?
def solve() -> int: grandma_age = 70 rachel_age = grandma_age / 2 cousin_age = rachel_age - 3 result = cousin_age return result
Sam collects stamps from different countries. He has 240 stamps in total, of which 40% are from Europe, 30% are from Asia, 20% are from Africa, and 10% are from the Americas. If he wants to arrange his stamps in an album that has 12 pages and 20 slots per page, how many pages will he need for each continent?
def solve() -> int: total_stamps = 240 europe_ratio = 0.4 asia_ratio = 0.3 africa_ratio = 0.2 americas_ratio = 0.1 pages = 12 slots = 20 europe_stamps = total_stamps * europe_ratio asia_stamps = total_stamps * asia_ratio africa_stamps = total_stamps * africa_ratio americas_st...
Peter weighs 170 pounds and wants to lose weight. If bike riding for 1 hour helps reduce 2 pounds, how many pounds will Peter weigh if he rides the bike for 2 hours daily for 4 weeks?
def solve() -> int: peter_weight = 170 hourly_weight_loss = 2 daily_hours = 2 weekly_days = 7 total_weeks = 4 weekly_weight_loss = hourly_weight_loss * daily_hours total_weight_loss = weekly_weight_loss * weekly_days * total_weeks final_weight = peter_weight - total_weight_loss ...
Cindy went to the store and bought 3 apples, 4 oranges, and 5 bananas. How many pieces of fruits did she buy in total?
def solve() -> int: total_fruits = 3 + 4 + 5 result = total_fruits return result
Jessie cleaned for 2 hours on Monday, 1.25 hours on Wednesday, and 2.5 hours on Friday. Her friend Lucy cleaned for triple the total amount of time that Jessie cleaned. How many minutes did Jessie and Lucy clean in total?
def solve() -> int: hoursJessie = 2 + 1.25 + 2.5 minutesJessie = hoursJessie * 60 minutesLucy = minutesJessie * 3 totalMinutes = minutesJessie + minutesLucy result = totalMinutes return result
A store has a sale where everything is 25% off. If an item costs $80 before the sale, how much does it cost during the sale?
def solve() -> int: original_price = 80 percent_off = 25 discount = (percent_off/100) * original_price sale_price = original_price - discount result = sale_price return result
Emily had 100 candies to share with her classmates. One fifth of the candies were chocolate, and the rest were equal parts strawberry, blueberry, and raspberry. How many candies were raspberry?
def solve() -> int: total_candies = 100 chocolate_candies = total_candies / 5 non_chocolate_candies = total_candies - chocolate_candies raspberry_candies = non_chocolate_candies / 3 result = raspberry_candies return result
Azula scored 18 points in a game, then scored twice as many points as she did in the previous game. How many points did Azula score in total in both games?
def solve() -> int: points_1 = 18 points_2 = 2 * points_1 points_total = points_1 + points_2 result = points_total return result
Kyle wants to add 9 hanging flower baskets to his front porch. He wants to hang 3 baskets on each side and 3 baskets along the front of the porch. The baskets will each be 1 foot wide and will need 1.5 feet between each one. All told, how much space will these baskets take up on his porch?
def solve() -> int: num_baskets = 9 baskets_per_side = 3 baskets_front = 3 basket_width = 1 space_between_baskets = 1.5 total_width = (baskets_per_side * basket_width) + ((baskets_per_side - 1) * space_between_baskets) total_length = (baskets_front * basket_width) + ((baskets_front - 1)...
The price of 100 erasers is $20 and the price of 6 pencil sharpeners is $24. What is the total cost for all of them?
def solve() -> int: cost_eraser = 20/100 num_eraser = 100 cost_sharpener = 24/6 num_sharpener = 6 total_cost = (cost_eraser * num_eraser) + (cost_sharpener * num_sharpener) result = total_cost return result
Student: A car's speed increases by 20% for every 10 km it travels. If the car's initial speed is 60 km/h, what is its speed in km/h after it travels 30 km?
def solve() -> int: initial_speed = 60 increase_in_speed = 20 distance_travelled = 30 num_of_increases = distance_travelled // 10 total_increase = num_of_increases * increase_in_speed final_speed = initial_speed + total_increase result = final_speed return result
Alexis bought a box of chocolates that had 24 pieces in it. Her brother Caleb ate 3 pieces at three different points in time, and then Alexis decided to make chocolate milk with the remaining pieces. If she needs 6 pieces of chocolate to make 1 cup of chocolate milk, how many cups of chocolate milk will she be able to ...
def solve() -> int: box_of_chocolates = 24 caleb_ate = 3 * 3 remaining_chocolates = box_of_chocolates - caleb_ate cups_of_chocolate_milk = remaining_chocolates // 6 result = cups_of_chocolate_milk return result
Maggie placed a suitcase on a scale and filled it with enough clothes to weigh 30 pounds. Then she added enough shoes to triple the weight, followed by another 15 pounds of clothes. Finally, she added enough jewelry to double the weight. What was the final weight of the suitcase and items, in pounds?
def solve() -> int: clothes_weight = 30 shoes_weight = clothes_weight * 3 total_weight = clothes_weight + shoes_weight total_weight += 15 jewelry_weight = total_weight * 2 final_weight = total_weight + jewelry_weight result = final_weight return result
Mr. and Mrs. Smith collect coins as a hobby. Mr. Smith collects quarters and earns $5 per quarter. Mrs. Smith collects dimes and earns $2 per dime. They both collected the same number of coins and earned $140 in total. How many quarters did Mr. Smith collect?
def solve() -> int: quarters = 0 dimes = 0 total_earned = 140 while True: total_earned -= 5 quarters += 1 if total_earned % 2 == 0: dimes = total_earned // 2 break result = quarters return result
Mia wants to buy a new bike that costs $250. She saves $5 a week from her allowance and earns an additional $15 a week from walking her neighbor's dog. How many weeks will it take her to save up enough money?
def solve() -> int: bike_cost = 250 weekly_savings = 5 weekly_earnings = 15 total_savings = 0 weeks = 0 while total_savings < bike_cost: total_savings += weekly_savings + weekly_earnings weeks += 1 result = weeks return result
At a café, the price of a latte is $4.50 and a croissant is $2.75. A customer bought 2 lattes and 3 croissants, and was charged for 4 drinks. What was the total revenue of the transaction?
def solve() -> int: latte_price = 4.5 croissant_price = 2.75 num_lattes = 2 num_croissants = 3 num_drinks_charged = 4 total_revenue = (latte_price * num_lattes) + (croissant_price * num_croissants) result = total_revenue / (num_lattes + num_croissants) * num_drinks_charged return result
Julie is planning a picnic for 12 people. She wants to make sure everyone, herself included, gets at least 2 hot dogs. Each hot dog measures 6 inches. How many inches of hot dogs should Julie buy for the picnic?
def solve() -> int: people = 12 hot_dogs_per_person = 2 hot_dog_length = 6 total_hot_dogs = people * hot_dogs_per_person total_hot_dog_length = total_hot_dogs * hot_dog_length result = total_hot_dog_length return result
If a football team plays 10 games in a season and wins 7 of them, what percentage of games did they win?
def solve() -> int: num_games = 10 num_wins = 7 win_percentage = (num_wins / num_games) * 100 result = win_percentage return result
A family of 5 wants to go to a theme park. The price of admission is $35 per person. What is the total cost for the family?
def solve() -> int: price_per_person = 35 num_people = 5 total_cost = price_per_person * num_people result = total_cost return result
Isabel baked 3 cakes, and each cake had 12 slices. She ate 2 slices and gave 1 cake to her friend. How many slices of cake does she have left?
def solve() -> int: cakes_baked = 3 slices_per_cake = 12 slices_eaten = 2 cakes_given_away = 1 total_slices = cakes_baked * slices_per_cake remaining_slices = total_slices - slices_eaten - (slices_per_cake * cakes_given_away) result = remaining_slices return result
``` John and Cindy decided to split a pizza between them. If the pizza has 8 slices and John eats 4 slices, what percent of the pizza did John eat?
def solve() -> int: total_slices = 8 john_slices = 4 percent_john_slices = (john_slices / total_slices) * 100 result = percent_john_slices return result
Jackson wants to buy a new gaming laptop that costs $1200. He has $800 saved up, and plans to put $100 into savings each month until he has saved enough to buy the laptop. How long will it take him to save enough money to buy the laptop?
def solve() -> int: savings_per_month = 100 money_needed = 1200 - 800 months_to_save = money_needed / savings_per_month result = months_to_save return result
25 percent of them play the piano, 15 percent play the guitar, and the rest play the violin. How many students play the violin?
def solve() -> int: piano = 0.25 guitar = 0.15 total = 120 piano_students = piano * total guitar_students = guitar * total violin_students = total - piano_students - guitar_students result = violin_students return result
arah has 12 apples. She eats 3 and gives 2 to her friend. How many apples does Sarah have left?
def solve() -> int: num_of_apples = 12 apples_eaten = 3 apples_given = 2 remaining_apples = num_of_apples - apples_eaten - apples_given result = remaining_apples return result
Student: Mark and Jenny purchased a house at the price of $725,000. They chose to finance the purchase with a 30-year fixed rate loan with an interest rate of 3.5%. How much will their monthly payments be?
def solve() -> int: price = 725000 loan_term = 30 interest_rate = 0.035 monthly_payment = (price * interest_rate) / (1 - (1 + interest_rate)**(-loan_term * 12)) result = monthly_payment return result
Hannah has a budget of $150 to buy gifts for her friends. She wants to buy 6 books, 4 scarves and 2 candles. Each book costs $12, each scarf costs $8 and each candle costs $10. How much money will she have left after buying the gifts? How can she find out using Python?
def solve() -> int: budget = 150 book_price = 12 scarf_price = 8 candle_price = 10 books = 6 scarves = 4 candles = 2 book_cost = book_price * books scarf_cost = scarf_price * scarves candle_cost = candle_price * candles total_cost = book_cost + scarf_cost + candle_c...
A car traveled a distance of 400 km in 5 hours. If the speed of the car was increased by 20 km/hr, it would have covered the same distance in 4 hours. Find the speed of the car.
def solve() -> int: distance = 400 time1 = 5 time2 = 4 speed1 = distance / time1 speed2 = distance / time2 speed_diff = speed2 - speed1 speed = (distance / ((time1 + time2) / 2)) result = speed return result
Sophie mows lawns and earns $30 for each lawn. This week she has to mow 7 lawns. She also receives an average of $5 as a tip for each lawn she mows. If Sophie pays 10% of her total income in taxes, how much tax does she have to pay this week?
def solve() -> int: lawns_mowed = 7 earnings_per_lawn = 30 tip_per_lawn = 5 total_earnings = lawns_mowed * earnings_per_lawn total_tips = lawns_mowed * tip_per_lawn total_income = total_earnings + total_tips tax_percentage = 10 tax_amount = (tax_percentage / 100) * total_income ...
``` A rocket is launched vertically from the surface of the earth. Its velocity increases at a constant rate of 20 m/s² until the rocket's fuel is exhausted. After the fuel has been exhausted, the rocket is in free fall. How high will the rocket go, neglecting air resistance?
def solve() -> int: a = 20 v0 = 0 s0 = 0 tf = -v0/a s1 = s0 + v0*tf + 1/2 * a * tf**2 result = s1 return result
May has a jar of red, blue, and green jelly beans. She knows that there are 45 jelly beans in total, and 20% of them are red. How many red jelly beans are in the jar? How many jelly beans are not red?
def solve() -> int: red_jelly_beans = 45 * 0.2 not_red_jelly_beans = 45 - red_jelly_beans result = (red_jelly_beans, not_red_jelly_beans) return result
Alex adds 1 tablespoon of sugar per cup of hot chocolate in the evening. He usually has 3 cups of hot chocolate before bed. He buys his sugar in a 20-ounce container. If there are 7 servings of sugar per ounce, how many nights will he be able to enjoy sugar in his hot chocolate before bed?
def solve() -> int: sugar_per_cup = 1 cups_per_night = 3 container_size = 20 servings_per_ounce = 7 total_sugar_per_night = sugar_per_cup * cups_per_night total_servings = container_size * servings_per_ounce nights = total_servings // total_sugar_per_night result = ni...
A company is planning to produce 3000 laptops. Each laptop requires 2GB of RAM. The company has 3GB RAM per hour. How many hours will it take to produce 3000 laptops?
def solve() -> int: ram_req = 3000*2 hours = ram_req / 3 result = hours return result
A basketball team scored a total of 120 points in a match. If player A scored 40% of the points, how many points did player A score?
def solve() -> int: total_points = 120 percentage_A = 40 points_scored_by_A = (percentage_A/100)*total_points result = points_scored_by_A return result
A farmer has 500 chickens and 200 ducks. He sells 20% of his chickens and 15% of his ducks at the market. He then buys 50 more chickens and 30 more ducks with the money he earned. What is the total number of poultry he has after the transactions?
def solve() -> int: chickens_sold = 0.2 * 500 ducks_sold = 0.15 * 200 chickens_left = 500 - chickens_sold ducks_left = 200 - ducks_sold chickens_bought = 50 ducks_bought = 30 poultry = chickens_left + ducks_left + chickens_bought + ducks_bought result = poultry return result
A bag contains 12 red marbles and 8 blue marbles. If two marbles are drawn blindly from the bag at the same time, what is the probability that both of them are red?
def solve() -> int: num_red_marbles = 12 num_blue_marbles = 8 total_marbles = num_red_marbles + num_blue_marbles prob_first_red = num_red_marbles / total_marbles prob_second_red = (num_red_marbles - 1) / (total_marbles - 1) prob_both_red = prob_first_red * prob_second_red result = prob_both_...
Rachel pays $25 per month for unlimited texting and calling. Another plan charges $0.25 per text and $5 for 60 minutes of calls. Rachel sends 120 text messages and spends 120 minutes on the phone each month. How much money would she save by switching to the alternative plan?
def solve() -> int: current_plan_cost = 25 alternative_plan_cost = 0.25 * 120 + 5 * 2 savings = current_plan_cost - alternative_plan_cost result = savings return result
Isla is 9 years old. Her uncle is 36 years older than her and her aunt is 4 years younger than her uncle. How old will the aunt be in 5 years?
def solve() -> int: isla = 9 uncle = isla + 36 aunt = uncle - 4 aunt_in_5_years = aunt + 5 result = aunt_in_5_years return result
Robert has 3 exams that last 2.5 hours each. He spends the rest of his 8-hour day grading papers. If he can grade 70 papers per hour, how many papers total does he grade today?
def solve() -> int: exam_duration = 2.5 exam_count = 3 total_duration = 8 duration_spent = exam_duration * exam_count duration_left = total_duration - duration_spent papers_per_hour = 70 papers_total = duration_left * papers_per_hour result = papers_total return result
Mary has to knit scarfs for each of the 20 members in her knitting club. The club has six times as many elderly members as young members. There are also some middle-aged members. If there are 2 young members, how many middle-aged members are there in Mary's club?
def solve() -> int: young_members = 2 elderly_members = 6 * young_members total_members = 20 middle_aged_members = total_members - young_members - elderly_members result = middle_aged_members return result
A rectangular field is 45m long and 32m wide. If each square meter is planted with 11 grass seeds, how many seeds are needed to fill the entire field?
def solve() -> int: field_area = 45 * 32 seeds_per_sqm = 11 total_seeds = field_area * seeds_per_sqm result = total_seeds return result
Liam has 10 cookies and 2 cupcakes. Liam has triple the number of donuts as Sophia. Liam has 9 less than half the number of muffins as Sophia. If Sophia has 3 donuts and 20 muffins, how many desserts does Liam have in total?
def solve() -> int: liam_cookies = 10 liam_cupcakes = 2 sophia_donuts = 3 sophia_muffins = 20 liam_donuts = 3 * sophia_donuts liam_muffins = (1/2) * sophia_muffins - 9 total_desserts = liam_cookies + liam_cupcakes + liam_donuts + liam_muffins result = total_desserts re...
``` A store sells a product for $12.50 and makes a profit of 25% on each sale. How much profit does the store make on 30 sales?
def solve() -> int: price = 12.5 profit_percentage = 25 number_of_sales = 30 profit_per_sale = price * profit_percentage / 100 total_profit = profit_per_sale * number_of_sales result = total_profit return result
A customer orders a customized necklace. It takes the jeweler 2 days to craft and 1 day to process the order. It then takes 3 days to ship the necklace. If the customer wants the necklace 7 days from today, when should they place the order?
def solve() -> int: days_to_craft = 2 days_to_process = 1 days_to_ship = 3 total_days = 7 order_placement_day = total_days - (days_to_craft + days_to_process + days_to_ship) result = order_placement_day return result
The area of a square is 25 square meters. What is the perimeter of the square?
def solve() -> int: area = 25 side_length = area ** 0.5 perimeter = 4 * side_length result = perimeter return result
Owen has 12 oranges. He needs 4 more oranges to have 4 times as many as Ava, who has 2 oranges less than Eric. How many more oranges does Owen have than Eric?
def solve() -> int: owen_oranges = 12 ava_oranges = (owen_oranges - 4) / 4 eric_oranges = ava_oranges + 2 owen_eric_diff = owen_oranges - eric_oranges result = owen_eric_diff return result
A carpenter needs to lay tiles on the floor of a room, which is 12 ft wide and 15 ft long. The tiles she chooses are 1 ft by 1 ft, and she needs to leave 0.25 in of space between the tiles (on each side). How many tiles does she need to buy?
def solve() -> int: width = 12 length = 15 tile_width = 1 tile_length = 1 grout_width = 0.25 tiles_per_row = (width - 2 * grout_width) // tile_width tiles_per_column = (length - 2 * grout_width) // tile_length total_tiles = tiles_per_row * tiles_per_column result = total_tiles re...
Tom has 20 toy robots, and he wants to divide them equally into 4 gift bags. How many toy robots will each gift bag have?
def solve() -> int: total_toy_robots = 20 num_gift_bags = 4 toy_robots_per_gift_bag = total_toy_robots / num_gift_bags result = toy_robots_per_gift_bag return result
Grace owns a zoo. She has 40 animals and each animal requires 2 liters of water for drinking and 1 kilogram of food per day. If she added 25 more animals, how many liters of water and kilograms of food does Grace need for all the animals for 28 days?
def solve() -> int: animals = 40 water_per_animal = 2 food_per_animal = 1 total_water = animals * water_per_animal total_food = animals * food_per_animal new_animals = 25 total_animals = animals + new_animals total_water *= 28 total_water += new_animals * water_per_ani...
A car rental company charges $25 per day plus $0.15 per mile for renting a car. If a customer rents a car for 4 days and drives 200 miles, how much does he have to pay in total?
def solve() -> int: daily_charge = 4 * 25 mileage_charge = 200 * 0.15 total_charge = daily_charge + mileage_charge result = total_charge return result
Timo wants to buy a box of chocolates for his girlfriend. The box costs $15, but Timo only has a $20 bill. He decides to buy the box and give the cashier a $20 bill. How much change will he receive?
def solve() -> int: price = 15 cash = 20 change = cash - price result = change return result
In three years, Max will be four times as old as Lily. If Max is currently one-fifth of his grandmother's age, who is 70, how old is Lily now?
def solve() -> int: max_grandmother_age = 70 max_current_age = max_grandmother_age / 5 lily_current_age = (max_current_age * 4) - 3 result = lily_current_age return result
Liam, Noah and Ethan were gathering pebbles from the river. Liam found 8 black pebbles and 10 white pebbles, while Noah found 15 white and 9 grey pebbles. If Ethan found four times as many white pebbles as Liam and Noah combined and twice as many grey pebbles as Noah, how many pebbles did Ethan gather in total?
def solve() -> int: liam_black = 8 liam_white = 10 noah_white = 15 noah_grey = 9 ethan_white = (liam_white + noah_white) * 4 ethan_grey = noah_grey * 2 ethan_total = ethan_white + ethan_grey result = ethan_total return result
Layla has a book with 200 pages. She reads 10 pages every day for the first 5 days. Then she reads 15 pages every day for the next 5 days. Then she reads 20 pages every day until she finishes the book. How many days does it take her to finish the book?
def solve() -> int: book = 200 read = 0 day = 0 while read < book: day = day + 1 if day <= 5: read = read + 10 elif day <= 10: read = read + 15 else: read = read + 20 result = day return result
A room is 8 meters wide and 10 meters long. If you want to fully cover the floor with square tiles that are 1 meter wide, how many tiles will you need?
def solve() -> int: width = 8 length = 10 tile_width = 1 area = width * length tiles_needed = area // tile_width if area % tile_width!= 0: tiles_needed += 1 result = tiles_needed return result
A jar of honey and a loaf of bread together cost $7. The jar of honey costs twice as much as the loaf of bread. Calculate the price of the jar of honey.
def solve() -> int: total = 7 ratio = 2 honey = total * ratio / (ratio + 1) result = honey return result
Sarah made a vegetable soup that serves 12 people. She used 3 carrots, 2 potatoes, and 1 onion, and mixed in some other vegetables. How many cups of vegetables did she use in total?
def solve() -> int: carrots = 3 potatoes = 2 onion = 1 total_veggies = carrots + potatoes + onion cups_per_person = total_veggies / 12 result = cups_per_person * 12 return result
Student: Alex and four friends are to deliver 420 pieces of certified mail. His friends each delivered 48 pieces of mail. How many pieces of mail does Alex need to deliver?
def solve() -> int: total_mail = 420 friend_mail = 48 num_friends = 4 total_friend_mail = friend_mail * num_friends alex_mail = total_mail - total_friend_mail result = alex_mail return result
A purse weighs 2 pounds less than a backpack, and the purse weighs half as much as a suitcase. If the backpack weighs 8 pounds, how many pounds do the suitcase and purse weigh together?
def solve() -> int: backpack_weight = 8 purse_weight = backpack_weight - 2 suitcase_weight = purse_weight * 2 total_weight = purse_weight + suitcase_weight result = total_weight return result
Student: If a car is traveling at 60 km/h, how far can it travel in 2 hours?
def solve() -> int: speed = 60 time = 2 distance = speed * time result = distance return result
A toaster costs $24 more than a kettle. If a kettle costs $12, find the total cost of both items.
def solve() -> int: kettle_cost = 12 toaster_cost = kettle_cost + 24 total_cost = kettle_cost + toaster_cost result = total_cost return result
A construction worker has a certain number of bricks. He wants to build a wall 60 meters long. Each meter requires 10 bricks. However, 2 bricks are damaged and another brick is given away. How many meters of wall can he construct?
def solve() -> int: bricks = 1000 meters_of_wall = bricks // 10 damaged_bricks = 2 given_away_bricks = 1 usable_bricks = bricks - damaged_bricks - given_away_bricks meters_of_wall = usable_bricks // 10 result = meters_of_wall return result
There are two runners starting at different points of a circular track that is 2 miles long. The first runner runs at 5 MPH and the second runner runs at 7 MPH. If they both start at the same time and run in the same direction, how long will it take for the faster runner to catch up to the slower runner?
def solve() -> int: track_length = 2 speed_runner_1 = 5 speed_runner_2 = 7 relative_speed = speed_runner_2 - speed_runner_1 time = track_length / relative_speed result = time return result
There are 60 students in a classroom. If 40% of them are boys, how many girls are in the classroom?
def solve() -> int: boys = 60 * (40/100) girls = 60 - boys result = girls return result
If a baseball bat costs $25 and a baseball glove costs half as much as the bat, what is the total cost of buying both items?
def solve() -> int: bat_cost = 25 glove_cost = bat_cost / 2 total_cost = bat_cost + glove_cost result = total_cost return result
Jack wants to buy donuts for himself and his 11 classmates. Each donut costs $1.25 and can feed 1 person. If Jack earns $7 a day cleaning his neighbor's yard, how many days will he have to clean the yard to afford the donuts?
def solve() -> int: donut_cost = 1.25 num_people = 11 jack_earnings = 7 total_cost = donut_cost * (num_people + 1) num_days = total_cost / jack_earnings result = num_days return result
An apple pie recipe calls for 6 cups of sliced apples. If 1 apple yields 1 cup of sliced apples, how many apples are needed to make the pie?
def solve() -> int: cups_needed = 6 apples_needed = cups_needed result = apples_needed return result
Maria gets paid $20 per hour for babysitting. If she worked for 8 hours on Saturday and 6 hours on Sunday, how much money did she earn over the weekend?
def solve() -> int: hours_saturday = 8 hours_sunday = 6 hourly_rate = 20 earnings_saturday = hours_saturday * hourly_rate earnings_sunday = hours_sunday * hourly_rate total_earnings = earnings_saturday + earnings_sunday result = total_earnings return result
Daniel wants to paint his bedroom and needs to purchase paint and supplies. He knows that including paint and supplies the room needs 40 square meters of coverage. If a can of paint covers 15 square meters, how many cans of paint does Daniel need to buy?
def solve() -> int: paint_require = 40 paint_cover = 15 num_cans = paint_require / paint_cover result = num_cans return result
James has $36 to buy some toys. He buys a car for $8, a robot for $12, and a puzzle for $4. He also gets a gift card for $5 for every $10 he spends. How many gift cards does James get and how much money does he have left?
def solve() -> int: car = 8 robot = 12 puzzle = 4 total = car + robot + puzzle card = total // 10 value = card * 5 left = 36 - total result = (card, left) return result
Rachel wants to knit a scarf. She has a ball of yarn that contains 200 feet of yarn. That week, Rachel knits for 30 minutes each day except for two days when she has to work late. How many feet of yarn did Rachel knit in 7 days?
def solve() -> int: ball_of_yarn = 200 knitting_time_per_day = 30 working_late_days = 2 total_days = 7 knitting_days = total_days - working_late_days total_knitting_time = knitting_days * knitting_time_per_day feet_of_yarn_knitted = total_knitting_time * ball_of_yarn result = f...
Student: The ratio of cats to dogs in a park is 1 to 3. If there are 12 cats, how many dogs are there?
def solve() -> int: cats = 12 ratio = 1/3 dogs = cats * ratio result = int(dogs) return result
Billy has 16 toy cars. He gives away 5 and buys 3 more. How many toy cars does he have now?
def solve() -> int: num_toy_cars = 16 num_toy_cars_given_away = 5 num_toy_cars_bought = 3 num_toy_cars_now = num_toy_cars - num_toy_cars_given_away + num_toy_cars_bought result = num_toy_cars_now return result
A car dealer has a total of 120 cars where 20% are black cars, 30% are white, and the remaining are red. How many red cars are for sale?
def solve() -> int: total_cars = 120 black_cars = total_cars * 0.2 white_cars = total_cars * 0.3 red_cars = total_cars - black_cars - white_cars result = red_cars return result
Joe and his friend divided 300 cookies among them. Joe took 4/5 of the cookies and his friend 3/10. How many cookies did each one get on average?
def solve() -> int: cookiesJ = 300 * 4/5 cookiesF = 300 * 3/10 average = (cookiesJ + cookiesF) / 2 result = average return result
A class has 50 students, 45% of which are girls. How many students in the class are boys?
def solve() -> int: _total_students = 50 _girls = 0.45 * _total_students _boys = _total_students - _girls result = _boys return result
The moon's diameter is 1/4 that of Earth. The surface area of the Earth is 500 square acres. The land on the moon is worth 8 times that of the land on the Earth. If the total value of all the land on the Earth is 100 billion dollars, what is the total value in billions of all the land on the moon?
def solve() -> int: earth_diameter = 1 moon_diameter = 1/4 earth_surface_area = 500 moon_surface_area = earth_surface_area * (moon_diameter ** 2) earth_total_land_value = 100 moon_land_price_ratio = 8 moon_total_land_value = earth_total_land_value * moon_land_price_ratio * (moon_surface_are...
A gym has 12 trainers. Each trainer trains 4 clients in a day. As a team, they train one additional client every 3 hours. How many clients have they trained in 3 hours?
def solve() -> int: trainers = 12 clients_per_trainer = 4 clients_per_team_per_hour = 1/3 clients_per_hour = trainers * clients_per_trainer + trainers * clients_per_team_per_hour clients_in_3_hours = clients_per_hour * 3 result = clients_in_3_hours return result
If a pizza has 8 slices and John eats 3 slices, what fraction of the pizza is left?
def solve() -> int: total_slices = 8 eaten_slices = 3 remaining_slices = total_slices - eaten_slices fraction_left = remaining_slices / total_slices result = fraction_left return result
>>>> Possible new questions and programs are: Ben has 15 red stickers. He has 5 more yellow stickers than red stickers. Ben has twice as many blue stickers as yellow stickers. How many stickers does Ben have in total?
def solve() -> int: red = 15 yellow = red + 5 blue = 2 * yellow total = red + yellow + blue result = total return result
Student: Brian runs 7 miles on Monday, 9 miles on Tuesday, and 5 miles on Wednesday. How many miles did Brian run in total this week?
def solve() -> int: monday_run = 7 tuesday_run = 9 wednesday_run = 5 total_run = monday_run + tuesday_run + wednesday_run result = total_run return result
Mary has to work 9 hours every day for 5 days. How many hours will she work in total?
def solve() -> int: daily_hours = 9 number_of_days = 5 total_hours = daily_hours*number_of_days result = total_hours return result
If 2x + 5 = 3 and x - 1 = 9, what is the value of x?
def solve() -> int: x1 = (3 - 5) / 2 x2 = 9 + 1 result = x1 if x1 == x2 else None return result
David wants to bring homemade cookies for his team at work. He plans to make snickerdoodles and oatmeal chocolate chip cookies. Each recipe makes exactly 6 dozen cookies. David made 5 batches of snickerdoodles and 2 batches of oatmeal chocolate chip cookies. If he wants to give each team member 4 cookies, how many more...
def solve() -> int: snickerdoodles_per_batch = 6 * 12 oatmeal_per_batch = 6 * 12 total_snickerdoodles = snickerdoodles_per_batch * 5 total_oatmeal = oatmeal_per_batch * 2 total_cookies = total_snickerdoodles + total_oatmeal cookies_per_person = 4 team_members = 20 cookies_needed = cookie...
Student: There are 1,700 students in a school, 45% of which are senior students. How many are not senior students?
def solve() -> int: senior_students = 1700 * 0.45 non_senior_students = 1700 - senior_students result = non_senior_students return result
If Lisa buys 1 candy on day 1, followed by 2 candies on day 2, and 4 candies on day 3, what is the total number of candies she will have bought by the end of day 8?
def solve() -> int: day1 = 1 day2 = 2 day3 = 4 total_candies = day1 + day2 + day3 day4 = day3 * 2 day5 = day4 * 2 day6 = day5 * 2 day7 = day6 * 2 day8 = day7 * 2 total_candies += day4 + day5 + day6 + day7 + day8 result = total_candies return result
A pizza can be cut into 8 slices. If 2 people have each eaten 2 slices, how many slices are left?
def solve() -> int: total_slices = 8 slices_eaten = 2*2 slices_remaining = total_slices - slices_eaten result = slices_remaining return result
Student: A store is having a sale where all items are 25% off. A shirt is originally priced at $40. What is the sale price?
def solve() -> int: original_price = 40 discount_rate = 0.25 sale_price = original_price * (1 - discount_rate) result = sale_price return result
Student: A recipe calls for 2 1/2 cups of flour, but you only have 1 3/4 cups. How much more flour do you need?
def solve() -> int: flour_needed = 2.5 flour_available = 1.75 difference = flour_needed - flour_available result = difference return result
Lily, Grace, and Mia are swimming. Lily swam 50 meters, Grace swam 30 meters, and Mia swam twice the total distance swum by Lily and Grace. If their opponents' team swam a total of 200 meters, how many meters are they behind?
def solve() -> int: lily_distance = 50 grace_distance = 30 mia_distance = (lily_distance + grace_distance) * 2 opponents_distance = 200 total_distance_swum = lily_distance + grace_distance + mia_distance distance_behind = total_distance_swum - opponents_distance result = distance_b...
Cody practices guitar for 4 hours every day. He spends half the time practicing chords and the rest of the time practicing songs. If he spends one quarter of his song practice time strumming, how much time in minutes does he spend strumming?
def solve() -> int: hours_per_day = 4 chord_practice_time = hours_per_day / 2 song_practice_time = hours_per_day / 2 strumming_time = song_practice_time / 4 strumming_time_minutes = strumming_time * 60 result = strumming_time_minutes return result
Bob bought a bike for $100. He fixed it and sold it for 25% more than he bought it. He then bought another bike for 10% less than he sold the first one. How much did he pay for the second bike?
def solve() -> int: selling_price = 1.25 * 100 buying_price = 0.9 * selling_price result = buying_price return result