question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Dora bought four bags of chips at $1.25 each, two boxes of cookies at $3 each, and one jar of peanut butter. She gave the cashier $15 and got $1.50 in change. How much does a jar of peanut butter cost?
def solve() -> int: chips_cost = 4 * 1.25 cookies_cost = 2 * 3 total_cost = chips_cost + cookies_cost paid = 15 change = 1.50 peanut_butter_cost = paid - change - total_cost result = peanut_butter_cost return result
Student: A pizza restaurant charges $10 for a medium pizza and $15 for a large. If a group of 5 people want to order 3 medium pizzas and 2 large pizzas, how much will they need to pay?
def solve() -> int: medium_pizza_cost = 10 large_pizza_cost = 15 num_medium_pizzas = 3 num_large_pizzas = 2 total_cost = (medium_pizza_cost * num_medium_pizzas) + (large_pizza_cost * num_large_pizzas) cost_per_person = total_cost / 5 result = cost_per_person * 5 return result
Student: A rectangle has a length of 8cm and a width of 5cm. What is the perimeter of the rectangle?
def solve() -> int: length = 8 width = 5 perimeter = 2 * (length + width) result = perimeter return result
Note: the '|endofquestion|' and '|endofprogram|' are meant for grading purposes and should be the tail and head of each new question. Do not move them elsewhere. Possible questions and programs: A small zoo has 3 elephants and 4 times as many monkeys. The number of penguins is 5 less than the monkeys and 10 times more ...
def solve() -> int: elephants = 3 monkeys = 4 * elephants penguins = monkeys - 5 lions = penguins // 10 total = elephants + monkeys + penguins + lions result = total return result
A pizza can be cut into 8 equal slices. If one slice costs $1.75, how much will Alex pay for 2 pizzas and one extra slice?
def solve() -> int: pizza_cost = 8 * 1.75 total_cost = 2 * pizza_cost + 1.75 result = total_cost return result
Aiden and Lily are making sandwiches. Aiden can make 12 sandwiches in an hour and Lily can make 15 sandwiches in an hour. If they make sandwiches for 90 minutes straight together, how many sandwiches will they make in total?
def solve() -> int: aiden_sandwiches_per_hour = 12 lily_sandwiches_per_hour = 15 total_sandwiches_per_hour = aiden_sandwiches_per_hour + lily_sandwiches_per_hour total_sandwiches_per_minute = total_sandwiches_per_hour / 60 total_sandwiches_in_90_minutes = total_sandwiches_per_minute * 90 ...
A clothing store sells 300 shirts per month and wants to increase its yearly sales to 10,000 shirts. How many shirts does the store need to sell per month to reach that goal?
def solve() -> int: current_sales = 300 target_sales = 10000 months_in_year = 12 total_sales_needed = target_sales - current_sales sales_per_month = total_sales_needed / months_in_year result = sales_per_month return result
Jack and Lily share a bag of 60 candies. Jack has three times as many gummy candies as Lily, and they both have the same number of lollipops. If Lily has 4 lollipops, how many gummy candies does Jack have?
def solve() -> int: lollipops = 4 total_candies = 60 gummy_candies = (total_candies - (lollipops * 2)) / 4 result = gummy_candies return result
Student: A credit card company charges 16% annual interest rate on unpaid balances. If a customer has an unpaid balance $1,000, how much interest will they owe in one month?
def solve() -> int: interest_rate = 16 / 12 / 100 unpaid_balance = 1000 interest = unpaid_balance * interest_rate total_owed = unpaid_balance + interest result = round(interest, 2) return result
In a pet store, there are 24 rabbits, 10 cats, and 16 birds. If all of the animals need to be fed, and each rabbit needs 2 cups of food, each cat needs 3 cups, and each bird needs 1 cup, how many cups of food are needed in total?
def solve() -> int: rabbits = 24 cats = 10 birds = 16 total_food = (rabbits * 2) + (cats * 3) + (birds * 1) result = total_food return result
If Tom intends to buy 8 pairs of shoes at $120.00 each with a 25% discount and 3 belts at $50.00 each with a 20% discount, what will be the final amount of money he has to spend after getting the discount?
def solve() -> int: shoe_price = 120.00 shoe_discount = 0.25 shoe_quantity = 8 belt_price = 50.00 belt_discount = 0.20 belt_quantity = 3 shoe_total = shoe_price * shoe_quantity shoe_discounted = shoe_total * (1 - shoe_discount) belt_total = belt_price * belt_quantity ...
A factory produces 1000 pencils per hour. How many pencils can they produce in a 6-hour workday?
def solve() -> int: pencils_per_hour = 1000 work_hours_per_day = 6 pencils_per_day = pencils_per_hour * work_hours_per_day result = pencils_per_day return result
arah is walking her dog. She walks for 30 minutes at a speed of 3.5 miles per hour. How many miles does she walk?
def solve() -> int: walking_time = 30/60 walking_speed = 3.5 total_distance = walking_time * walking_speed result = round(total_distance, 2) return result
Student: The spaceship Hubble is set on an expedition to explore a nearby star system, 6,000 parsecs away from Earth. If the maximum speed of the Hubble is 28 parsecs per hour, how many hours will its journey take?
def solve() -> int: distance = 6000 speed = 28 time = distance / speed result = time return result
Emily runs 2 miles every day. She runs around a rectangular field that is 0.25 miles wide and 0.50 miles long. How many times does she run around the field in a week?
def solve() -> int: distance_in_one_lap = 0.25 + 0.5 + 0.25 + 0.5 distance_in_week = 2 * 7 laps_in_week = distance_in_week / distance_in_one_lap result = laps_in_week return result
Linda is saving up for a down payment on a house. She needs to save up $50,000 for the down payment. Her monthly income is $5000, and she has to pay $2000 for rent and other expenses each month. If she saves half of her income each month, how many months will it take her to save up enough for the down payment?
def solve() -> int: monthly_income = 5000 monthly_expenses = 2000 down_payment = 50000 savings_per_month = (monthly_income - monthly_expenses) / 2 months_to_save = down_payment / savings_per_month result = months_to_save return result
A train travels 300 kilometers in 4 hours. How long would it take the train to travel 480 kilometers at the same speed?
def solve() -> int: speed = 300/4 time = 480/speed result = time return result
A solid cylindrical pillar has a height of 10 meters and a radius of 2 meters. What is the volume of the pillar?
def solve() -> int: height = 10 radius = 2 volume = 3.14 * radius**2 * height result = volume return result
Student: A classroom has 24 students. If the teacher wants to have groups of 4 students, how many groups will there be?
def solve() -> int: students = 24 group_size = 4 groups = students // group_size result = groups return result
Mason is 10 years older than Harper. When Harper turns 30, how old will Mason be?
def solve() -> int: harper_age = 30 mason_age = harper_age + 10 result = mason_age return result
If Jake sleeps for 8 hours from Monday to Thursday and 11 hours on Friday, Saturday, and Sunday, how much sleep will he get in 5 weeks? Samantha decides to participate in a swimming competition. She needs to pay $15 as her entry fee. Her goal is to swim as many laps as possible in 3 minutes. She will earn 3 cents for e...
def solve() -> int: weekday_sleep = 8 * 4 weekend_sleep = 11 * 3 total_sleep = (weekday_sleep + weekend_sleep) * 5 entry_fee = 15 laps_after_100 = 0.03 loss = 6 goal_laps = (loss + entry_fee) / laps_after_100 + 100 result = total_sleep, goal_laps return result
A supermarket has 12 checkout lanes. Each lane can serve an average of 30 customers per hour. If the supermarket is open for 16 hours a day, how many customers can the supermarket serve in a day?
def solve() -> int: checkout_lanes = 12 customers_per_hour = 30 hours_per_day = 16 customers_per_day = checkout_lanes * customers_per_hour * hours_per_day result = customers_per_day return result
If it takes 8 minutes to solve one Sudoku puzzle, how many puzzles can be solved in 1 hour and 20 minutes? Samantha returned from her trip to Asia with 120 yen. Normally 2 yen is worth 1 cent, but due to a promotional offer, Samantha can only exchange her yen for 3/5ths of the official exchange rate. How many cents wil...
def solve() -> int: sudoku_time = 8 total_time = 80 num_puzzles = (total_time // sudoku_time) yen = 120 exchange_rate = 2 / 1 promotional_rate = 3 / 5 cents = (yen / exchange_rate) * promotional_rate result = num_puzzles return result
If nine more dollars are added to the twenty-one in the wallet, the amount of money in the wallet will be 1/10 the amount of money in the bank account. How much money is in the bank account?
def solve() -> int: wallet = 21 added = 9 new_wallet = wallet + added bank_account = new_wallet * 10 result = bank_account return result
John drove for 8 hours and a total of 530 miles. If he averaged a speed of 60 miles per hour, how long did it take him to drive the first 200 miles?
def solve() -> int: distance_total = 530 distance_first = 200 speed = 60 time_first = distance_first / speed result = time_first return result
Sophia lives in a city with a grid system. She walks 2 blocks south, then nine times as many blocks west. She then turns around and walks 4 blocks north and twice as many blocks east in the direction of her home. If Sophia can walk 3 blocks/minute, how long will it take her to get home?
def solve() -> int: south_blocks = 2 west_blocks = 9 * south_blocks north_blocks = 4 east_blocks = 2 * west_blocks total_blocks = south_blocks + west_blocks + north_blocks + east_blocks time_taken = total_blocks / 3 result = time_taken return result
Student: Alex has $35. If he spends $12, how much money does he have left?
def solve() -> int: money = 35 spent = 12 left = money - spent result = left return result
Joe wants to learn a second language. He decides to try two different methods: one is a cheap online course that costs $20 per month, and the other is an expensive tutor that costs 5 times more than the online course with a sign-up fee of $75. What is the total cost of his language learning for the first year?
def solve() -> int: online_course_cost_per_month = 20 expensive_tutor_sign_up_fee = 75 expensive_tutor_cost_per_month = online_course_cost_per_month * 5 total_cost = (online_course_cost_per_month * 12) + (expensive_tutor_sign_up_fee + (expensive_tutor_cost_per_month * 12)) result = total_c...
A company has two products. The first product has a profit margin of 30% and the second product has a profit margin of 20%. If the company makes $1000 in profit and sells twice as much of the first product as the second product, what is the total revenue of the company?
def solve() -> int: profit = 1000 product1_profit_margin = 0.3 product2_profit_margin = 0.2 product1_to_product2_ratio = 2 total_product1_profit = profit * (product1_profit_margin / (product1_profit_margin + product2_profit_margin)) total_product2_profit = profit * (product2_profit_margin ...
A carpenter is working on a project where he needs to cut a 4m long wood board into 8 equal pieces. How long will each piece be?
def solve() -> int: board_length = 4 pieces_n = 8 piece_length = board_length / pieces_n result = piece_length return result
Some possible questions are: Jordan bought 6 books for $72. How much did each book cost? How many books could he buy with $36?
def solve() -> int: cost_per_book = 72 / 6 books_with_36 = 36 / cost_per_book result = int(books_with_36) return result
In a class of 35 students, if there are 10 more girls than boys, and each girl has 2 pencils while each boy has 3 pencils, how many pencils are there in total in the class?
def solve() -> int: total_students = 35 girls = (total_students + 10) / 2 boys = total_students - girls girls_pencils = girls * 2 boys_pencils = boys * 3 total_pencils = girls_pencils + boys_pencils result = total_pencils return result
Mark runs up 4 hills. Each hill is 1000 meters high. He then climbs a flagpole that is half that height. Finally, he climbs a wall that is 500 meters taller than the flagpole. How high up did he go?
def solve() -> int: hill_height = 1000 flagpole_height = hill_height / 2 wall_height = flagpole_height + 500 total_height = (hill_height * 4) + flagpole_height + wall_height result = total_height return result
Emily has 25 dollars to spend on her lunch for the week. If she spends 5 dollars every day, how many days of the week can she buy lunch?
def solve() -> int: money_available = 25 cost_per_day = 5 days_of_the_week = money_available // cost_per_day result = days_of_the_week return result
John went on a cycling trip and rode up and down a 2-mile long hill 10 times. On each trip, he rode up 4/5 of the hill's height. Find the total distance he covered.
def solve() -> int: hill_length = 2 num_trips = 10 hill_height = hill_length * (4/5) total_distance = hill_length * num_trips result = total_distance return result
Sarah drinks 30% of a jug of water and then refills it to the top. She then drinks 20% from the jug again. What fraction of the original amount of water is left in the jug?
def solve() -> int: jug = 1 drink1 = jug * 0.3 refill = jug - drink1 drink2 = refill * 0.2 remaining = refill - drink2 result = remaining return result
Rachel has 16 cookies in her bag. She gives half to her friend and then receives 4 more cookies from her friend. She then gives away another 3 cookies. How many cookies does Rachel have left?
def solve() -> int: cookies_in_bag = 16 cookies_given_away = cookies_in_bag / 2 cookies_received = 4 cookies_given_away_again = 3 cookies_left = cookies_in_bag - cookies_given_away + cookies_received - cookies_given_away_again result = cookies_left return result
Thomas has collected 212 magazines. He is selling 85% of his magazines at an average price of $7. The rest of the magazines he is selling for $3 each. How much money is Thomas making overall from the sale?
def solve() -> int: number_of_magazines = 212 magazines_at_7 = 0.85 * number_of_magazines magazines_at_3 = number_of_magazines - magazines_at_7 cost_at_7 = magazines_at_7 * 7 cost_at_3 = magazines_at_3 * 3 result = cost_at_7 + cost_at_3 return result
A soccer team comprises 18 players, 6 of whom are adults and the others are children. The cost of an adult's ticket is $16, and a child's ticket costs half of that. The team paid $192 in total. How much did each child have to pay for their ticket?
def solve() -> int: adults = 6 total_players = 18 adult_ticket_cost = 16 child_ticket_cost = adult_ticket_cost / 2 total_cost = 192 children = total_players - adults children_ticket_cost = (total_cost - (adults * adult_ticket_cost)) / children result = children_ticket_cost ...
A museum has 5 exhibit halls. Each hall has 10 exhibits. However, one exhibit hall is closed for maintenance. How many exhibits are there in the museum?
def solve() -> int: exhibits_per_hall = 10 total_halls = 5 closed_halls = 1 open_halls = total_halls - closed_halls total_exhibits = open_halls * exhibits_per_hall result = total_exhibits return result
A carnival offers a discount to groups of at least 10 people. If each person in a group of 20 receives a $3 discount, how much money is saved in total?
def solve() -> int: num_people = 20 group_discount = 3 if num_people >= 10: total_discount = num_people * group_discount else: total_discount = 0 result = total_discount return result
A bookshelf has 20 books on it. If 30% of the books are fiction, how many books on the shelf are not fiction?
def solve() -> int: total_books = 20 fiction_ratio = 0.3 non_fiction_ratio = 1 - fiction_ratio non_fiction_books = total_books * non_fiction_ratio result = non_fiction_books return result
A company produces 100 units of a product for $500. What is the cost per unit?
def solve() -> int: cost_per_unit = 500 / 100 result = cost_per_unit return result
ophia has 15 stickers and Alex has 20 stickers. If they combine their stickers, how many stickers do they have altogether and what is the average number of stickers they have each?
def solve() -> int: sophia_stickers = 15 alex_stickers = 20 total_stickers = sophia_stickers + alex_stickers average_stickers = total_stickers / 2 result = (total_stickers, average_stickers) return result
A company's profit increased from $8000 in 2019 to $12000 in 2020. What is the percentage increase in profit?
def solve() -> int: profit_2019 = 8000 profit_2020 = 12000 percentage_increase = ((profit_2020 - profit_2019)/profit_2019)*100 result = percentage_increase return result
A sports team has 17 players. Each player needs 1 water bottle for practice. If the coach has 23 water bottles, how many more does he need to make sure each player has a water bottle?
def solve() -> int: players_on_team = 17 water_bottles = 23 needed_bottles = players_on_team - water_bottles result = needed_bottles return result
Student: On a class test, a student received 70 points out of 80. What is the student's score as a percentage?
def solve() -> int: student_points = 70 total_points = 80 score_percentage = student_points / total_points * 100 result = score_percentage return result
Student: Joseph has 30 dollars and wants to buy glue sticks and erasers. Each glue stick costs 3.00 dollars and each eraser costs 0.10. How many glue sticks can he buy with his 30 dollars if he wants 12 erasers?
def solve() -> int: joseph_money = 30 glue_price = 3 eraser_price = 0.1 eraser_number = 12 eraser_cost = eraser_price * eraser_number remaining_money = joseph_money - eraser_cost glue_number = remaining_money // glue_price result = glue_number return result
A school has 800 students and 60 teachers. What is the ratio of students to teachers?
def solve() -> int: students = 800 teachers = 60 ratio = students/teachers result = ratio return result
In a clothing store, shirts cost $15 each, shorts cost $20 each, and skirts cost $30 each. If a customer buys 2 shirts, 3 pairs of shorts, and 1 skirt, what is the total cost without any discounts?
def solve() -> int: shirt_cost = 15 * 2 shorts_cost = 20 * 3 skirt_cost = 30 * 1 total_cost = shirt_cost + shorts_cost + skirt_cost result = total_cost return result
A student scored 82, 89, and 95 on his first three math quizzes. What score does he need to get on the fourth quiz to have an average score of 90?
def solve() -> int: total_score = 82 + 89 + 95 average_score_needed = 90 score_needed_on_forth_quiz = average_score_needed * 4 - total_score result = score_needed_on_forth_quiz return result
A car travels 200 miles in 4 hours. What is the average speed of the car in miles per hour?
def solve() -> int: distance = 200 time = 4 speed = distance / time result = speed return result
A rectangular room has a length of 10 meters and a width of 8 meters. If the floor area of the room is covered by tiles measuring 1 square meter each, how many tiles are needed for the room?
def solve() -> int: room_area = 10 * 8 tiles_needed = room_area result = tiles_needed return result
My car's gas tank has a capacity of 15 gallons and currently has 4 gallons of gas. If I drive 27 miles per gallon, how far can I go without refueling?
def solve() -> int: tank_capacity = 15 current_gas = 4 miles_per_gallon = 27 distance = (tank_capacity - current_gas) * miles_per_gallon result = distance return result
If a cake recipe needs 2 cups of sugar for every 3 cups of flour, how much sugar will be needed for a recipe that uses 9 cups of flour?
def solve() -> int: flour_for_recipe = 9 sugar_to_flour_ratio = 2/3 sugar_needed = flour_for_recipe * sugar_to_flour_ratio result = sugar_needed return result
If a car runs on 10 gallon of gas and gets 20 mpg, how many miles can it drive?
def solve() -> int: gas_capacity = 10 mpg = 20 miles_driven = gas_capacity * mpg result = miles_driven return result
Grace and Henry have 600 cents between them. If Henry has 50 cents more than Grace, how much money does Grace have?
def solve() -> int: grace_money = (600 - 50) / 2 result = grace_money return result
Possible additional questions and programs: A carton full of books weighs 24 kg. A carton full of magazines weighs 18 kg. If you add 3 kg to the weight of the books carton and remove 2 kg from the weight of the magazines carton, how much do the cartons now weigh?
def solve() -> int: books_weight = 24 magazines_weight = 18 books_weight = books_weight + 3 magazines_weight = magazines_weight - 2 total_weight = books_weight + magazines_weight result = total_weight return result
Jack and Tyra want to go out and collect 25 wildflowers, 5 each from five different types of flowers. If each flower costs $2 each, how much do they need to spend in total?
def solve() -> int: types=5 flowers_per_type=5 cost_per_flower=2 total_flowers = types*flowers_per_type total_cost = total_flowers*cost_per_flower result = total_cost return result
A student is planning to go on a school trip. The cost of the trip is $180, but she has already saved $70. She babysits each week and earns $15 a week. How many weeks does she need to save up the rest of the money for the trip?
def solve() -> int: total_cost = 180 amount_saved = 70 weekly_earnings = 15 weeks_needed = (total_cost - amount_saved) / weekly_earnings result = weeks_needed return result
A toy costs $20 but is currently on sale for 15% off. If Alex buys 2 toys and pays 6% sales tax, what is the total cost of his purchase?
def solve() -> int: toy_price = 20 discount = 0.15 num_toys = 2 sales_tax = 0.06 final_price = (toy_price - (toy_price * discount)) * num_toys final_price_with_tax = final_price * (1 + sales_tax) result = final_price_with_tax return result
A grocery store has 10 shelves and each shelf has 4 jars. How many jars are there in the grocery store in total?
def solve() -> int: num_of_jars = 0 for x in range (10): num_of_jars = num_of_jars + 4 result = num_of_jars return result
Nina spent $5000 on jewelry. She returned a necklace worth $1000 and a bracelet worth $500. She also sold a pair of earrings for 75% of their original price, which was 20% more expensive than the bracelet she returned. Lastly, she purchased a new watch for $250. What was her final cost?
def solve() -> int: jewelry_cost = 5000 necklace_cost = 1000 bracelet_cost = 500 earrings_original_price = bracelet_cost * 1.2 earrings_sold_price = earrings_original_price * 0.75 watch_cost = 250 total_cost = jewelry_cost - necklace_cost - bracelet_cost + earrings_sold_price + watch_co...
Jake can solve 10 math problems in 20 minutes. How many problems can he solve in 1 hour?
def solve() -> int: problems_per_20_minutes = 10 minutes_in_an_hour = 60 problems_per_minute = problems_per_20_minutes / 20 problems_per_hour = problems_per_minute * minutes_in_an_hour result = problems_per_hour return result
Student: A football field is 100 yards long. If a player runs 5 yards per second, how many seconds will it take for the player to run the entire length of the football field?
def solve() -> int: field_length = 100 player_speed = 5 time_taken = field_length / player_speed result = time_taken return result
Paul has 10 pairs of black shoes and six times as many pairs of brown shoes as black shoes. He also has half as many pairs of white shoes as black and brown shoes combined. If he donates 3 pairs of shoes, how many pairs of shoes does he have left?
def solve() -> int: brown_shoes = 10 * 6 white_shoes = (10 + brown_shoes) / 2 total_shoes = 10 + brown_shoes + white_shoes total_shoes -= 3 result = total_shoes return result
The length of a rectangle is three times the width, and the perimeter is 64 inches. What is the area of the rectangle?
def solve() -> int: width = 0 length = 0 perimeter = 64 L_plus_W = perimeter / 2 W = L_plus_W / 4 L = 3 * W area = L * W result = area return result
Ms. Kim has a 4-story building with 12 apartment units on each floor. She charges $1,000 for the units on the first floor, $1,200 for the units on the second floor, $1,400 for the units on the third floor, and $1,600 for the units on the fourth floor. How much revenue does she earn from the rent per month?
def solve() -> int: floors = 4 units_per_floor = 12 rent_per_floor = [1000, 1200, 1400, 1600] total_revenue = 0 for i in range(floors): total_revenue += rent_per_floor[i] * units_per_floor result = total_revenue return result
Sarah wants to become a professional singer. She spends 6 months learning how to sing, and then 1 year training her voice to enhance her singing skills. Afterwards, she spends 3 years practicing and performing at various venues. Additionally, it takes her 8 months to learn how to play a musical instrument. How long did...
def solve() -> int: months_learning_singing = 6 year_training_voice = 1 years_practicing_performing = 3 months_learning_instrument = 8 total_months = months_learning_singing + (year_training_voice * 12) + (years_practicing_performing * 12) + months_learning_instrument result = total_mo...
After reading some books, there were 70 books left on the shelf. When his friend dropped by, she brought twice as many books as she had initially. They decide to share the books equally. How many books did his friend bring?
def solve() -> int: books_on_shelf = 70 friend_books_initial = 0.5 * books_on_shelf total_books = books_on_shelf + friend_books_initial books_each = total_books / 2 friend_books = books_each - friend_books_initial result = friend_books return result
Tom decided to spend $300 on a new smartphone. The salesperson offered him one for $50 less and an additional 20% off. How much lower was the price of the smartphone than Tom's budget?
def solve() -> int: budget = 300 price = 300 - 50 discounted_price = price - (price * 0.2) lower_price = budget - discounted_price result = lower_price return result
Jerry has twice as many marbles as Robert, they both have 48 marbles in total. How many marbles does Robert have?
def solve() -> int: jerry_total = 48 robert_total = 0 result = robert_total return result
A farmer has 400 ducks and chickens on her farm. The ratio of ducks to chickens is 2:3. How many ducks does she have?
def solve() -> int: total_animals = 400 duck_ratio = 2/5 ducks = total_animals * duck_ratio result = ducks return result
Jackson's last name is twice as long as Ava's last name plus 1 letter. If Ava takes away two letters from her last name, she will have the same number of letters as Noah's full name, which is Noah Park. How many letters are in Jackson's last name?
def solve() -> int: ava_last_name = "Park" noah_full_name = "Noah Park" ava_last_name_length = len(ava_last_name) noah_full_name_length = len(noah_full_name) jackson_last_name_length = (2 * ava_last_name_length) + 1 result = jackson_last_name_length return result
7. Adam was gifted a year-long subscription to a streaming service, which initially cost $80. However, every month he Renewed the subscription, he had to pay $6 extra. How much money did Adam spend on his subscription in total, rounded to the nearest dollar?
def solve() -> int: base_cost = 80 monthly_cost = 6 renewals = 11 total = base_cost + (monthly_cost * renewals) total_rounded = round(total) result = total_rounded return result
The Clothing Store has 4 new items on weekdays and 8 new items on each day of the weekend. Each item costs $25. How much money will they make on new items in 1 month?
def solve() -> int: weekday_items = 4 weekend_items = 8 item_cost = 25 weekday_sales = weekday_items * item_cost weekend_sales = weekend_items * item_cost total_sales_per_week = weekday_sales * 5 + weekend_sales * 2 total_sales_per_month = total_sales_per_week * 4 result =...
Amy has 4 less pens than Adam. Adam has twice the pens that Alice has. How many pens are there altogether if Alice has 7?
def solve() -> int: Alice = 7 Adam = Alice * 2 Amy = Adam - 4 total = Alice + Adam + Amy result = total return result
Daniel had to fly his private plane and had a fuel tank with a volume of 20 gallons. He flew to a small airport which is 70 miles away and then flew back home. Later he flew to his business associate's office which was 90 miles away. Midway through the journey, he realized he had forgotten his laptop and flew back home...
def solve() -> int: tank_volume = 20 distance_airport = 70 distance_office = 90 fuel_left = 1.5 total_distance = distance_airport + distance_office + distance_airport fuel_consumed = tank_volume - fuel_left rate = total_distance / fuel_consumed result = rate return result
Alec is driving on a straight road at 50 miles per hour. After 2 hours, he realizes he has been driving in the wrong direction and needs to turn around to go home. If he drives back home at 70 miles per hour, how long does it take him to drive back home in minutes?
def solve() -> int: speed = 50 time = 2 distance = speed * time speed_back = 70 time_back = distance / speed_back * 60 result = time_back return result
A bakery sells cupcakes for $2.50 each. If the bakery wants to make a profit of $50, how many cupcakes must it sell?
def solve() -> int: profit = 50 selling_price = 2.5 total_cupcakes = profit/selling_price result = int(total_cupcakes) return result
Ashlynn bought 2 sweaters and 4 pairs of socks. If each sweater costs $15 and a pair of socks costs $2, what is the total cost of her purchase?
def solve() -> int: num_sweaters = 2 sweater_cost = 15 num_socks = 4 sock_cost = 2 total_cost = (num_sweaters * sweater_cost) + (num_socks * sock_cost) result = total_cost return result
If a car travels at a speed of 60 miles per hour, how far can it travel in 4 hours?
def solve() -> int: speed = 60 time = 4 distance = speed * time result = distance return result
If a restaurant has 50 tables and 4 people can sit at each table, how many people can sit at the restaurant at once?
def solve() -> int: tables = 50 people_per_table = 4 total_people = tables*people_per_table result = total_people return result
David drove a total of 125 miles in 4 hours. What was his average speed during the time?
def solve() -> int: distance = 125 time = 4 * 3600 average_speed = distance/time result = average_speed return result
A truck carries 20 boxes, each weighing 30 kilograms. If the truck carries full capacity, how many kilograms of boxes does it carry?
def solve() -> int: boxes = 20 weight_per_box = 30 total_weight = boxes * weight_per_box result = total_weight return result
Student: 6. Linda has 8 times as many pencils as Sarah. If Linda has 41 pencils, how many pencils does Sarah have?
def solve() -> int: linda = 41 ratio = 8 sarah = linda / ratio result = sarah return result
A computer costs $655 and is being sold at a 12% discount. What is the sale price of the computer?
def solve() -> int: original_price = 655 discount = 12/100 discounted_price = original_price - (discount * original_price) result = discounted_price return result
Student: A cat walks on a leash for 40 minutes at a rate of 5 feet/minute. How far does the cat walk?
def solve() -> int: time = 40 rate = 5 distance = time * rate result = distance return result
Sarah has a collection of 700 seashells that she wants to separate based on their size. She plans on dividing them into equal categories until each category has exactly 35 seashells. How many times will she need to divide her collection to achieve this?
def solve() -> int: num_seashells = 700 seashells_per_category = 35 num_categories = num_seashells // seashells_per_category result = num_categories return result
Michael attempts to save $300 in a month by allocating $10 each day. If he skips three days, how much more money per day should he save to achieve his goal?
def solve() -> int: goal = 300 allocation_per_day = 10 skipped_days = 3 total_allocation = allocation_per_day * (30 - skipped_days) extra_savings_per_day = (goal - total_allocation) / (30 - skipped_days) result = extra_savings_per_day return result
iena had 10 cookies. She gave 3 cookies to her friend and ate 1 cookie. How many cookies does she have left?
def solve() -> int: num_cookies = 10 num_cookies -= 3 num_cookies -= 1 result = num_cookies return result
A company sells 50 pounds of coffee for $200. If they sell 4 pounds bags of coffee, how much should they charge per bag?
def solve() -> int: total_weight = 50 total_price = 200 num_of_bags = total_weight / 4 price_per_bag = total_price / num_of_bags result = price_per_bag return result
Kim has a piece of ribbon that is 36 inches long. She cuts it into 4 equal pieces. Then she uses one piece to make a bow. The bow uses 6 inches of ribbon. How many inches of ribbon does she have left?
def solve() -> int: ribbon = 36 pieces = 4 bow = 6 left = 0 piece_length = ribbon / pieces ribbon -= piece_length bow_length = bow piece_length -= bow_length left += piece_length left += 3 * piece_length result = left return result
Alice works part-time for $15 per hour. She worked 9 hours on Monday, 5 hours on Wednesday, and 6 hours on Thursday. She also worked one hour of overtime on Monday and two hours of overtime on Thursday. How much did she earn in total for the week?
def solve() -> int: hourly_rate = 15 monday_hours = 9 wednesday_hours = 5 thursday_hours = 6 overtime_rate = 1.5 * hourly_rate monday_overtime = overtime_rate * 1 thursday_overtime = overtime_rate * 2 total_pay = hourly_rate * (monday_hours + wednesday_hours + thursday_hours) + monday_ov...
In a charity event, Lisa donates 10 dolls, and 6 people donate 12 teddy bears each. Later on, 35 kids come to pick a toy each. If the remaining toys are equally distributed amongst the kids, how many toys will each kid get?
def solve() -> int: lisa_dolls = 10 people_donate = 6 teddy_bears_each = 12 kids = 35 total_teddy_bears = people_donate * teddy_bears_each total_toys = lisa_dolls + total_teddy_bears toys_per_kid = total_toys // kids result = toys_per_kid return result
There are 10 pages left in a book that John is reading. If he reads 4 pages a day, how many days will it take him to finish the book?
def solve() -> int: pages_left = 10 pages_per_day = 4 days_to_finish = pages_left / pages_per_day result = days_to_finish return result
Danielle has seven hours to work on her project and four hours to cook. After that, she divides her remaining time equally between knitting and sleeping. If she sleeps for eight hours, how many hours does she spend knitting? Sara had $100 in her wallet and she spent 5% of it on buying a new dress. How much money did sh...
def solve() -> int: total_time = 24 project_time = 7 cooking_time = 4 remaining_time = total_time - project_time - cooking_time - 8 knitting_time = remaining_time / 2 sara_wallet = 100 dress_cost = 25 sara_spent = sara_wallet * 0.05 sara_spent_on_dress = sara_spent - (sara_...
Eric did chores for his neighbors and earned $100 in total. He uses $20 of this money to buy more cleaning supplies. After that, he decides to donate one-fifth of the remaining money to a local soup kitchen. How much money did Eric donate to the soup kitchen? Emma is three times the age of her sister, and her sister is...
def solve() -> int: total_money = 100 cleaning_supplies_cost = 20 remaining_money = total_money - cleaning_supplies_cost donation_amount = remaining_money / 5 emma_age = 0 sister_age = 0 aunt_age = 0 for aunt_age in range(1, 90): sister_age = aunt_age / 2 e...
A basketball player made 20 free throws out of 25 attempts. What is the percentage of free throws he made?
def solve() -> int: free_throws_made = 20 total_free_throws = 25 percentage_made = (free_throws_made / total_free_throws) * 100 result = percentage_made return result
If the price of a product is 60 dollars and it is discounted by 25%, what is the final price of the product?
def solve() -> int: original_price = 60 discount_percentage = 25 discount_amount = original_price * (discount_percentage/100) final_price = original_price - discount_amount result = final_price return result