question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Luke wants to buy a new guitar. He plans to wash cars for 3 neighbors at $20 per car, sell 2 of his old bikes for $75 each, and work at a gas station for 8 hours at $9 per hour. If his earnings just cover the cost of the guitar, how much does it cost?
def solve() -> int: car_earnings = 3 * 20 bike_earnings = 2 * 75 gas_earnings = 8 * 9 total_earnings = car_earnings + bike_earnings + gas_earnings guitar_cost = total_earnings result = guitar_cost return result
James needs $2000 for his rent, $300 for his internet bill, $250 for his groceries, and $50 for utilities. He wants to save $500 for his new guitar. If he makes $25 per hour at his job, how many hours will James need to work this month? Lena wants to read 1000 pages of a book before the end of the month. She decides to...
def solve() -> int: rent = 2000 internet = 300 groceries = 250 utilities = 50 savings = 500 total_expenses = rent + internet + groceries + utilities + savings goal = 1000 pages_per_day = 50 days_per_week = 5 weeks_elapsed = 3 pages_read = pages_per_day * days_p...
A class of 36 students is divided into 4 groups for a project. Each group has to buy some materials for the project. Group A spends $12, group B spends $15, group C spends $18, and group D spends $10. The teacher gives each group a $5 rebate for their expenses. How much money does the class spend in total for the proje...
def solve() -> int: group_a = 12 group_b = 15 group_c = 18 group_d = 10 total_before = group_a + group_b + group_c + group_d total_rebate = 4 * 5 total_after = total_before - total_rebate result = total_after return result
John has a lemonade stand. He uses 3 fewer than 9 lemons to make each pitcher of lemonade. If John has 36 lemons, how many pitchers of lemonade can he make?
def solve() -> int: lemons_per_pitcher = 9 - 3 total_pitchers = 36 // lemons_per_pitcher result = total_pitchers return result
Maya and her friend Sarah are starting a book club. Maya has 15 books, 1/5 of which are mysteries. Sarah has half as many mysteries as Maya and three times as many romance novels as Maya. How many books in total do they have?
def solve() -> int: mayas_books = 15 mayas_mysteries = mayas_books * 1/5 sarahs_mysteries = mayas_mysteries / 2 sarahs_romance = mayas_books * 3 total_books = mayas_books + sarahs_mysteries + sarahs_romance result = total_books return result
There are two numbers. The first number is 10 more than the second number. Together they add up to 52. What are the two numbers?
def solve() -> int: second_number = (52 - 10) / 2 first_number = second_number + 10 result = first_number + second_number return result
During a bug collecting expedition, Michael found 15 ants and twice as many beetles. If he came across 10 butterflies, how many bugs did he collect in total?
def solve() -> int: ants = 15 beetles = 2 * ants butterflies = 10 total_bugs = ants + beetles + butterflies result = total_bugs return result
A construction worker needs 120 concrete blocks to build a wall. He can carry 4 blocks at a time. How many trips will he need to make to carry all the blocks he needs?
def solve() -> int: blocks_needed = 120 blocks_per_trip = 4 trips_needed = blocks_needed // blocks_per_trip result = trips_needed return result
Matthew baked 36 cupcakes for a party. If he wanted each guest to have 2 cupcakes, how many guests can he have at the party?
def solve() -> int: cupcakes_baked = 36 cupcakes_per_guest = 2 guests = cupcakes_baked // cupcakes_per_guest result = guests return result
There are 23 boys and 17 girls in a class. The teacher wants to form groups of 3 students each. How many such groups are possible?
def solve() -> int: boys = 23 girls = 17 students = boys + girls groups = students // 3 result = groups return result
Paul has a cylindrical container with a radius of 5 cm and height of 10 cm. He fills it up with water up to 2/3rd of its height. If the density of water is 1 g/ml, what is the weight of the water in the container?
def solve() -> int: radius = 5 height = 10 fill_height = height*(2/3) volume = (22/7)*(radius**2)*fill_height weight = volume*1 result = weight return result
Student: The toy store sold 20 more than five times the number of cars as it did of dolls. If the toy store sold 15 dolls, how many cars did it sell?
def solve() -> int: dolls = 15 cars = 5 * (dolls + 20) result = cars return result
5 t-shirts and 3 pairs of jeans cost $95. 2 t-shirts and 1 pair of jeans cost $35. How much does 1 t-shirt cost?
def solve() -> int: from sympy import symbols, Eq, solve x, y = symbols('x y') eq1 = Eq(5*x+3*y, 95) eq2 = Eq(2*x+y, 35) sol = solve((eq1, eq2), (x, y)) result = sol[x]/5 return result
A company produces 1000 units of product D every week. There are 52 weeks in a year. The production cost per unit is $10, and the selling price per unit is $20. How much profit does the company make in one year?
def solve() -> int: profit_per_unit = 20 - 10 profit_per_week = profit_per_unit * 1000 profit_per_year = profit_per_week * 52 result = profit_per_year return result
Student: At the zoo, there were 10 elephants, 8 giraffes, and some monkeys. If the number of monkeys was equal to the product of the number of elephants and the number of giraffes, then what was the total number of animals at the zoo?
def solve() -> int: elephants = 10 giraffes = 8 monkeys = elephants * giraffes total_animals = elephants + giraffes + monkeys result = total_animals return result
Liam wants to buy new video games for his PS4. He spends $40 on each game. He also sells his old games for $20 each. If he has $400, how many new games can he purchase for $40, but still sell his old games for $20 each, before he runs out of money?
def solve() -> int: game_cost = 40 old_game_sell_price = 20 total_money = 400 num_old_games = total_money // old_game_sell_price money_left = total_money - (num_old_games * old_game_sell_price) num_new_games = money_left // game_cost result = num_new_games return resu...
A builder wants to buy a ladder for a project. The ladder costs $145 and there is a 10% tax. What is the total cost?
def solve() -> int: ladder_cost = 145 tax_rate = 0.10 total_cost = ladder_cost * (1 + tax_rate) result = total_cost return result
A restaurant serves 120 meals in one night. Out of those meals, 65 are vegetarian. What percentage of meals served were vegetarian?
def solve() -> int: percentage_vegetarian = (65/120) * 100 result = percentage_vegetarian return result
If a single kabob stick requires 4 cubes of beef, how much beef does Simon need to make 10 kabob sticks?
def solve() -> int: cubes_per_stick = 4 total_sticks = 10 total_cubes = cubes_per_stick * total_sticks result = total_cubes return result
If a group of friends decides to split the bill evenly at a restaurant and the total bill including tax and tip comes out to be $85, and there are 5 people splitting the bill, how much does each person have to pay?
def solve() -> int: subtotal = 85 num_of_people = 5 even_split_amount = subtotal / num_of_people result = even_split_amount return result
Student: On Monday, Harry ran 6 km in 45 minutes. From Tuesday to Thursday, he ran 20% faster than on Monday. Then, on Friday, he ran 25% faster than on Thursday. How long did Harry run in total from Monday to Friday?
def solve() -> int: monday_distance = 6 monday_time = 45 tuesday_to_thursday_distance = monday_distance * 1.2 tuesday_to_thursday_time = monday_time * 0.8 friday_distance = tuesday_to_thursday_distance * 1.25 friday_time = tuesday_to_thursday_time * 0.8 total_distance = monday_distance...
Student: Mia has 5 rabbits and 2 hamsters. She has 12 kg of mixed seeds and nuts. Each rabbit eats 200 g of the mix per day. Each hamster eats 50 g of the mix per day. How many additional kg of the mix does Mia need to buy to feed all of her animals for 21 days?
def solve() -> int: rabbits = 5 hamsters = 2 mix = 12 rabbit_daily_intake = 200 hamster_daily_intake = 50 total_daily_intake = rabbits * rabbit_daily_intake + hamsters * hamster_daily_intake additional_mix = total_daily_intake * 21 / 1000 result = additional_mix return result
Student: Kevin is a baker who makes different kinds of cakes. He needs 200 grams of flour, 150 grams of sugar, and 100 grams of butter for each cake. He has 5 kilograms of flour, 4 kilograms of sugar, and 3 kilograms of butter in his pantry. How many cakes can he make with the ingredients he has?
def solve() -> int: flour_needed = 200 sugar_needed = 150 butter_needed = 100 flour_available = 5000 sugar_available = 4000 butter_available = 3000 cakes_flour = flour_available // flour_needed cakes_sugar = sugar_available // sugar_needed cakes_butter = butter_available // butter_ne...
A store is selling shirts for $15 each and pants for $20 each. If someone buys 3 shirts and 2 pants, how much will they have to pay in total?
def solve() -> int: shirt_price = 15 pants_price = 20 num_shirts = 3 num_pants = 2 total_cost = (num_shirts * shirt_price) + (num_pants * pants_price) result = total_cost return result
A school has 100 students. The number of boys is five times the number of girls. The number of male teachers is two less than half the number of boys. If there are 20 girls, how many male teachers are there?
def solve() -> int: students = 100 girls = 20 boys = 5 * girls male_teachers = (boys / 2) - 2 result = male_teachers return result
An apple tree has 5 fewer apples than a pear tree. Together they have 31 apples. How many apples are on the apple tree?
def solve() -> int: pear_apples = 31 apple_apples = pear_apples - 5 result = apple_apples return result
Emma is knitting scarves for her family. Each skein of yarn has 100 yards, and it's only safe to use 15% of the yarn at one time. If Emma needs to knit 6 scarves, and each scarf requires 800 yards of yarn, how many skeins of yarn does she need to use?
def solve() -> int: skein_yard = 100 safe_percentage = 0.15 scarves_needed = 6 yarn_per_scarf = 800 total_yarn_needed = scarves_needed * yarn_per_scarf total_yarn_needed_with_safety = total_yarn_needed / (1 - safe_percentage) skeins_needed = total_yarn_needed_with_safety / skein_ya...
-Each new question should be different from others and the old question. Here are some possible questions and programs: Kevin has a bag of candies that weighs 600 grams. He gives 20% of the candies to his sister and 15% of the remaining candies to his friend. How many grams of candies does he have left?
def solve() -> int: sister_candies = 600 * 0.2 remaining_candies = 600 - sister_candies friend_candies = remaining_candies * 0.15 final_candies = remaining_candies - friend_candies result = final_candies return result
John is planning a barbecue. He grills 24 hot dog sausages and then cuts each sausage into fifths, before cutting them in half. If he wants to give each guest 2 sausages, how many guests can he invite?
def solve() -> int: sausages = 24 pieces_per_sausage = 5 halves_per_sausage = 2 sausages_per_guest = 2 total_pieces = sausages * pieces_per_sausage total_halves = total_pieces // halves_per_sausage guests = total_halves // sausages_per_guest result = guests return result
Emma puts up a survey of 25 people and finds that 42% of them disagree with the idea of having a school carnival. How many people are in agreement?
def solve() -> int: total_people = 25 people_disagree = 42/100 * total_people people_agree = total_people - people_disagree result = people_agree return result
At a furniture store, Jane saw a 4-seater couch that was selling for $350. There was also a 3-seater couch for $280 and a 2-seater couch for $210. If the store prices the couches by seat, what is the price of a one-seater chair?
def solve() -> int: four_seater_price = 350 three_seater_price = 280 two_seater_price = 210 result = ((four_seater_price - three_seater_price) / (4 - 3)) / 3 return result
Alice has 18 eggs. If she boils 6 eggs, scrambles 4 eggs, and makes an omelette with 2 eggs, what percentage of eggs does she use?
def solve() -> int: boiled = 6 scrambled = 4 omelette = 2 total = 18 used = boiled + scrambled + omelette used_perc = used / total used_perc_perc = round(used_perc * 100, 2) result = used_perc_perc return result
Student: Jim is visiting his aunt, who lives 500 km away. His car has a fuel efficiency of 20 km/L. How many liters of fuel will Jim need for the return trip?
def solve() -> int: distance = 500 efficiency = 20 return_trip = 2 fuel = distance * return_trip / efficiency result = fuel return result
Student: Sarah is baking a cake for John's birthday. The recipe calls for 4 cups of milk and Sarah has 3 cups only. How many more cups of milk does she need to finish the cake?
def solve() -> int: cups_needed = 4 cups_available = 3 difference = cups_needed - cups_available result = difference return result
A basketball team won 80% of their games. If they played 25 games, how many games did they win?
def solve() -> int: total_games = 25 win_percent = 80 wins = total_games * (win_percent / 100) result = wins return result
Ann and Ben take turns rolling a dice. Ann rolls the dice first. If Ann rolls a number less than 4, Ben wins. What is the probability that Ann wins?
def solve() -> int: prob_ann_wins = 0.5 * (1/2 + 1/3 + 1/4) result = prob_ann_wins return result
Emma has a rectangular prism that is 8 inches in height. The length is 3 times its height and the width is 2 times its height. What is the volume of the rectangular prism?
def solve() -> int: height = 8 length = 3 * height width = 2 * height volume = length * width * height result = volume return result
Gavin ate 2/5 of his pizza and put the remaining slices in the box. If the pizza left in the box weighs 900 grams, how many grams of pizza did Gavin eat?
def solve() -> int: pizza_weight = 1500 fraction_eaten = 2/5 weight_eaten = pizza_weight * fraction_eaten weight_left = pizza_weight - weight_eaten weight_left_in_box = 900 weight_eaten = weight_left - weight_left_in_box result = weight_eaten return result
Student: Doris lives 15 floors below Pascal. Pascal lives above Calvin whose floor number is half the floor number of Doris. Doris lives on the 24th floor. What floor does Pascal live on?
def solve() -> int: floor_doris = 24 floor_calvin = floor_doris / 2 floor_pascal = floor_calvin + 15 result = floor_pascal return result
A circular pizza has a diameter of 16 inches. What is its area in square inches?
def solve() -> int: diameter = 16 radius = diameter / 2 pi = 3.14 area = pi * (radius ** 2) result = area return result
Jake has $500 and wants to split it equally between himself and his two friends. How much money will they each receive?
def solve() -> int: money = 500 num_people = 3 split_money = money / num_people result = split_money return result
Below are some possible questions and python programs: Emma runs 2 kilometers every morning and 3 kilometers every evening. She runs at a constant speed of 10 kilometers per hour. How long does Emma spend running every day?
def solve() -> int: total_distance = 2 + 3 time = total_distance / 10 time = time * 60 result = time return result
Tom spends $30 a week on gas for his car. If gas costs $3 per gallon, how many gallons of gas does he use each week?
def solve() -> int: gallons_of_gas_per_week = 30/3 result = gallons_of_gas_per_week return result
Tom is twice as old as his sister. In 4 years, he will be 3 times older than her. What is the current age of Tom's sister?
def solve() -> int: toms_age = 3 sisters_age = 1 difference = toms_age - sisters_age sisters_age_now = difference*2 result = sisters_age_now return result
If a box of pencils costs $4.50 and there are 12 pencils in the box, what is the cost per pencil?
def solve() -> int: box_cost = 4.50 num_pencils = 12 cost_per_pencil = box_cost / num_pencils result = cost_per_pencil return result
Possible new questions and programs: Lily has four times as many stickers as pens. She has 16 pens. How many total items does she have?
def solve() -> int: stickers = 16 * 4 total_items = stickers + 16 result = total_items return result
Samir has $50.00 to spend at the grocery store. He bought 5 bags of chips that cost $2.29 each, 3 cartons of eggs that cost $1.99 each and 2 gallons of milk that cost $3.50 each. How much money does Samir have left to buy more groceries?
def solve() -> int: chips_cost = 2.29 eggs_cost = 1.99 milk_cost = 3.50 total_spent = 5 * chips_cost + 3 * eggs_cost + 2 * milk_cost starting_amount = 50.00 remaining_balance = starting_amount - total_spent result = remaining_balance return result
A group of chickens are running in a field, each chicken is followed by 3 ducks. If there are 11 chickens in the field, how many animals are running in the field?
def solve() -> int: chickens = 11 ducks = 0 ducks = chickens * 3 total_animals = chickens + ducks result = total_animals return result
Tina's backpack can hold a maximum of 30 pounds of weight. If she adds 1 pound of weight every day, and on average each item she adds weighs 0.5 pounds, how many days will it take for her backpack to reach its limit?
def solve() -> int: max_weight = 30 daily_weight = 1 item_weight = 0.5 available_space = max_weight / item_weight num_items = available_space - daily_weight days_to_fill = num_items / daily_weight result = days_to_fill return result
Twelve more stories were printed than last week. If there were 72 stories printed, how many stories were printed last week?
def solve() -> int: stories = 72 stories_last_week = stories - 12 total_stories = stories + stories_last_week result = total_stories return result
A toy store buys a box of action figures for $60 and plans to sell them for $10 each. If they sell all the action figures, what is the profit?
def solve() -> int: box_cost = 60 num_action_figures = 6 cost_per_action_figure = box_cost/num_action_figures selling_price_per_figure = 10 total_revenue = num_action_figures * selling_price_per_figure total_cost = box_cost profit = total_revenue - total_cost result = profit return r...
An athlete wants to run a total of 10 kilometers. She runs 2 kilometers every day. How many days will it take her to complete the task?
def solve() -> int: total_distance = 10 distance_per_day = 2 days = total_distance / distance_per_day result = days return result
Sophie and Jacob and their 2 dogs are sharing a villa with Lily and Ethan and their 2 cats. If there are 8 paws on the terrace, how many people are not on the terrace?
def solve() -> int: sophie_jacob_dogs = 2 + 2 lily_ethan_cats = 2 + 2 total_paws_on_terrace = 8 total_people_on_terrace = sophie_jacob_dogs + lily_ethan_cats total_people_not_on_terrace = total_people_on_terrace - 4 result = total_people_not_on_terrace return result
A mermaid collects shells from the sea floor. She can swim 15 feet per minute and dives 60 feet deep. She spends 5 minutes at the bottom picking shells. She can fit 20 shells in her bag. How many shells can she collect in one hour?
def solve() -> int: time_to_swim = (60 / 15) * 2 time_at_bottom = 5 time_per_dive = time_to_swim + time_at_bottom dives_per_hour = 60 / time_per_dive shells_per_dive = 20 shells_per_hour = dives_per_hour * shells_per_dive result = shells_per_hour return result
Daniel has a gas tank that is 1/4 full. The tank can hold 60 liters of gas. How many liters of gas does he need to fill it to capacity?
def solve() -> int: capacity = 60 filled = capacity/4 remaining = capacity - filled result = remaining return result
Student: A basket contains 6 apples, 4 oranges, and 3 bananas. If 2 items are selected at random, what is the probability of getting 1 apple and 1 orange?
def solve() -> int: apples = 6 oranges = 4 bananas = 3 total_items = apples + oranges + bananas combinations = apples * oranges probability = combinations / total_items result = probability return result
A recipe needs 3 eggs for every 2 cups of flour. If the recipe calls for 12 cups of flour, how many eggs are needed?
def solve() -> int: total_eggs = 3*(12/2) result = total_eggs return result
Result: 36 If the average of three numbers is 75 and two of the numbers are 69 and 83, what is the third number?
def solve() -> int: average = 75 num1 = 69 num2 = 83 num3 = (average*3) - num1 - num2 result = num3 return result
John wants to start a lawn mowing business. He needs to buy a lawn mower which costs $200. He plans to mow lawns for $30 each, but he also needs to pay for gas which costs $3 for each lawn. How many lawns will John need to mow before he breaks even?
def solve() -> int: lawn_mower_cost = 200 lawn_mowing_price = 30 gas_price_per_lawn = 3 break_even_cost = lawn_mower_cost amount_earned_per_lawn = lawn_mowing_price - gas_price_per_lawn break_even_amount_of_lawns = break_even_cost / amount_earned_per_lawn result = break_even_amount_of_lawns ...
A population of rabbits starts with 5 rabbits and increases by 10% every month for 1 year. How many rabbits will there be after 1 year?
def solve() -> int: rabbits = 5 monthly_growth_rate = 0.10 months = 12 for month in range(months): rabbits += rabbits * monthly_growth_rate result = int(rabbits) return result
Amanda has a 25-gallon aquarium and has filled it with 16 gallons of water. How much more water does Amanda need to fill the tank completely?
def solve() -> int: tank_size = 25 amount_filled = 16 amount_needed = tank_size - amount_filled result = amount_needed return result
If a pizza chef made 3 large pizzas that take 45 minutes to cook each, and another chef made 4 medium pizzas that take 30 minutes to cook each, how many minutes longer did the first chef spend cooking?
def solve() -> int: large_pizzas = 3 large_pizza_time = 45 medium_pizzas = 4 medium_pizza_time = 30 total_time_first_chef = large_pizzas * large_pizza_time total_time_second_chef = medium_pizzas * medium_pizza_time time_difference = total_time_first_chef - total_time_second_chef ...
Six students and four teachers want to divide a $90 fundraiser evenly between them. If each student gets half as much as each teacher, how much does each teacher receive?
def solve() -> int: students = 6 teachers = 4 fundraiser = 90 total_people = students + teachers each_person_share = fundraiser / total_people teacher_share = each_person_share * 2 result = teacher_share return result
Four friends decide to split the cost of a hotel room equally. The cost of the room is $200 and they also have to pay a $30 hotel tax. If one friend pays $75 in all, how much do the other three friends have to pay in total?
def solve() -> int: cost_of_room = 200 hotel_tax = 30 total_cost = cost_of_room + hotel_tax one_friend_paid = 75 total_paid = one_friend_paid * 4 total_friends = 4 total_friends_paid = total_paid - one_friend_paid other_friends_paid = total_friends_paid / 3 result = ot...
A class has 30 students, and each student has 5 notebooks. If 9 students forgot all their notebooks, how many notebooks are left in the class?
def solve() -> int: students = 30 notebooks_per_student = 5 forgot_notebook = 9 total_notebooks = students * notebooks_per_student left_notebooks = total_notebooks - (forgot_notebook * notebooks_per_student) result = left_notebooks return result
John walks 5 blocks north, 3 blocks west, and 10 blocks south. How far is John from the starting point?
def solve() -> int: start = [0,0] north = 5 west = 3 south = 10 x_dist = 0 - west y_dist = north - south distance = (x_dist**2 + y_dist**2)**0.5 result = distance return result
A student pays $8000 in tuition for a year-long course. If the student receives a scholarship for 25% of the tuition and a loan to cover the remaining amount, how much will the monthly loan payment be if the loan has a 5% APR?
def solve() -> int: tuition_cost = 8000 scholarship_percent = 25 scholarship_amount = tuition_cost * (scholarship_percent / 100) tuition_after_scholarship = tuition_cost - scholarship_amount loan_amount = tuition_after_scholarship monthly_interest_rate = 0.05 / 12 num_monthly_payments = 12 ...
If a rectangular yard has a length of 6 meters and an area of 18 square meters, what is the width of the yard?
def solve() -> int: length = 6 area = 18 width = area / length result = width return result
Alice is calculating the cost of gas for her road trip to the beach. Her car gets 33 miles per gallon in the city and 43 miles per gallon on the highway. The distance from her apartment to the beach is 70 city miles and 220 highway miles. If gas costs $3.20 per gallon, how much will Alice need to spend?
def solve() -> int: city_mpg = 33 highway_mpg = 43 city_miles = 70 highway_miles = 220 gas_cost = 3.20 city_gallons = city_miles / city_mpg highway_gallons = highway_miles / highway_mpg total_gallons = city_gallons + highway_gallons total_cost = total_gallons * gas_cost ...
Student: A soccer team has 20 players. If only 11 players are allowed to play at a time, how many players will sit on the bench?
def solve() -> int: players = 20 allowed_to_play = 11 players_on_bench = players - allowed_to_play result = players_on_bench return result
Lisa is counting baseball cards into packs. She has 600 cards and wants to include 12 cards in each pack. If she makes 40 packs, how many cards will be left over?
def solve() -> int: cards = 600 pack_size = 12 num_packs = 40 total_cards = pack_size * num_packs cards_left = cards - total_cards result = cards_left return result
Possible questions and programs are: Lisa has 24 stickers and she wants to share them equally with her friends. If she gives 3 stickers to each friend, how many friends can she share with?
def solve() -> int: stickers = 24 stickers_per_friend = 3 friends = stickers // stickers_per_friend result = friends return result
A baker needs to make 90 cupcakes for an event. If each batch of cupcakes makes 24 cupcakes, how many batches does the baker need to make?
def solve() -> int: num_cupcakes_needed = 90 cupcakes_per_batch = 24 num_batches_needed = num_cupcakes_needed // cupcakes_per_batch + (1 if num_cupcakes_needed % cupcakes_per_batch!= 0 else 0) result = num_batches_needed return result
A book has 350 pages. A reader reads 45 pages in the first hour, 30 pages in the second hour, and 20 pages in the third hour. How long does it take them to finish the entire book?
def solve() -> int: pages_left = 350 - 45 - 30 - 20 hours_left = pages_left / ((45+30+20)/3) result = hours_left return result
Mia measured a 20-meter ribbon into 5 equal parts. She used 3 parts of the ribbon. How many meters of ribbon are not used?
def solve() -> int: ribbon_length = 20 num_parts = 5 used_parts = 3 unused_parts = num_parts - used_parts unused_length = unused_parts * (ribbon_length / num_parts) result = unused_length return result
Matt wants to go to a theme park. It takes him 1 hour to drive there. He spends 3 hours at the park. How long is his trip in total?
def solve() -> int: drive_time = 1 park_time = 3 total_time = drive_time + park_time result = total_time return result
``` Jason has saved money and he wants to donate 1/3 of his savings. He wants to donate $1500. How much money did he save?
def solve() -> int: donation = 1500 percentage_of_donation = 1/3 total_savings = donation / percentage_of_donation result = total_savings return result
It takes 16 minutes for Ava to drive to the supermarket. From the supermarket, she has to walk back to the daycare center and it takes her 10 minutes. When she arrives there, she has been gone from the daycare center 28 minutes altogether. If she had driven to the restaurant first before going to the supermarket, how l...
def solve() -> int: time_to_supermarket = 16 time_to_daycare = 10 total_time_gone = 28 time_to_restaurant = total_time_gone - time_to_supermarket - time_to_daycare result = time_to_restaurant return result
At Sonia's pizzeria, one large pizza can be cut into 8 pieces; if Marco eats 3 pieces, what portion of a pizza can he eat?
def solve() -> int: pieces_eaten = 3 pieces_total = 8 result = pieces_eaten / pieces_total return result
Aria's grandfather lets her go for jogging 4 blocks north, 3 blocks east, 5 blocks west, and 2 blocks south. Her cousin's uncle allows him to play with his basketball for 240 square blocks. How many times greater is the area her cousin can play basketball in compared to Aria's jogging area?
def solve() -> int: blocks_north = 4 blocks_east = 3 blocks_west = 5 blocks_south = 2 aria_jogging_area = (blocks_north + blocks_south) * (blocks_east + blocks_west) cousin_basketball_area = 240 area_ratio = cousin_basketball_area / aria_jogging_area result = area_rat...
David purchased a gaming console for $400 with a discount of 10%. Then he added two games worth $70 each. There was an extra 5% discount offered on his purchase. How much did he pay for everything?
def solve() -> int: original_price = 400 discount = 0.1 console_price = original_price * (1 - discount) game_price = 70 total_game_price = game_price * 2 subtotal = console_price + total_game_price extra_discount = 0.05 total_price = subtotal * (1 - extra_discount) result = total_pri...
The salary of an employee is $5000 per month. If the employee has a tax rate of 25%, what is the take-home pay of the employee?
def solve() -> int: monthly_salary = 5000 tax_rate = 0.25 take_home_pay = monthly_salary - (monthly_salary * tax_rate) result = take_home_pay return result
Emma bought three books that were originally $20, $18, and $25 each. How much money did she save if she got 10% off her purchase?
def solve() -> int: book_1_price = 20 book_2_price = 18 book_3_price = 25 total_price = book_1_price + book_2_price + book_3_price discount_percentage = 0.1 discount_price = discount_percentage * total_price result = discount_price return result
Student: A hotel has 30 rooms. Every room has two adults. Every fifth room has one additional child. If every child costs $10 extra, how much money can the hotel earn in one week?
def solve() -> int: rooms = 30 adults = 2 children = 1 child_cost = 10 week = 7 room_rate = 100 children = rooms // 5 total_cost = room_rate * rooms + child_cost * children total_income = total_cost * week result = total_income return result
Rebecca drives 50km per hour while Emma drives 20% faster. If both of them drive for 5 hours, how far will they travel?
def solve() -> int: rebecca_speed = 50 emma_speed = rebecca_speed*1.2 time = 5 distance_rebecca = rebecca_speed*time distance_emma = emma_speed*time total_distance = distance_rebecca + distance_emma result = total_distance return result
A book is sold for $15 including tax. The tax rate is 5%. What was the book's price without tax?
def solve() -> int: price_tax_incl = 15 tax_rate = 0.05 price_without_tax = price_tax_incl / (1 + tax_rate) result = price_without_tax return result
Charlie planned to bake for four hours but ended up only doing 80% of this time. If he bakes a cake every 40 minutes, how many cakes did he bake in this time?
def solve() -> int: total_time = 4 * 60 actual_time = total_time * 0.8 time_per_cake = 40 cakes_baked = actual_time // time_per_cake result = cakes_baked return result
===================================================================== Here are some possible questions and programs. Note that the programs are not the only way to solve the questions, and there might be different ways to format or write the code. Alice wants to buy some fabric to make curtains for 3 windows in her liv...
def solve() -> int: width = 4 / 3 length = 6 / 3 area = width * length * 2 area = area * 1.1 area = area * 3 cost = area * 12 cost = round(cost, 2) result = cost return result
Here are some possible questions and programs: Maria wanted to buy a new laptop that cost $1200, but she only had $800. She decided to borrow the rest from her brother, who agreed to lend her the money with 5% interest per month. How much did Maria have to pay her brother back after 3 months?
def solve() -> int: principal = 1200 - 800 interest_rate = 5 / 100 amount = round(principal * (1 + interest_rate)**3, 2) result = amount return result
Student: Calvin sold 9 apples at the market. The first 4 apples he sold for $2 each and the remainder he sold for $3 each. How much money did Calvin make from selling all his apples?
def solve() -> int: total_apples = 9 apples_2_dollars = 4 apples_3_dollars = total_apples - apples_2_dollars money_from_2_dollar_apples = apples_2_dollars * 2 money_from_3_dollar_apples = apples_3_dollars * 3 total_money = money_from_2_dollar_apples + money_from_3_dollar_apples result = tota...
A pizza is cut into 8 equal slices. If John eats 3 slices, what fraction of the pizza did he eat?
def solve() -> int: total_slices = 8 num_eaten = 3 fraction_eaten = num_eaten / total_slices result = fraction_eaten return result
A car rental company rents out cars for $50 per day. If a customer keeps the car for more than 7 days, they receive a 10% discount on the entire rental. If a customer rents a car for 10 days, how much do they pay?
def solve() -> int: daily_rental_price = 50 days_rented = 10 if days_rented > 7: total_price = (days_rented * daily_rental_price) * 0.9 else: total_price = days_rented * daily_rental_price result = total_price return result
A company wants to hire 50 employees in the next year. If they have hired 15 employees so far, how many employees do they need to hire in the next 6 months to meet their goal? If John can jog twice as fast as James can walk, and Lily can run three times as fast as James can walk, but John can only walk half as fast as ...
def solve() -> int: total_employees = 50 hired_employees = 15 months = 6 james_walk_speed = 2 employees_needed = total_employees - hired_employees employees_needed_in_6_months = employees_needed / 12 * months john_jog_speed = james_walk_speed * 2 result = employees_ne...
- Brian collected 15 cans of soda for a recycling project. He decided to trade every 3 cans for 1 bottle of juice at a nearby store. He then gave half of the bottles of juice to his friends and drank 2 bottles himself. How many bottles of juice did he have left?
def solve() -> int: bottles = 15 // 3 given = bottles // 2 left = bottles - given - 2 result = left return result
A university has 8000 students. Out of them, 60% are females. Out of the remaining, 40% are science majors. How many male non-science majors are in the university?
def solve() -> int: t = 8000 fp = 0.6 mp = 0.4 sp = 0.4 fs = t * fp ms = t - fs sms = ms * sp osm = ms - sms fms = osm/2 result = fms return result
Mark has 10 apples, George has 5 times as many apples as Mark. Together they had 57 apples. How many apples did George have?
def solve() -> int: George_Apples = 10 George_Apples = George_Apples * 5 total_apples = George_Apples + 10 result = George_Apples return result
Leo and Sarah both work in a corporate. 5 years ago, Sarah had 6 times as much experience as Leo. Now, he has one-fourth as much experience as Leo. How many years of experience does Leo have now?
def solve() -> int: x = 5 * 6 y = x + 5 result = y / 5 return result
A theme park sells 5,000 tickets each day for $50 each. In the off-season, the park is closed for two weeks. How much potential revenue did the theme park lose during this time?
def solve() -> int: tickets_sold_per_day = 5000 ticket_price = 50 days_closed = 14 revenue_lost = tickets_sold_per_day * ticket_price * days_closed result = revenue_lost return result
A car traveled 250 miles in 5 hours. If the car drove at a constant speed for the entire time, what was its speed in miles per hour?
def solve() -> int: distance = 250 time = 5 speed = distance/time result = speed return result
Q6: Nakia, Kiara, and Maya have a total of 370 marble. Nakia has 15 fewer than double the marbles that Kiara has. Kiara has 5 more than triple the number of marbles that Maya has. How many marbles does Maya have?
def solve() -> int: nakia = 0 kiara = 0 maya = 0 result = 345 / 5 return result