question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
There are 10 red balls and 15 blue balls in a box. If a ball is drawn randomly from the box, what is the probability it will be a red ball?
def solve() -> int: red_balls = 10 blue_balls = 15 total_balls = red_balls + blue_balls probability = red_balls / total_balls result = probability return result
Student: A plane flies with a wind speed of 56 km/h and a tailwind of 18 km/h. What is its true airspeed?
def solve() -> int: wind_speed = 56 tailwind = 18 true_airspeed = 0 true_airspeed = wind_speed + tailwind result = true_airspeed return result
Kevin has 18 sugar cubes. He has a box with 7 cubes and a bag with 10 cubes. How many cubes does he have left?
def solve() -> int: kevin = 18 box = 7 bag = 10 sugar_cubes_left = kevin - box - bag result = sugar_cubes_left return result
Ben has a rectangular garden that measures 10 meters by 6 meters. He wants to plant some flowers along the perimeter of the garden. He needs one flower for every meter of the perimeter. How many flowers does he need in total?
def solve() -> int: perimeter = 10 + 10 + 6 + 6 flower_number = perimeter * 1 result = flower_number return result
John ran 5 miles on Monday, 8 miles on Tuesday, and 11 miles on Wednesday. How many miles did he run in total?
def solve() -> int: monday_miles = 5 tuesday_miles = 8 wednesday_miles = 11 total_miles = monday_miles + tuesday_miles + wednesday_miles result = total_miles return result
Student: Jamie collected 3 bags of apples, Kaitlyn collected 2 and a half bags, and Sarah collected 6 bags. If each bag contains 10 apples, how many apples did they collect in total?
def solve() -> int: jamie_bags = 3 kaitlyn_bags = 2.5 sarah_bags = 6 total_apples = (jamie_bags * 10) + (kaitlyn_bags * 10) + (sarah_bags * 10) result = total_apples return result
Jason's recipe calls for 1/4 cup of chopped onion, but he likes to quadruple this amount to make it extra onion-y. Each onion yields 1/8 cup of chopped onion. How many onions does Jason need?
def solve() -> int: onion_per_recipe = 1/4 onion_per_onion = 1/8 onion_needed = onion_per_recipe * 4 onions = onion_needed / onion_per_onion result = onions return result
Hailey bought 5 bottles of water for $1 each, 2 bags of chips for $2 each and a chocolate for $3. How much did Hailey spend in total?
def solve() -> int: water_price = 1 num_waters = 5 chips_price = 2 num_chips = 2 chocolate_price = 3 total_cost = (water_price * num_waters) + (chips_price * num_chips) + chocolate_price result = total_cost return result
A bookstore sells books for $12.50 each. If someone buys 3 or more books, they receive a 10% discount on the entire purchase. What would be the cost of buying 5 books?
def solve() -> int: book_price = 12.5 num_books = 5 total_cost = book_price * num_books if num_books >= 3: discount = total_cost * 0.1 total_cost -= discount result = total_cost return result
If 40 marbles are divided equally into 8 jars, how many marbles are in each jar?
def solve() -> int: num_of_marbles = 40 num_of_jars = 8 marbles_per_jar = num_of_marbles / num_of_jars result = marbles_per_jar return result
Robert runs an ice-cream shop. On average he earns $9 an hour and he earns a $1.50 per customer he serves. Saturday he worked 3.25 hours and served 13 customers. How much money did Robert make on Saturday?
def solve() -> int: hoursSaturday = 3.25 salaryPerHour = 9 customersSaturday = 13 revenuePerCustomer = 1.50 salarySaturday = hoursSaturday * salaryPerHour customersRevenueSaturday = customersSaturday * revenuePerCustomer result = salarySaturday + customersRevenueSaturday r...
A store has a sale where all items are 20% off. If a vase regularly costs $50, what is the sale price?
def solve() -> int: regular_price = 50 discount_percentage = 0.2 discount_amount = regular_price * discount_percentage sale_price = regular_price - discount_amount result = sale_price return result
A painter is buying paint for a project. The painter uses red, green, blue, and yellow paints, and each painting requires 10 different colors of any combinations. This week he purchased 150 liters of each type of paint. Unfortunately, some of the paint got spilled, and 35 liters of red, 20 liters of green, 10 liters of...
def solve() -> int: red_paint = 150 - 35 green_paint = 150 - 20 blue_paint = 150 - 10 yellow_paint = 150 - 25 total_paint = red_paint + green_paint + blue_paint + yellow_paint paintings = total_paint // 10 result = paintings return result
Student: Alex and his two friends went shopping. These three people combined only spent 5 dollars. Daniel spent 2 dollars and his friend Alexa spent 3 times as much as him. How much did Alexa spend?
def solve() -> int: daniel_spent = 2 alexa_spent = daniel_spent * 3 result = alexa_spent return result
A city has a population of 300,000. Each year, the population increases by 2%. If the growth continues, how many people will live there in 10 years?
def solve() -> int: population = 300000 for i in range(10): population *= 1.02 result = int(population) return result
Mia has $40. Mia buys 3 pizzas for $8 each and 4 sodas for $2 each. How much money does Mia have left?
def solve() -> int: mia_money = 40 pizza_price = 8 pizza_quantity = 3 soda_price = 2 soda_quantity = 4 pizza_cost = pizza_price * pizza_quantity mia_money = mia_money - pizza_cost soda_cost = soda_price * soda_quantity mia_money = mia_money - soda_cost re...
A school has 500 students. If 60% of the students have brown eyes, how many students have brown eyes?
def solve() -> int: brown_eyes = 0.6*500 result = brown_eyes return result
A bus travels 100 miles in 2 hours. What is its speed in miles per hour?
def solve() -> int: distance_in_miles = 100 time_in_hours = 2 speed_in_mph = distance_in_miles/time_in_hours result = speed_in_mph return result
A car can run a distance of 480 km in 8 hours. What is the average speed of the car in km/hr?
def solve() -> int: distance = 480 time = 8 average_speed = distance / time result = average_speed return result
A recipe calls for 3 cups of sugar to make 12 cookies. How many cups of sugar will be required to make 24 cookies?
def solve() -> int: sugar_per_cookie = 3/12 cookies = 24 sugar_required = sugar_per_cookie * cookies result = sugar_required return result
ome possible questions and programs are: Sam had 8 liters of juice. He drank 3/8 liters in the morning and gave 1/3 of the remaining to his friend. How many milliliters of juice did he have left?
def solve() -> int: juice = 8 juice = juice - 3/8 juice = juice * 2/3 result = juice * 1000 return result
At Sam's Electronics, they have a deal of buy-1-get-1-free on headphones and buy-2-get-1-free on speakers. If headphones cost $50 and speakers cost $100, how much would it cost to buy 10 headphones and 9 speakers using the special pricing?
def solve() -> int: headphones_price = 50 speakers_price = 100 headphones_quantity = 10 speakers_quantity = 9 headphones_discounted_quantity = headphones_quantity // 2 speakers_discounted_quantity = speakers_quantity // 3 headphones_cost = headphones_discounted_quantity * head...
In a pantry, there are 10 cans of soup, 3 cans of beans, 18 packets of noodles, 4 boxes of cereal, and a bag of grains. One can of soup costs $2, a can of beans costs $1.30, 6 packets of noodles cost $3.50, a box of cereal costs $5, and half of the bag of grains costs $4. What is the total cost of the pantry items?
def solve() -> int: soup_cans = 10 bean_cans = 3 noodle_packets = 18 cereal_boxes = 4 grain_bag = 1 soup_cost = soup_cans * 2 bean_cost = bean_cans * 1.3 noodle_cost = (18 // 6) * 3.5 cereal_cost = cereal_boxes * 5 grain_cost = (grain_bag / 2) * 4 total_cost = soup_...
A man invested $8000 for 3 years at 10% simple interest. What is the total amount he will get back?
def solve() -> int: principal = 8000 rate = 10 time = 3 interest = (principal * rate * time) / 100 amount = principal + interest result = amount return result
A classroom has 25 desks, and each desk has 4 legs. The teacher's desk has 2 legs. How many legs are in total?
def solve() -> int: legs = 25 * 4 + 2 result = legs return result
Michael has a painting that measures 30 inches by 40 inches, and his friend Sarah has a painting that measures 20 inches by 24 inches. If the paintings weigh 5 oz per square inch of canvas, how much more does Michael's painting weigh in pounds?
def solve() -> int: michael_length = 30 michael_width = 40 sarah_length = 20 sarah_width = 24 weight_per_square_inch = 5 michael_area = michael_length * michael_width sarah_area = sarah_length * sarah_width michael_weight = michael_area * weight_per_square_inch sarah_weight...
Every day, Sam draws 4 pictures on his sketchbook. He uses 2 pencils every day and throws them away when they are too short. He buys a pack of 10 pencils every week. How many pencils does he have left after 3 weeks?
def solve() -> int: pictures = 0 pencils = 0 packs = 0 for day in range(21): pictures += 4 pencils -= 2 if pencils == 0: packs += 1 pencils += 10 result = pencils return result
A train travels at 80 mph and makes a trip of 650 miles in 7 hours. What is the average speed of the train in km/h?
def solve() -> int: distance_in_miles = 650 time_in_hours = 7 speed_in_mph = 80 mph_to_kmph = 1.609 distance_in_km = distance_in_miles * mph_to_kmph speed_in_kmph = distance_in_km / time_in_hours result = speed_in_kmph return result
James has $3500 to spend on a new TV and surround sound system. The TV costs $2800 and the surround sound system costs $900. If he gets a 10% discount on the TV and a 5% discount on the sound system, how much money does he have left after the purchase?
def solve() -> int: tv_price = 2800 surround_sound_price = 900 total_price = tv_price + surround_sound_price discounted_price = tv_price * 0.9 + surround_sound_price * 0.95 result = 3500 - discounted_price return result
Student: 5. Ethan was doing some housework and cleaned the windows of his house 5 times on the first day, 4 times on the second day, and did 3 times more than the first day on the third day. How many times did Ethan clean the windows during these three days?
def solve() -> int: first_day = 5 second_day = 4 third_day = first_day + 3 total = first_day + second_day + third_day result = total return result
Jack has 5 red balls and 3 blue balls. If he takes out 2 red balls and 1 blue ball, how many balls does he have left?
def solve() -> int: num_red_balls = 5 num_blue_balls = 3 num_removed_red_balls = 2 num_removed_blue_balls = 1 total_balls_left = num_red_balls - num_removed_red_balls + num_blue_balls - num_removed_blue_balls result = total_balls_left return result
A jar of peanut butter has 16 servings with 190 calories each. Lisa uses 2 servings to make a sandwich and 1 serving to make a smoothie. How many calories are left in the jar?
def solve() -> int: calories_per_serving = 190 calories_used_by_Lisa = calories_per_serving * (2 + 1) calories_left_in_jar = calories_per_serving * 16 - calories_used_by_Lisa result = calories_left_in_jar return result
If Mary sells ice cream on Friday, Saturday, and Sunday, and she earns $3 per hour for every hour, how much money will she make after selling ice cream for 8 hours each day for 2 weeks straight?
def solve() -> int: hours_per_day = 8 days_per_week = 3 weeks = 2 hourly_rate = 3 total_hours = hours_per_day * days_per_week * weeks total_earnings = total_hours * hourly_rate result = total_earnings return result
Ashley drives 35 minutes to work and back every day. On weekends, she spends 1.5 hours driving to go grocery shopping at the nearest store. How much time does Ashley spend driving to work and running errands on weekends every week?
def solve() -> int: work_time = 35 grocery_time = 1.5 * 60 total_time = (work_time * 5) + grocery_time result = total_time return result
Student: A grocery store has a sale on cereal. The original price for a box of cereal was $4.75. The new sale price is $3.25. If Carla buys 7 boxes of cereal at the sale price, how much money does she save?
def solve() -> int: original_price = 4.75 sale_price = 3.25 number_of_boxes = 7 total_original_price = original_price * number_of_boxes total_sale_price = sale_price * number_of_boxes amount_saved = total_original_price - total_sale_price result = amount_saved return result
Bob wants to buy a new bike which costs $350. He decides to save $15 per week until he has enough money to buy it. How many weeks will he need to save up?
def solve() -> int: goal = 350 saved_per_week = 15 weeks_needed = goal // saved_per_week result = weeks_needed return result
John goes to the farmer's market on a Tuesday where apples cost $2 per pound, thrice the price on a Thursday, and five times as much as Tuesday on a Sunday. If John buys apples on Thursday and Sunday, what is the total cost?
def solve() -> int: tuesday_price = 2 thursday_price = tuesday_price * 3 sunday_price = tuesday_price * 5 thursday_apples = 5 sunday_apples = 10 thursday_cost = thursday_price * thursday_apples sunday_cost = sunday_price * sunday_apples total_cost = thu...
Tom collects stamps and spends 1/5 of his allowance on every stamp he buys. If he collects five stamps every month for three months, how much allowance money will Tom have spent in total?
def solve() -> int: allowance = 100 fraction_spent = 1/5 stamps_per_month = 5 num_months = 3 total_stamps = stamps_per_month * num_months total_spent = total_stamps * allowance * fraction_spent result = total_spent return result
Student: In a school, 3/10 of the teachers are men and the rest are women. If there are 120 teachers, how many of them are women?
def solve() -> int: total_teachers = 120 male_teachers = total_teachers * 3/10 female_teachers = total_teachers - male_teachers result = female_teachers return result
A bag contains 10 red marbles, 8 blue marbles, and 7 green marbles. John draws 3 marbles from the bag without replacement. What is the probability that he draws 2 red marbles and 1 blue marble?
def solve() -> int: prob_red1 = 10/25 prob_red2 = 9/24 prob_blue = 8/23 prob_order1 = prob_red1*prob_red2*prob_blue prob_rrb = prob_order1 prob_rbr = prob_red1*prob_blue*prob_red2 prob_brr = prob_rbr prob_any = prob_rrb+prob_rbr+prob_brr ...
Emily wanted to buy a new bike and budgeted $700 for it. The store offered her a 10% discount and an additional $50 off. How much did she pay for the bike?
def solve() -> int: budget = 700 discount = 0.1 additional_discount = 50 discount_amount = budget * discount new_budget = budget - discount_amount final_price = new_budget - additional_discount result = final_price return result
John drove 200 miles at a speed of 60 miles per hour. How long did it take him to drive this distance?
def solve() -> int: distance = 200 speed = 60 time = distance / speed result = f'{time} hours' result = time return result
A recipe calls for 3/4 cup of milk. If you want to make 1/2 of the recipe, how much milk do you need?
def solve() -> int: originalMilk = 0.75 newRatio = 0.5 newMilk = originalMilk * newRatio result = newMilk return result
Student: 15 out of 25 students in a class got an A+ in a test. How many students got a grade lower than an A+?
def solve() -> int: num_students = 25 num_Aplus = 15 num_lower_than_Aplus = num_students - num_Aplus result = num_lower_than_Aplus return result
A company produces 4,000 products a month. If they need to produce 60,000 products this year, how many more products do they need to produce?
def solve() -> int: x = 4_000 y = 12 z = 60_000 result = z - x * y return result
If a recipe calls for 2 cups of flour and you only have 1 cup, what fraction of the required flour do you have?
def solve() -> int: flour_required = 2 flour_have = 1 fraction_of_flour = flour_have / flour_required result = fraction_of_flour return result
Joe filled up his car with 16 gallons of gas. The first five gallons cost $1.50 each, the next nine gallons cost $2.00 each. How much has he spent for the gas?
def solve() -> int: number_gallons_1 = 5 price_per_gallon_1 = 1.50 number_gallons_2 = 9 price_per_gallon_2 = 2 price_total = (number_gallons_1 * price_per_gallon_1) + (number_gallons_2 * price_per_gallon_2) result = price_total return result
Jacob sold 18 surfboards for $250 each. If he made $4200 total from selling paddleboards, how much more did he make from selling surfboards than paddleboards? Jenna needs to fill up her gas tank for a road trip. She uses 4 equal-sized containers of gas and adds the gas she gets to the 10 gallons she already has. She no...
def solve() -> int: num_surfboards = 18 price_surfboard = 250 total_surfboard_sales = num_surfboards * price_surfboard total_paddleboard_sales = 4200 difference = total_surfboard_sales - total_paddleboard_sales num_containers = 4 initial_gas = 10 total_gas = 28 gas_from_containe...
Some possible similar questions are: Leo sells lemonade for $1.50 a cup. He uses 8 lemons to make a pitcher of lemonade, and each pitcher can fill 12 cups. If he sells 15 pitchers of lemonade, how much money does he make?
def solve() -> int: lemonade_price = 1.5 lemons_per_pitcher = 8 cups_per_pitcher = 12 pitchers_sold = 15 cups_sold = cups_per_pitcher * pitchers_sold money_from_cups = lemonade_price * cups_sold lemon_cost = 0.25 lemons_used = lemons_per_pitcher * pitchers_sold money_for_lemons ...
``` A person wants to buy a $1000 laptop and has $800 saved. If they save $50 per week, how long does it take for them to have enough money to buy the laptop?
def solve() -> int: laptop_price = 1000 money_saved = 800 money_per_week = 50 weeks_needed = (laptop_price - money_saved) / money_per_week result = f'The person needs to save for {weeks_needed} weeks to buy the laptop.' result = weeks_needed return result
Ms. Kim takes a shuttle every day to work. The shuttle leaves at 8:30 a.m. and it takes 15 minutes to arrive at the first office building. If Ms. Kim arrives at work at 9:15 a.m., how many minutes did it take her to travel from the first office building to her workplace?
def solve() -> int: shuttle_departure_time = 8 * 60 + 30 arrival_time = 9 * 60 + 15 travel_time = arrival_time - shuttle_departure_time result = travel_time return result
Kevin has a pack of 20 grapes. He ate seven of them, and gave three to his brother. He then put 1/4 of the remaining grapes into a container and gave the rest to his sister. How many grapes did he give to his sister?
def solve() -> int: number_of_grapes = 20 number_eaten = 7 number_remaining = number_of_grapes - number_eaten number_given = 3 number_for_container = 0.25 * number_remaining result = number_remaining - number_given - number_for_container return result
A carnival charges $20 per ticket to enter, and also sells tickets for $5 for each ride. If you buy 5 tickets for rides, the 6th ride is free. If Sally spends $75 at the carnival, how many rides did she go on?
def solve() -> int: total_spent = 75 rides_bought = 0 rides_used = 0 while total_spent >= 5: if rides_bought == 5: rides_bought = 0 continue if total_spent >= 20: total_spent -= 20 else: total_spent -= 5 rides_bought += 1 ...
A rectangular area is measured to have a length of 18 meters and a width of 7 meters. What is the total area of this rectangular area?
def solve() -> int: length = 18 width = 7 area = length * width result = area return result
Marcus went to the park and found 10 pine cones and 56 leaves. Out of those 56 leaves, three-quarters of them were brown. Out of the 10 pine cones, 4 of them were cracked. How many more brown leaves were there than cracked pine cones?
def solve() -> int: pine_cones = 10 leaves = 56 brown_leaves = leaves * 3/4 cracked_pine_cones = 4 brown_leaves - cracked_pine_cones result = brown_leaves - cracked_pine_cones return result
The increase in the number of customers at the restaurant was due to the addition of new dishes in the menu. If there were 100 customers daily before the addition, how many customers are there now after the introduction of the new dishes? In 12 years, Sarah will be three times as old as her sister Jackie. If Sarah's ag...
def solve() -> int: customers_before = 100 increase = 0.25 customers_now = customers_before + (increase * customers_before) sarah_in_12_years = 27 + 12 jackie_in_12_years = sarah_in_12_years / 3 jackie_now = jackie_in_12_years - 12 result = jackie_now r...
Lucas has 12 stickers to trade with his friends. He wants to trade 3 stickers with Matt, 4 stickers with Lily, and 5 stickers with Jake. However, each friend has a different value for each sticker. Matt values each sticker as 2 candies, Lily values each sticker as 3 candies, and Jake values each sticker as 4 candies. H...
def solve() -> int: stickers = 12 stickers_matt = 3 stickers_lily = 4 stickers_jake = 5 value_matt = 2 value_lily = 3 value_jake = 4 candies_matt = stickers_matt * value_matt candies_lily = stickers_lily * value_lily candies_jake = stickers_jake * value_jake candies...
Karen has 24 pieces of candy. She gives 1/5 of them to Mark and 1/4 of the remaining to Laura. How much candy do they each get?
def solve() -> int: candy_karen = 24 candy_mark = candy_karen/5 candy_laura = (candy_karen - candy_mark)/4 candy_karen = candy_karen - candy_mark - candy_laura result = candy_mark, candy_laura, candy_karen return result
Matthew is building a birdhouse and needs 2 pieces of wood for every 3 nails. If he buys an extra 40 nails for a future project, how many pieces of wood and nails did Matthew end up buying in total for the month?
def solve() -> int: wood_per_nail = 2/3 extra_nails = 40 total_nails = extra_nails + (3 * 4) total_wood = total_nails * wood_per_nail result = f'{total_nails} nails and {total_wood} pieces of wood' return result
Emma went shopping and bought a dress for $49.99, shoes for $29.99 and a purse for $19.99. The store had a 15% discount for all purchases over $100. How much did she pay for her items?
def solve() -> int: total_items = 49.99 + 29.99 + 19.99 if total_items > 100: discount = 0.15 * total_items total_cost = total_items - discount else: total_cost = total_items result = total_cost return result
In a game, 15 people started with 45 coins each. If 2 coins are lost by each person during the first round, and 4 more coins are lost each round for the next two rounds, how many coins does each person have at the end?
def solve() -> int: initial_coins = 45 coins_lost_in_round_1 = 2 coins_lost_in_round_2 = 4 coins_lost_in_round_3 = 4 total_coins_lost = coins_lost_in_round_1 * 15 + coins_lost_in_round_2 * 15 + coins_lost_in_round_3 * 15 remaining_coins = initial_coins * 15 - total_coins_lost ...
In a candy jar, there are 20 pieces of chocolates, 15 pieces of lollipops and 10 pieces of chewing gums. If a piece of candy is taken at random from the jar, what is the probability of it being a lollipop?
def solve() -> int: total_candies = 20 + 15 + 10 lollipops = 15 probability = lollipops / total_candies result = probability return result
Lily's cousin hires her to babysit and do some housekeeping. Babysitting takes 2 hours and pays $30. If Lily wants to make $40/hour working for her cousin, and housekeeping takes 1 hour, how much should Lily charge (in total, not per hour) for housekeeping?
def solve() -> int: babysitting_hours = 2 babysitting_pay = 30 desired_hourly_pay = 40 housekeeping_hours = 1 total_pay = (babysitting_hours * babysitting_pay) + (housekeeping_hours * desired_hourly_pay) result = total_pay return result
A fruit basket contains only oranges and lemons. The weight of the basket and the oranges is 500 grams. The weight of the basket and the lemons is 750 grams. What is the weight of the basket and how much do the oranges and lemons weigh combined?
def solve() -> int: total_weight1 = 500 total_weight2 = 750 weight_oranges = (total_weight2 - total_weight1) / 2 weight_lemons = weight_oranges weight_basket = total_weight1 - weight_oranges - weight_lemons result = (weight_basket, weight_oranges + weight_lemons) return result
There are 25 students in a class, and each student needs 3 pencils. Pencils come in packs of 12. How many packs of pencils should the teacher buy?
def solve() -> int: num_students = 25 num_pencils = 3 pencils_per_pack = 12 total_pencils_needed = num_students * num_pencils num_packs = total_pencils_needed // pencils_per_pack result = num_packs return result
If a school has four times as many teachers as students, and there are 25 students, how many teachers are there?
def solve() -> int: students = 25 teachers = 4 * students result = teachers return result
Wendy has 3 bags of apples. 1 bag has 12 apples inside, the second bag has 15 apples inside, and the third bag has 18 apples inside. How many apples does she have?
def solve() -> int: bag1 = 12 bag2 = 15 bag3 = 18 total_apples = bag1 + bag2 + bag3 result = total_apples return result
Daniel had 1 burger, 2 fries, and 1 soda for dinner. Today he plans to eat 2 more burgers than yesterday, double the number of fries, and half as many sodas as the total number of burgers and fries he will have. How many fast food items has Daniel eaten in total?
def solve() -> int: yesterday_burgers = 1 yesterday_fries = 2 yesterday_sodas = 1 today_burgers = yesterday_burgers + 2 today_fries = yesterday_fries * 2 total_burgers_fries = today_burgers + today_fries today_sodas = total_burgers_fries / 2 total_items = yesterday_burgers + ye...
Nina sells cakes and charges $6 per slice. Last month she sold 120 slices and 10 customers each gave her a $2 tip. How many dollars did Nina earn selling cakes last month?
def solve() -> int: cake_sales = 6 * 120 tips = 2 * 10 earnings = cake_sales + tips result = earnings return result
A rectangle has a length that is 6 more than its width. The area of the rectangle is 84 square units. What is the length of the rectangle?
def solve() -> int: area = 84 width = (area / 2) ** 0.5 length = width + 6 result = length return result
There are 50 markets in a city, and this is 25% of the total markets. If 80% of the markets are grocery stores, how many grocery stores are there?
def solve() -> int: total_markets = 50 percentage_of_markets = 25 grocery_stores_percentage = 80 total_markets = (total_markets * 100) / percentage_of_markets grocery_stores = (total_markets * grocery_stores_percentage) / 100 result = grocery_stores return result
Student: In a school, there are 500 students and the ratio of boys to girls is 2:3. How many boys are in the school?
def solve() -> int: num_students = 500 boy_girl_ratio = 2/3 num_boys = num_students * boy_girl_ratio result = int(num_boys) return result
Questions: 1. Stephanie spends $200 on an umbrella. If the price increases by 15%, how much will she need to pay for the umbrella next time?
def solve() -> int: price = 200 increase_percent = 15 x = increase_percent/100 change = price * x new_price = price + change result = new_price return result
Alice has 15 candies. She eats 4 candies and shares the rest equally with Bob and Carol. How many candies does each of them have now?
def solve() -> int: alice = 15 alice = alice - 4 bob = alice / 2 carol = alice / 2 total = alice + bob + carol result = total return result
A football team scored 45 points in the first half of their game, but only scored 10 points in the second half. What was the difference in points scored between the two halves?
def solve() -> int: result = 45 - 10 return result
If a car travels at a speed of 60 miles per hour for 4 hours, how many miles does it travel in total?
def solve() -> int: speed = 60 hours = 4 distance = speed * hours result = distance return result
A company produces 1200 pens in a day. If they want to increase their production to 1500 pens a day, by what percentage do they need to increase their production?
def solve() -> int: oldproduction = 1200 newproduction = 1500 percentageincrease = (newproduction - oldproduction) / oldproduction result = f'<<<{percentageincrease}>>>' result = percentageincrease return result
If Mary spent 9 hours more than thrice the time that her daughter spent on homework, and they spent a total of 15 hours on homework, how many hours did Mary's daughter spend?
def solve() -> int: mary_extra_hours = 9 total_hours = 15 mary_hours = (total_hours - mary_extra_hours) / 4 daughter_hours = total_hours - mary_hours result = daughter_hours return result
The ratio of pizza to burgers sold at a restaurant is 3:4. If a total of 420 meals were sold, how many pizza meals were sold?
def solve() -> int: pizzas_sold = (3/7) * 420 result = pizzas_sold return result
Question X: A coffee shop sells 300 cups of coffee for $5 each. On the next day, they want to attract more customers by offering a 2 for 1 deal. They sell an additional 200 cups of coffee. How much is their total revenue?
def solve() -> int: num_cups_day1 = 300 unit_price_day1 = 5 num_cups_discount = 200 num_cups_no_discount = num_cups_day1 - num_cups_discount unit_price_discounted = unit_price_day1 / 2 revenue_no_discount = num_cups_no_discount * unit_price_day1 revenue_discount = num_cups_discount * unit_pr...
Amy and her brother collect stamps every month. Last month, Amy had 120 stamps and her brother had 80 stamps. This month, Amy has 150 stamps and her brother has 100 stamps. What is the percent increase in the total number of stamps they have?
def solve() -> int: total_last = 120 + 80 total_this = 150 + 100 total_increase = (total_this - total_last) / total_last * 100 result = total_increase return result
7. Nora purchases 600 books each year. If she has 7500 books now, how many years ago did she start purchasing books?
def solve() -> int: books_in_collection = 7500 books_purchased_per_year = 600 years_taken = books_in_collection / books_purchased_per_year result = years_taken return result
A train has a seating capacity of 500 passengers. If there are 8 compartments with an equal number of seats, how many more seats can go in one compartment, if one compartment already has 24 passengers in it?
def solve() -> int: total_capacity = 500 num_compartments = 8 passengers_in_one_compartment = 24 seats_in_one_compartment = total_capacity / num_compartments seats_available_in_one_compartment = seats_in_one_compartment - passengers_in_one_compartment result = seats_available_in_o...
A car rental company charges $30 a day and $0.20 per mile. Joe rented a car for 3 days and drove 250 miles. What was the total cost of his rental?
def solve() -> int: daily_rental_cost = 30 num_days = 3 mileage_cost = 0.2 num_miles = 250 total_rental_cost = (daily_rental_cost * num_days) + (mileage_cost * num_miles) result = total_rental_cost return result
Student: Gloria went to a pet store, she bought 6 birds and 8 rodents. If 3/4 of the birds were canaries, how many canaries did she buy?
def solve() -> int: birds = 6 rodents = 8 canaries = birds * 3/4 result = canaries return result
A school is organizing a trip. The cost of each ticket is $20. If the school orders more than 50 tickets, they will get a 10% discount. How much will the school pay if they order 60 tickets?
def solve() -> int: ticket_cost = 20 ticket_count = 60 if ticket_count > 50: ticket_cost -= 0.1*ticket_cost total_trip_cost = ticket_cost*ticket_count result = total_trip_cost return result
Juanita has 19 cherry pies. If every cherry pie can be easily divided into thirds and every third of a cherry pie can be split into 4 samples, how many people can taste Juanita's cherry pies if she splits them all into samples?
def solve() -> int: pies = 19 thirds = pies * 3 samples = thirds * 4 result = samples return result
A store made a profit of $8000 last year. This year, they made a profit that was 25% less. How much profit did they make this year?
def solve() -> int: profit_last_year = 8000 profit_this_year = profit_last_year * 0.75 result = profit_this_year return result
A rectangular garden has a length of 12 meters and a width of 8 meters. A fence is built around the garden with a height of 2 meters. How much wood is needed to build the fence if each meter of wood costs $5?
def solve() -> int: wood = 80 * 5 result = wood return result
Mary traveled 150 km in 3 hours. What was her speed in km/h?
def solve() -> int: distance = 150 time = 3 speed = distance / time result = speed return result
A rectangular garden is 12 meters by 8 meters. If we want to put a fence around it, how many meters of fence do we need?
def solve() -> int: length = 12 width = 8 fence = (2*length)+(2*width) result = fence return result
A store is having a 20% off sale. If a $60 item is purchased during the sale, what is the sale price of the item?
def solve() -> int: original_price = 60 discount = 0.2 sale_price = original_price*(1-discount) result = sale_price return result
Student: If Albert walks 2 km in 25 minutes, what is his speed in km/h?
def solve() -> int: distance = 2 time = 25 time_in_hours = time / 60 speed = distance / time_in_hours result = speed return result
A person invested $10,000 with 8% interest for three years. How much will the person get at the end of three years using the simple interest formula?
def solve() -> int: principal = 10000 rate = 0.08 time = 3 simple_interest = principal * rate * time total_amount = principal + simple_interest result = total_amount return result
Lily burns 250 calories per hour on the treadmill, with each calorie equating to 1/6 of a gram of fat. How much fat does Lily burn in 5 hours?
def solve() -> int: calories_per_hour = 250 calories_in_5_hours = calories_per_hour * 5 fat_grams_per_calorie = 1/6 fat_grams_burned = calories_in_5_hours * fat_grams_per_calorie result = fat_grams_burned return result
At her jewelry store, Mia has a collection of 70 necklaces where she rewards three to her customers for every 25 they buy. If she had 20 customers that day, a quarter of whom bought 30 necklaces each, calculate the number of necklaces remaining in the rewards collection.
def solve() -> int: necklaces = 70 rewarded = 3 customers = 20 bought_30 = customers // 4 total_bought = bought_30 * 30 total_rewarded = (total_bought // 25) * rewarded remaining = necklaces - total_rewarded result = remaining return result
Emily and her two co-workers are planning to split the cost of a project. The project will cost 50% more than what Emily spends on her own projects which is $500. How much can Emily save by working with her co-workers to complete the project instead of working alone?
def solve() -> int: emily_project_cost = 500 project_cost = emily_project_cost * 1.5 savings = emily_project_cost - project_cost result = savings return result
The perimeter of a rectangle is 56 meters. If the length is twice the width, what is the length and width of the rectangle?
def solve() -> int: perimeter = 56 width = perimeter / 10 length = 2 * width result = length, width return result
Matt has 100 stickers. He decides to give away 10% of them to each of his four friends. How many stickers is each friend getting?
def solve() -> int: matts_stickers = 100 friends_count = 4 percentage_share = 10 sticker_count_share = int((matts_stickers * percentage_share)/100) stickers_per_friend = int(sticker_count_share / friends_count) result = stickers_per_friend return result
A jacket costs $80. If it's discounted 20%, what is its new price?
def solve() -> int: original_price = 80 discount_percent = 0.20 discount_amount = discount_percent * original_price new_price = original_price - discount_amount result = new_price return result