question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Student: How much costlier is 1 kg of apples than 1 kg of oranges, if apples cost Rs. 120 per kg and oranges cost Rs. 104 per kg?
def solve() -> int: apples_cost = 120 oranges_cost = 104 difference = apples_cost - oranges_cost costlier_amount = difference result = costlier_amount return result
A restaurant has a lunch special that costs $10 per person. If a group of 6 people went for lunch, how much did they pay in total?
def solve() -> int: total_cost = 10 * 6 result = total_cost return result
If a football team has 11 players on the field and they have 5 substitutes, how many players are on the team in total?
def solve() -> int: players_on_field = 11 substitutes = 5 total_players = players_on_field + substitutes result = total_players return result
Alice collected 48 stickers from different countries. She gave a sixth of them to her brother and a fifth of them to her sister. She then traded 4 stickers with her friend for 3 new stickers. How many stickers did Alice have left?
def solve() -> int: brother = 48 / 6 sister = 48 / 5 traded = 4 - 3 stickers_left = 48 - brother - sister - traded result = stickers_left return result
At the music store, Mary has a collection of 150 CDs where she gives five for every 30 bought. If she had 20 customers that day, half of whom bought 25 CDs each, how many CDs remain in her rewards collection?
def solve() -> int: cds_bought_by_customers = 20 * 25 rewards_cds = (cds_bought_by_customers // 30) * 5 remaining_cds = 150 - cds_bought_by_customers - rewards_cds result = remaining_cds return result
Jenny will start to save up to buy a new car. She will start with 100 dollars and each month she will save 150 dollars more than the previous month. How long will it take her to save 5000 dollars?
def solve() -> int: start_amount = 100 monthly_increase = 150 target_amount = 5000 savings = start_amount months = 0 while savings < target_amount: savings += monthly_increase months += 1 result = months return result
3. 2 books are sold for $10 each. How much is the cost of 12 books?
def solve() -> int: cost_per_book = 10 num_books = 12 result = cost_per_book * num_books return result
Susan needs to take a certain medication every 6 hours for 5 days. Each dose is 300 mg and the pills are 150 mg each. How many pills does she need to finish the dosage?
def solve() -> int: days = 5 hours_per_day = 24 dose_interval = 6 dose_amount = 300 pill_strength = 150 total_doses = days * (hours_per_day / dose_interval) total_pills = total_doses * (dose_amount / pill_strength) result = total_pills return result
A basketball player made 60% of the shots he attempted in a game. If he attempted 20 shots, how many did he make?
def solve() -> int: shots_attempted = 20 success_rate = 0.6 shots_made = shots_attempted * success_rate result = shots_made return result
Student: A pizza joint has a 14 inch large pizza and a 9 inch small pizza. If a large pizza is enough to feed 4 people and a small pizza feeds 2 people, how many large pizzas and small pizzas do you need to feed a party of 10 people?
def solve() -> int: large_pizza_size = 14 small_pizza_size = 9 large_pizza_people = 4 small_pizza_people = 2 total_people = 10 large_pizzas_needed = (total_people // large_pizza_people) + (1 if total_people % large_pizza_people!= 0 else 0) small_pizzas_needed = (total_people % large_pizza_pe...
-Use **clear** and **concise** language. Some possible questions are: Laura drinks 8 ounces of orange juice that has 110 calories per cup. She then drinks 12 ounces of milk that has 150 calories per pint. How many total calories did she drink?
def solve() -> int: cup = 8 pint = 16 oj_ounces = 8 oj_cups = oj_ounces / cup oj_calories = 110 * oj_cups milk_ounces = 12 milk_pints = milk_ounces / pint milk_calories = 150 * milk_pints total_calories = oj_calories + milk_calories result = total_calories return result...
A mountain peak stands at 4,000m above sea level. If this height is one-fifth of the total distance between the base of the mountain and the peak, how high is the base of the mountain?
def solve() -> int: height_peak = 4000 total_distance = height_peak * 5 height_base = total_distance - height_peak result = height_base return result
A pack of pencils contains 18 pencils. There are 3 different types of pencils: plain, striped, and polka-dotted. There are 6 plain pencils, 4 striped pencils, and 8 polka-dotted pencils. Lisa wants to make a gift for her friend by choosing one pencil of each type. How many different gifts can she make?
def solve() -> int: choices_plain = 6 choices_striped = 4 choices_polka = 8 choices_total = choices_plain * choices_striped * choices_polka result = choices_total return result
At a pet store, one dog food costs $2.50 and one cat food costs $3.50. In total, Jerry bought 8 dog foods and 6 cat foods. How much did he spend?
def solve() -> int: dog_price = 2.50 num_dog = 8 total_dog = dog_price * num_dog cat_price = 3.50 num_cat = 6 total_cat = cat_price * num_cat total_purchase = total_dog + total_cat result = total_purchase return result
A toy store has 300 action figures and 150 dolls. If they want to display them on shelves with an equal number of action figures and dolls, how many shelves will they need?
def solve() -> int: num_action_figures = 300 num_dolls = 150 total_toys = num_action_figures + num_dolls shelves_needed = total_toys / 2 result = shelves_needed return result
The route from Erin's house to Emma's house is 36 miles and is divided into 9 equal portions. Erin is walking at a speed of 3 miles per hour. After walking for 2 hours, how many portions of the route has she completed?
def solve() -> int: portions = (3 * 2) / (36 / 9) result = portions return result
Ava has 36 crayons and 12 markers. She shares them equally with her brother Ben. How many crayons and markers does each of them get?
def solve() -> int: crayons = 36 markers = 12 crayons = crayons // 2 markers = markers // 2 total = crayons + markers result = total return result
A book club bought 120 books for $360. They sold half of the books at a 25% markup and the other half at a 50% discount. How much profit or loss did they make?
def solve() -> int: cost_per_book = 360 / 120 markup_price = cost_per_book * 1.25 discount_price = cost_per_book * 0.5 revenue = (markup_price * 60) + (discount_price * 60) cost = 360 profit_or_loss = revenue - cost result = profit_or_loss return resul...
Sarah and Daniel played a video game where points were awarded for completing a level. If Sarah had scored 500 points and Daniel 2/5 times as many points as Sarah, what is Daniel's current score?
def solve() -> int: sarah_score = 500 daniel_score = (2/5) * sarah_score result = daniel_score return result
At a store, Sandra buys 5 apples for $2.50 each, and 8 oranges for $4 each. How much does she spend?
def solve() -> int: apple = 5 oranges = 8 priceA = 2.50 priceO = 4 total = apple * priceA + oranges * priceO result = total return result
A plumber charges $125 for the first hour of work, and $80 for each additional hour. If the job took 4 hours, what is the total cost of the job?
def solve() -> int: first_hour_cost = 125 additional_hour_cost = 80 total_hours = 4 total_cost = first_hour_cost + additional_hour_cost * (total_hours-1) result = total_cost return result
A local coffee shop serves iced coffee drinks that consist of 3 ounces of coffee, 2 ounces of milk, and 1 ounce of vanilla syrup. If the coffee shop sells 100 iced coffee drinks per day, how many gallons of milk are needed to make all the drinks in a week (assume the shop is open 7 days a week and that 1 gallon = 128 o...
def solve() -> int: coffee_oz_per_week = 100 * 7 * (3+2+1) milk_gal_per_week = coffee_oz_per_week / 128 * 2 result = milk_gal_per_week return result
Here are some possible questions and programs: Anna wants to buy a new laptop. She found one online for $800, but it has a 15% discount. She also has a coupon for $50 off any purchase over $500. How much does she pay for the laptop?
def solve() -> int: laptop_discount = 800 * 0.85 laptop_coupon = laptop_discount - 50 result = laptop_coupon return result
Michael makes 25 paper boats and sets them afloat. 10% are destroyed by the waves and 5 of the others are blown away by the wind. How many boats are left?
def solve() -> int: number_of_boats = 25 percent_destroyed_by_waves = 0.1 number_of_boats_blown_away_by_wind = 5 boats_remaining_after_waves = number_of_boats * (1 - percent_destroyed_by_waves) result = boats_remaining_after_waves - number_of_boats_blown_away_by_wind return resu...
Student: 1. Two fifths of the town's homes are red. A quarter of the red homes are two stories. How many two story homes in the town of Belize are not red?
def solve() -> int: n = 100 red_homes = 2/5 * n two_story_red_homes = 1/4 * red_homes x = 20 two_story_not_red_homes = x - two_story_red_homes result = two_story_not_red_homes return result
An iron rod of length 12 feet is cut into two pieces such that one piece is twice as long as the other. What is the length of the shorter piece?
def solve() -> int: total_length = 12 longer_piece = (2/3)*total_length shorter_piece = total_length - longer_piece result = shorter_piece return result
A car travels 70 kilometers per hour. How many meters does it travel in 30 seconds?
def solve() -> int: speed = 70*1000/3600 time = 30 distance_traveled = speed * time result = distance_traveled return result
Student: At a store, 15 apples cost $9. How much would 3 apples cost?
def solve() -> int: num_apples = 3 cost_15_apples = 9 cost_3_apples = cost_15_apples / 15 * num_apples result = cost_3_apples return result
A school has 800 students. If there are 20 students per class, how many classes are there in the school?
def solve() -> int: num_students = 800 students_per_class = 20 num_classes = num_students // students_per_class result = num_classes return result
10. Marion had 42 cookies. She decided to give away 1/6 of them to her brother. How many cookies did Marion give to her brother?
def solve() -> int: total_cookies = 42 give = 1/6 result = total_cookies * give return result
Thomas earns 10% of the money he receives in a year. This year, he made $240 from baby sitting, received $275 from babysitting and made another $150 by tutoring. How much will he save?
def solve() -> int: total_money_received = 240 + 275 + 150 percent = 10/100 amount_to_save = total_money_received * percent result = amount_to_save return result
Henry can eat 144 cookies in 20 minutes. How many cookies can he eat in 18 minutes?
def solve() -> int: cookies_rate = 144/20 Cookies_time_18 = 18 * cookies_rate result = Cookies_time_18 return result
A store offers a 10% discount on all items. If an item originally costs $100, what is its new price?
def solve() -> int: original_price = 100 discount_rate = 0.1 discount_amount = original_price * discount_rate new_price = original_price - discount_amount result = new_price return result
A triangle has a base of 5cm and a height of 8cm. What is the area of the triangle?
def solve() -> int: base = 5 height = 8 area = 0.5 * base * height result = area return result
If a shop sells 15 items every hour and has a stock of 450 items, how many hours will it take to sell all the stock?
def solve() -> int: items_per_hour = 15 total_items = 450 hours_required = total_items / items_per_hour result = hours_required return result
A cake costs $24.50 and a small coffee costs $3.50. How much does it cost to buy a cake and 2 small coffees?
def solve() -> int: cake_cost = 24.50 small_coffee_cost = 3.50 total_cost = cake_cost + (2 * small_coffee_cost) result = total_cost return result
Lily bought 25 loaves of bread and sliced them into fifths. She then gives each person 3 portions. How many people can she feed?
def solve() -> int: loaves_of_bread = 25 slices_per_loaf = 5 portions_per_slice = 3 total_slices = loaves_of_bread * slices_per_loaf total_portions = total_slices * portions_per_slice people_fed = total_portions // 3 result = people_fed return result
A store sells a product for $50. If the profit margin is 25%, what is the cost of the product for the store?
def solve() -> int: selling_price = 50 profit_margin = 0.25 cost_price = selling_price / (1 + profit_margin) result = cost_price return result
Student: Marty bought 4 quarters, 3 dimes, and 2 nickels. How much money did he spend?
def solve() -> int: quarters = 4 dimes = 3 nickels = 2 quarter_value = 0.25 dime_value = 0.10 nickel_value = 0.05 total_spent = (quarters * quarter_value) + (dimes * dime_value) + (nickels * nickel_value) result = total_spent return result
Kate is starting a new job and needed to buy some work clothes. She found a deal for four blouses at $25 each and two pairs of pants online for a total of $70. She also bought three more pairs of pants from the store for a total of six times the cost of the online ones. How much did Kate spend on work clothes? In a bak...
def solve() -> int: blouses = 4 blouse_price = 25 pants_online = 2 online_price = 70 - (blouses * blouse_price) pants_store = 3 store_price = online_price / 2 total_price = (pants_online * online_price) + (pants_store * store_price) + (blouses * blouse_price) cakes = 27 cupcakes...
A family of five went to a theme park and paid $60 for parking. If the total cost of their outing was $240 and each person's admission ticket cost the same amount, how much did each person's admission ticket cost?
def solve() -> int: ticket_cost = (240 - 60) / 5 result = ticket_cost return result
At the local bowling alley, Mona wants to add up her score to see how many points she got in that game. She managed to bowl 7 strikes and 3 spares. How many points did Mona get in total?
def solve() -> int: number_of_strikes = 7 points_per_strike = 10 number_of_spares = 3 points_per_spare = 5 total_points = (points_per_strike*number_of_strikes) + (points_per_spare*number_of_spares) result = total_points return result
At the market, Kayla bought 7 apples at $2 each, 4 bagels at $4 each and 5 bottles of juice at $3 each. How much did she spend in total?
def solve() -> int: apples = 7 * 2 bagels = 4 * 4 juice = 5 * 3 total_cost = apples + bagels + juice result = total_cost return result
Ali and Sara went to a pizza place and ordered some pizzas. Ali ate 2/3 times more pizza than Sara. If Sara ate 3 slices of pizza, calculate the total number of slices of pizza they ate together.
def solve() -> int: ali = 3 * 2/3 total = ali + 3 result = total return result
The top of a lighthouse located on a cliff is 250m above sea level. If this height is twice the vertical distance between the cliff and the top of a buoy in the water, what is the height of the buoy?
def solve() -> int: height_lighthouse = 250 vertical_distance = height_lighthouse / 2 height_buoy = vertical_distance result = height_buoy return result
If a car travels 60 miles in 1 hour, how long would it take to travel 240 miles?
def solve() -> int: distance = 240 speed = 60 time = distance / speed result = time return result
amantha is going to bake 4 dozen cookies. If each batch makes 2 dozen cookies, how many batches will she need to make?
def solve() -> int: number_of_cookies = 4 * 12 cookies_per_batch = 2 * 12 number_of_batches = number_of_cookies // cookies_per_batch result = number_of_batches return result
A restaurant offers a 15% discount on all meals during their happy hour, which runs from 3pm to 6pm every weekday. If Jose goes to the restaurant at 4pm and orders a meal that costs $20, how much will he pay, including tax (8%)?
def solve() -> int: meal_cost = 20 discount = 0.15 tax_rate = 0.08 happy_hour_start = 15 happy_hour_end = 18 if happy_hour_start <= 16 <= happy_hour_end: meal_cost *= 1 - discount total_cost = meal_cost * (1+tax_rate) result = total_cost return result
Student: There are 700 students in a school. 30% of the students participate in a club and 25% of the students in a club are in the chess club. How many students are in the chess club?
def solve() -> int: total_students = 700 percent_participating = 0.3 percent_in_chess_club = 0.25 students_participating = total_students * percent_participating students_in_chess_club = students_participating * percent_in_chess_club result = students_in_chess_club return result
Grace and Ryan are splitting the cost of a bike rental. They each pay based on how long they ride. Each minute costs $0.10. They rode for 45 minutes each. How much did they each pay?
def solve() -> int: minutes = 45 cost_per_minute = 0.10 grace_cost = minutes * cost_per_minute ryan_cost = minutes * cost_per_minute result = grace_cost / 2 + ryan_cost / 2 return result
Carl wants to buy a new video game that costs $59.99. He has a coupon that gives him 20% off on any purchase over $50. He also has to pay a 7% sales tax on the final price. How much does he have to pay for the video game after applying the coupon and the tax?
def solve() -> int: coupon_price = 59.99 * 0.8 tax_price = coupon_price * 1.07 result = round(tax_price, 2) return result
John's house has an area equal to 1,200 square feet. It has 2 bedrooms that each measure 14 x 15 feet. There are 3 bathrooms that are 5 x 8 feet each. The kitchen, living area, and garage complete the home and they have the same sized areas. How many square feet is the area of the kitchen?
def solve() -> int: total_area = 1200 bedrooms_area = 2 * 14 * 15 bathrooms_area = 3 * 5 * 8 remaining_area = total_area - bedrooms_area - bathrooms_area kitchen_area = remaining_area / 3 result = kitchen_area result return result
A truck drives at a consistent speed unless it takes a rest break. The truck drives for 6 hours then stops for 45 minutes. It then drives for another 9 hours then stops for 20 minutes. After this, the truck takes a 15-minute break after every 4 hours of driving. If the entire trip takes 3 days and 6 hours, how much tim...
def solve() -> int: hours_driving = 6 + 9 + (3 * 24) rest_breaks = (6 // 4) * 15 total_rest_time = 45 + 20 + rest_breaks time_not_moving = (3 * 24 * 60) + (6 * 60) - (hours_driving * 60) - total_rest_time result = time_not_moving / 60 return result
A jar contains 500 marbles, some red and some blue. If the ratio of red marbles to blue marbles is 5:3, how many red marbles are in the jar?
def solve() -> int: total_ratio = 5 + 3 red_marbles = 5/total_ratio * 500 result = red_marbles return result
A bakery makes 250 cupcakes per day. If they use 1 cup of flour for every 20 cupcakes, how many cups of flour do they need daily to make the cupcakes?
def solve() -> int: cupcakes_per_day = 250 cups_per_20_cupcakes = 1 cups_per_cupcake = cups_per_20_cupcakes / 20 cups_per_day = cups_per_cupcake * cupcakes_per_day result = cups_per_day return result
David owes $90 to his friend, but he paid $20 and agreed to work for the rest. He found a job that pays $8 per hour. How many hours does he need to work for?
def solve() -> int: total_owed = 90 amount_paid = 20 amount_left = total_owed - amount_paid hourly_rate = 8 remaining_owed = amount_left hours_needed = remaining_owed / hourly_rate result = hours_needed return result
A swimming pool was filled to 3/4 capacity. Then 2/5 of that water was drained from the pool. What percent of the pool is now filled with water?
def solve() -> int: capacity = 100 filled = capacity * 3/4 drained = filled * 2/5 remaining = filled - drained percent_filled = remaining / capacity * 100 result = percent_filled return result
A square has a perimeter of 44 cm. What is its area?
def solve() -> int: perimeter = 44 side = perimeter / 4 area = side**2 result = area return result
Mr. Davis received thank you messages from 15% of his students. Of these, 1/9 contained a free tutoring session worth $40. If the total value of tutoring session was $120, how many students does Mr. Davis have?
def solve() -> int: students = 0 thank_you_messages = 0 tutoring_sessions = 0 students = 120 / 40 * 9 thank_you_messages = students * 0.15 tutoring_sessions = thank_you_messages * (1/9) total_students = tutoring_sessions * 9 result = total_students return res...
Taylor has a part-time job at a bakery that pays $9 per hour. If she worked 20 hours this week and spent 1/4 of her earnings on gas for her car, how much money did she earn this week?
def solve() -> int: hours_worked = 20 total_earned = hours_worked * 9 gas_cost = total_earned / 4 money_earned = total_earned - gas_cost result = money_earned return result
On the planet Gorky, there are two races of beings: the Morks and the Norks. Each Mork has 2 eyes on each of their 5 heads, while each Nork has 3 eyes on each of their 4 heads. If a Gorky tourist shuttle always carries 4 Morks and 7 Norks, how many eyes are on the Gorky tourist shuttle?
def solve() -> int: morks_eyes = 2 norks_eyes = 3 morks_heads = 5 norks_heads = 4 morks_passengers = 4 norks_passengers = 7 morks_total_eyes = morks_eyes * morks_heads * morks_passengers norks_total_eyes = norks_eyes * norks_heads * norks_passengers total_eyes = m...
A value of $25000 is invested in a savings account. The annual interest rate is 12%. How much is in the account after 5 years?
def solve() -> int: principal = 25000 rate = 12/100 time = 5 result = principal * (1 + rate)**time return result
Alice baked some cupcakes. She baked 48 chocolate cupcakes and some vanilla cupcakes. She has a total of 72 cupcakes. How many vanilla cupcakes did she bake?
def solve() -> int: chocolate_cupcakes = 48 total_cupcakes = 72 vanilla_cupcakes = total_cupcakes - chocolate_cupcakes result = vanilla_cupcakes return result
Samantha and David are planning to go on a food tour. The tour guide costs $80 per person, and each food tasting costs $15 per person. If they are going to visit 5 different places in total, how much money will they spend? The ratio of juice poured in ounces to the number of cups it filled is 5:8. If Sarah poured 30 ou...
def solve() -> int: num_people = 2 tour_guide_cost = 80 * num_people food_tasting_cost = 15 * num_people * 5 total_cost = tour_guide_cost + food_tasting_cost ratio = 5/8 juice_ounces = 30 num_cups = juice_ounces / (8*ratio) result = total_cost + num_cups return result
Peter bought 36 candies and distributed one-sixth of them to his classmates. His classmates now have three times the number of candies they received from Peter. How many candies do his classmates have now?
def solve() -> int: candies_bought = 36 distributed_candies = candies_bought / 6 classmates_candies = distributed_candies * 3 result = classmates_candies return result
Every month, the school librarian gives 2 books to each of her students. She gave out 120 books last month. This upcoming month, 6 students are on a vacation. How many books will the school librarian give out this month?
def solve() -> int: books_per_student = 2 total_books_last_month = 120 students_on_vacation = 6 total_students = 30 - students_on_vacation total_books_this_month = total_students * books_per_student result = total_books_this_month return result
Student: Jenna is baking a cake in a 9 inch by 12 inch rectangular pan. The cake will be cut into 9 equal pieces of equal size. How wide will each piece of cake be?
def solve() -> int: length = 9 width = 12 num_pieces = 9 piece_width = width / num_pieces result = piece_width return result
Lana has 2 dogs and 3 cats. If each dog eats 1 pound of food per day and each cat eats 1/4 pound of food per day, how many pounds of food will she need in a week?
def solve() -> int: dogs = 2 cats = 3 dog_food = 1 cat_food = 1/4 days = 7 total_food = (dogs * dog_food + cats * cat_food) * days result = total_food return result
Student: A restaurant serves 300 chicken burgers every month. They are looking to increase their serving size by 20%. How many chicken burgers will they need to serve per month after the increase?
def solve() -> int: initial_burgers = 300 increase_percentage = 20 increase_amount = initial_burgers * (increase_percentage/100) total_burgers = initial_burgers + increase_amount result = total_burgers return result
A garden has 10 flowers. If 3 more flowers are planted and then 2 flowers die, how many flowers are left in the garden?
def solve() -> int: total_flowers = 10 + 3 - 2 result = total_flowers return result
Emily sold 50 lemonades for $1 each and 40 cookies for $0.5 each at a bake sale. She had to pay $20 for the ingredients and $10 for the table rental. She also donated 10% of her profit to a charity. How much money did Emily keep for herself?
def solve() -> int: lemonades = 50 lemonade_price = 1 cookies = 40 cookie_price = 0.5 ingredients = 20 rental = 10 donation = 0.1 revenue = lemonades * lemonade_price + cookies * cookie_price cost = ingredients + rental profit = revenue - cost donation_amount = profit * donat...
Paul went to the amusement park with his savings. He spent 2/5 of his savings on tickets and souvenirs. He had 1/3 of the remaining savings left after buying food. He came home with 185 dollars. How much did he start with?
def solve() -> int: final_balance = 185 savings_remaining_after_food = final_balance * 3 savings_remaining_after_spending = savings_remaining_after_food * (1/(1/3)) initial_savings = savings_remaining_after_spending * (5/3) result = initial_savings return result
A train travels from station A to station B at a speed of 60 miles per hour. It then travels back to station A from station B at a speed of 40 miles per hour. If the distance between the two stations is 120 miles, how long did the entire trip take?
def solve() -> int: speed_to = 60 speed_back = 40 distance = 120 time_to = distance / speed_to time_back = distance / speed_back total_trip_time = time_to + time_back result = total_trip_time return result
Two friends split a $120 bill, including a 10% tip. How much did each friend pay?
def solve() -> int: total_bill = 120 tip_percent = 10 bill_with_tip = total_bill * (1 + tip_percent/100) each_pay = bill_with_tip / 2 result = each_pay return result
Possible new questions are: Lisa wants to paint her rectangular bedroom wall. She has two cans of paint, each with 2 liters of paint. One liter of paint can cover 5 square meters of wall. Her wall is 4 meters long and 3 meters high. How much paint is left after she paints her wall?
def solve() -> int: wall_area = 4 * 3 paint_needed = wall_area / 5 paint_available = 2 * 2 paint_left = paint_available - paint_needed result = paint_left return result
A rollercoaster travels 100 meters in 20 seconds. If it travels the first 25 meters in 5 seconds and the remaining in the rest of the time, what was its average speed in (m/s)?
def solve() -> int: distance_total = 100 time_total = 20 distance_first_part = 25 time_first_part = 5 distance_second_part = distance_total - distance_first_part time_second_part = time_total - time_first_part total_time = time_first_part + time_second_part total_distance = dis...
A boat can travel 36 miles downstream in 3 hours, but it takes 4 hours to travel the same distance upstream. What is the speed of the boat in still water and what is the speed of the current?
def solve() -> int: distance = 36 time_downstream = 3 time_upstream = 4 speed_downstream = distance/time_downstream speed_upstream = distance/time_upstream speed_water = (speed_downstream + speed_upstream)/2 current_speed = (speed_downstream - speed_water) result = (speed_water, current_...
Jane starts a new job and earns $50 on the first day. On the second day, she earns $55. On the third day, she earns $60. If her daily earnings keep increasing by $5 each day, how much will she earn on the eighth day?
def solve() -> int: first_day = 50 second_day = 55 third_day = 60 increase_per_day = 5 eighth_day = third_day + 5 * increase_per_day result = eighth_day result return result
Ryan is a painter who makes art pieces for customers. He charges $50 per hour for his work. He spent 8 hours on a painting for Alice, 6 hours on a painting for Bob, and 4 hours on a painting for Carl. However, Carl was unhappy with his painting and asked for a 25% discount. How much money did Ryan make from his three p...
def solve() -> int: price_alice = 8 * 50 price_bob = 6 * 50 price_carl = 4 * 50 price_carl_discounted = price_carl - price_carl * (25 / 100) revenue = price_alice + price_bob + price_carl_discounted result = revenue return result
A package of markers has 30 markers. 15 of them are black, another 15 are multi-colored. If Andy takes out 5 black markers and 4 multi-colors, how many markers are left with him?
def solve() -> int: total_markers = 30 black = 15 multi_colored = 15 taken_out_black = 5 taken_out_multi_colored = 4 remaining = total_markers - taken_out_black - taken_out_multi_colored result = remaining return result
Jay got 15 points for the first assignment and 20 points for the second assignment. If the total of both assignments is 75%, how many points did he get for the third assignment?
def solve() -> int: assignment_1 = 15 assignment_2 = 20 total = assignment_1 + assignment_2 percentage = 0.75 target = total * percentage remain = target - total result = remain return result
In a school of 100 students, 70% of them are boys. How many students are boys?
def solve() -> int: total = 100 boys = total * 0.7 result = boys return result
John is buying tiles for his kitchen floor. The kitchen is 10 feet long and 8 feet wide. If each tile is 1 foot by 1 foot, how many tiles does John need?
def solve() -> int: kitchen_length = 10 kitchen_width = 8 tile_size = 1 total_tiles = kitchen_length * kitchen_width / tile_size**2 result = total_tiles return result
Student: A company sells apples for $1.25 per pound plus a $2.50 flat fee for shipping. How much will it cost to ship 8 pounds of apples?
def solve() -> int: apple_price = 1.25 shipping_fee = 2.50 pounds_of_apples = 8 total_cost = (apple_price * pounds_of_apples) + shipping_fee result = total_cost return result
A farmer has 100 chickens. Each chicken lays 1 egg every day. How many eggs will the farm have after 7 days?
def solve() -> int: chickens = 100 eggs_per_chicken_per_day = 1 days = 7 total_eggs = chickens * eggs_per_chicken_per_day * days result = total_eggs return result
If the cost of a product is decreased by 20%, and then increased by 25%, what will be the percentage change in the price?
def solve() -> int: price = 100 decrease = price * (20/100) new_price = price - decrease increase = new_price * (25/100) final_price = new_price + increase percentage_change = ((final_price - price) / price) * 100 result = percentage_change return result
At a grocery store, there are 35 red apples and 18 green apples. If 5 red apples and 3 green apples are sold, how many apples are left?
def solve() -> int: apple_total = 35 + 18 apples_sold = 5 + 3 apples_left = apple_total - apples_sold result = apples_left return result
A bookstore sells 8 fiction books and 5 nonfiction books every hour. A fiction book costs $15, and a nonfiction book costs $20. How much money does the bookstore make in a 7-hour day from selling fiction and nonfiction books?
def solve() -> int: fiction_books_per_hour = 8 nonfiction_books_per_hour = 5 fiction_book_cost = 15 nonfiction_book_cost = 20 hours_worked = 7 fiction_revenue = fiction_books_per_hour * fiction_book_cost nonfiction_revenue = nonfiction_books_per_hour * nonfiction_book_cost total_rev...
Tim and Mark are going to the beach. They need to bring $45 in total. Tim can bring 3 times as much as Mark. How much money should Tim bring?
def solve() -> int: money_total = 45 money_mark = money_total / 4 money_tim = money_total - money_mark result = money_tim return result
At the bakery, there are four times as many cupcakes as donuts. If there are 20 donuts in the bakery, how many cupcakes are there?
def solve() -> int: donuts = 20 cupcakes = 4 * donuts result = cupcakes return result
A store sells shirts for $12 each and pants for $20 each. A customer buys 3 shirts and 2 pants. What is their total cost?
def solve() -> int: cost_of_shirt = 12 cost_of_pants = 20 num_of_shirts = 3 num_of_pants = 2 total_cost = (cost_of_shirt * num_of_shirts) + (cost_of_pants * num_of_pants) result = total_cost return result
Sarah is trying to count the number of books on a shelf, but she accidentally adds 9 extra and forgets to count 2. If Sarah thinks there are 50 books, how many are there really?
def solve() -> int: books_on_shelf = 50 extra_books_added = 9 books_forgotten = 2 total_books = books_on_shelf - extra_books_added + books_forgotten result = total_books return result
A triangle has a base of 10 cm and a height of 5 cm. What is the area of the triangle?
def solve() -> int: triangle_base = 10 triangle_height = 5 area = 0.5 * triangle_base * triangle_height result = area return result
Laura bought 12 books from a bookstore. Each book cost $15, but she got a 20% discount on the total bill. She also had to pay a 10% sales tax on the discounted amount. How much did Laura pay in total?
def solve() -> int: original_bill = 12 * 15 discounted_bill = original_bill * 0.8 final_bill = discounted_bill * 1.1 result = final_bill return result
A road trip is 500 miles long. The car travels at 60 miles per hour, but has to stop for gas every 100 miles. How long does the trip take?
def solve() -> int: total_distance = 500 speed = 60 gas_distance = 100 driving_distance = total_distance - gas_distance driving_time = driving_distance / speed num_pitstops = total_distance // gas_distance pitstop_time = num_pitstops * 0.25 total_time = driving_time + pitstop_time re...
In five years, Tyler will be five times as old as Emily. If Tyler is currently one-fourth of his grandfather's age, who is 68, how old is Emily now?
def solve() -> int: grandfather_age = 68 tyler_age = grandfather_age / 4 tyler_age_in_5_years = tyler_age + 5 emily_age_in_5_years = tyler_age_in_5_years / 5 emily_age = emily_age_in_5_years - 5 result = emily_age return result
Jack had 400 dollars. He spent 1/2 of it on a gaming console and gave 3/10 of the remaining money to his sister. How much money did he have left?
def solve() -> int: jack_money = 400 spent_on_console = jack_money * (1/2) jack_money -= spent_on_console money_given = jack_money * (3/10) jack_money -= money_given result = jack_money return result
The sum of three consecutive odd numbers is 75. Find the three numbers.
def solve() -> int: second_number = 25 first_number = second_number - 2 third_number = second_number + 2 result = f"First number: {first_number}, Second number: {second_number}, Third number: {third_number}" return result
Jason’s age is 25. His sister is 5 years younger than him and his brother is 3 years older than his sister. How old is Jason’s brother?
def solve() -> int: age_jason = 25 age_sister = age_jason - 5 age_brother = age_sister + 3 result = age_brother return result
Ava wants to become a software developer before she turns 30. If she spends 5 hours a day coding and practices every day, Monday to Friday, taking two weeks off each year, how long will it take her to become a pro according to the 10,000-hour rule?
def solve() -> int: days_per_year = 365 - 14 hours_per_day = 5 total_hours_needed = 10000 hours_per_year = days_per_year * hours_per_day years_needed = total_hours_needed / hours_per_year result = years_needed return result