question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
After 15% of the students in a class failed a test, 10 more students in the class passed the test. If the class initially had 45 students, how many students passed the test?
def solve() -> int: total_students = 45 failed_students = 0 passed_students = 0 failed_students = total_students * 0.15 passed_students = total_students - failed_students + 10 result = passed_students return result
Student: A car travels 360 miles in 6 hours. What is the average speed of the car in miles per hour?
def solve() -> int: distance = 360 time = 6 speed = distance / time result = speed return result
Bob runs 3 miles in 25 minutes. He wants to increase his speed to be able to run 4 miles in 30 minutes. How much faster must he run per mile?
def solve() -> int: distance1 = 3 time1 = 25 / 60 rate1 = distance1 / time1 distance2 = 4 time2 = 30 / 60 rate2 = distance2 / time2 rate_increase_per_mile = rate2 - rate1 / (distance2 - distance1) result = rate_increase_per_mile return result
If a bag of chips weighs 10 ounces and there are 5 bags in a box, how many ounces of chips are in the box?
def solve() -> int: weight_per_bag = 10 bags_per_box = 5 total_weight = weight_per_bag * bags_per_box result = total_weight return result
John has a house with two televisions and an air conditioner. If one of the televisions consumes power worth $30 in a month, and the other television consumes power at half that rate, and the air conditioner uses power worth $120 in a month, what is the total amount John pays for the power used by these gadgets in a mo...
def solve() -> int: tv1_power = 30 tv2_power = tv1_power / 2 ac_power = 120 total_power_cost = tv1_power + tv2_power + ac_power result = total_power_cost return result
Sarah needs to read a 600-page textbook in a week. She's already on page 130 and was on page 80 an hour ago. If she reads steadily, how long will it take her to finish the book?
def solve() -> int: total_pages = 600 current_page = 130 previous_page = 80 pages_left = total_pages - current_page pages_read = current_page - previous_page time_left = 7 * 24 pages_per_hour = pages_read hours_to_finish = pages_left / pages_per_hour time_left_in_hours = time_...
Henry loves to read. He read a book that had 500 pages. Then he read two books that had half as many pages as the first book. He finished by reading a book that had 200 more pages than the first book. What was the average number of pages in the books that Henry read?
def solve() -> int: book1 = 500 book2 = book1 / 2 book3 = book1 / 2 book4 = book1 + 200 total_pages = book1 + book2 + book3 + book4 num_books = 4 average_pages = total_pages / num_books result = average_pages return result
Emma has 50 candies. If she distributes them equally among her 5 friends, how many candies does each friend get?
def solve() -> int: emma_candies = 50 num_friends = 5 candies_per_friend = emma_candies / num_friends result = candies_per_friend return result
Student: Dana drove at a speed of 72 miles per hour for 5 hours and 37 minutes. How many miles did she travel?
def solve() -> int: time = 5 + 37 / 60 distance = 72 * time result = round(distance) return result
Julia found 40 mushrooms in the forest. She noticed that 2/5 of them were small and the rest were large. How many large mushrooms did Julia find?
def solve() -> int: small_mushrooms = 40 * (2/5) large_mushrooms = 40 - small_mushrooms total_mushrooms = small_mushrooms + large_mushrooms result = round(large_mushrooms) return result
Tom is buying apples for a class of 25 students and wants each student to have 5 apples. If each bag contains 16 apples, how many bags should Tom buy?
def solve() -> int: students = 25 apples_per_student = 5 apples_needed = students * apples_per_student apples_per_bag = 16 bags_needed = apples_needed / apples_per_bag result = bags_needed return result
A bike shop sells bicycles at a profit of 20% above the cost. If a bike costs $200, how much will they sell it for? And if the shop sells 15 bikes per month, how much profit will they make in a month?
def solve() -> int: cost = 200 profit_percentage = 0.2 selling_price = cost * (1 + profit_percentage) num_bikes_sold = 15 total_profit = (selling_price - cost) * num_bikes_sold result = total_profit return result
Student: John earns $12.5 per hour. He worked for 8 hours on Monday and 6.5 hours on Tuesday, how much did he earn in two days?
def solve() -> int: hourly_wage = 12.5 hours_worked_monday = 8 hours_worked_tuesday = 6.5 total_earned = hourly_wage * (hours_worked_monday + hours_worked_tuesday) result = total_earned return result
Peter gives 20% of his money to his friend and splits the rest 50/50 with his brother. If Peter gives his friend $1,500, how much money did he have originally?
def solve() -> int: moneyPeterHas = 1500 friendReceives = moneyPeterHas*0.2 brothersReceive = (moneyPeterHas-friendReceives)/2 result = moneyPeterHas+friendReceives+brothersReceive return result
Before she donated one, Philanthropist Gomez had 8 times as much money as Entrepreneur Chen. If Entrepreneur Chen had $100, how much money does Philanthropist Gomez have now?
def solve() -> int: entrepreneur_money = 100 gomez_money = 8 * entrepreneur_money result = gomez_money return result
Miles borrowed $800 from the bank to pay his credit card bill. The annual interest rate is 5% and he has to pay it all back in 6 months. How much interest will he have to pay in total?
def solve() -> int: principal = 800 annual_rate = 0.05 time_in_months = 6 monthly_rate = annual_rate / 12 interest = principal * monthly_rate * time_in_months result = round(interest, 2) return result
Aaron is making a sandwich. He spent $2 on bread, $3 on cheese, $4 on turkey and $1 on lettuce. If he makes 3 sandwiches, what is the total cost of the ingredients?
def solve() -> int: bread_cost = 2 cheese_cost = 3 turkey_cost = 4 lettuce_cost = 1 num_sandwiches = 3 total_cost = (bread_cost + cheese_cost + turkey_cost + lettuce_cost) * num_sandwiches result = total_cost return result
Leo paints wooden signs. For each sign, he uses 1/2 pint of red paint, 1/3 pint of blue paint and 1/6 pint of yellow paint. If he paints 2 more than 8 signs, what will be the total amount of paint he used in quarts?
def solve() -> int: red_paint_in_quarts = (1/2) * (1/2) blue_paint_in_quarts = (1/3) * (1/2) yellow_paint_in_quarts = (1/6) * (1/2) num_signs = 8 + 2 total_red_paint = red_paint_in_quarts * num_signs total_blue_paint = blue_paint_in_quarts * num_signs total_yellow_paint = yellow_pa...
In a milk drinking contest, Sarah drank 1 liter of milk in 90 seconds while Jack took 120 seconds to finish the same amount. If the next contestant, Nancy, can drink twice as fast as Sarah, how long would it take her to drink 3 liters of milk?
def solve() -> int: sarah_milk = 1 sarah_time = 90 jack_milk = 1 jack_time = 120 nancy_milk = 3 nancy_time = (sarah_time * sarah_milk * nancy_milk) / (sarah_milk * 2) result = nancy_time return result
Andrew has 120 baseball cards. He loses a third of his cards to his best friend. He then buys 15 new cards. Finally, he trades 40 cards for new cards. How many baseball cards does he have now?
def solve() -> int: cards = 120 cards = cards - cards/3 cards = cards + 15 cards = cards - 40 result = cards return result
A school has a total of 800 students, of which 56% are girls. How many boys are there in the school?
def solve() -> int: girls = 0.56 * 800 boys = 800 - girls result = boys return result
A rectangular garden is 12 meters wide and 16 meters long. If a 1-meter-wide path is built inside the garden along the entire perimeter, what is the area of the path in square meters?
def solve() -> int: width = 12 length = 16 inner_width = width - 2 inner_length = length - 2 inner_area = inner_width * inner_length path_width = 1 path_area = (2 * width + 2 * length - 4) * path_width total_area = path_area result = total_area return result
Sarah has 16 ribbons. She uses a third of them to decorate her room. Then she uses a fourth of the remaining ribbons to decorate her dog’s collar. She has 6 ribbons left. How many ribbons did she use?
def solve() -> int: ribbons_start = 16 ribbons_after_room = ribbons_start - (ribbons_start//3) ribbons_after_dog = ribbons_after_room - (ribbons_after_room//4) ribbons_used = ribbons_start - ribbons_after_dog - 6 result = ribbons_used return result
A truck has sacks of maize and wheat flour in a ratio of 5:7 respectively whereby the total number of sacks is 180. If they lose 15 sacks of maize, how many sacks of wheat flour remain?
def solve() -> int: maize_ratio = 5 wheat_ratio = 7 total_sacks = 180 maize_sacks = (maize_ratio / (maize_ratio + wheat_ratio)) * total_sacks wheat_sacks = (wheat_ratio / (maize_ratio + wheat_ratio)) * total_sacks maize_sacks -= 15 wheat_sacks_remain = wheat_sacks * (maize_sacks + ...
Michael wants to make fresh orange juice with all the oranges in his backyard. He will keep squeezing glasses until he uses up all the oranges. Each glass must contain 4 ounces of juice. Michael has 80 oranges. How many total ounces of orange juice will he drink?
def solve() -> int: oranges = 80 juice_per_orange = 3 total_juice = oranges * juice_per_orange juice_per_glass = 4 num_glasses = total_juice // juice_per_glass total_drink = num_glasses * juice_per_glass result = total_drink return result
A recipe for a cake calls for 1 1/2 cups of sugar and 2/3 cup of butter. If the recipe is doubled, how much sugar and butter will be needed?
def solve() -> int: sugar = 1.5 butter = 2/3 double_sugar = sugar*2 double_butter = butter*2 result = (double_sugar, double_butter) return result
Susan leaves her house at 7:45 am to go to work. She needs 45 minutes to get ready and 15 minutes to walk to the bus stop. After work, she goes to the park to play basketball with her friends, which takes 1 hour and 15 minutes, and then goes grocery shopping, which takes her 30 minutes. If she wants to go to bed at 11:...
def solve() -> int: total_time = 15 + 45 + 75 + 30 + 60*15 bed_time = 23*60 arrival_time = 7*60 + 45 + total_time time_left = bed_time - arrival_time result = time_left return result
arah buys 5 chocolate bars for $2 each and sells them for $5 each. How much profit does she make?
def solve() -> int: num_bars = 5 cost_per_bar = 2 sell_per_bar = 5 total_cost = num_bars * cost_per_bar total_sell = num_bars * sell_per_bar profit = total_sell - total_cost result = profit return result
A restaurant is offering a lunch special that includes a sandwich and drink for $10.00. If a customer orders the lunch special and adds a $3.50 salad, what is the total cost of the meal before tax and tip?
def solve() -> int: lunch_special_price = 10.00 salad_price = 3.50 total_cost = lunch_special_price + salad_price result = total_cost return result
Garrick came over to Peter's house and bought 8 apples, each costing $3. How much did Garrick spend in total?
def solve() -> int: cost_per_apple = 3 number_of_apples = 8 result = cost_per_apple * number_of_apples return result
Henry has 38 people on his contact list. He has half as many neighbors as out of town friends and twice as many out of town friends as church friends. How many church friends does Henry have on his contact list?
def solve() -> int: neighbors = 0 out_of_town_friends = 0 church_friends = 0 total_contacts = 38 neighbors = total_contacts / 4 out_of_town_friends = neighbors * 2 church_friends = out_of_town_friends / 2 result = church_friends return result
The sum of three consecutive even integers is 186, what is the smallest of the three integers?
def solve() -> int: n = int((186/3)-1) result = n*2 return result
Maya bought a box of 35 markers for $105. If all the markers sell at the same price, how much was each marker?
def solve() -> int: number_of_markers = 35 total_price = 105 price_of_each_marker = total_price / number_of_markers result = price_of_each_marker return result
A bus travels from town A to town B at 50 mph and then returns to town A at 60 mph. If the distance between the towns is 100 miles, what is the average speed of the bus for the whole trip?
def solve() -> int: average_speed = (2 * 50 * 60) / (50 + 60) result = average_speed return result
A pizza has 8 slices. If you eat 3 slices, what percentage of the pizza have you eaten?
def solve() -> int: total_slices = 8 slices_eaten = 3 percent_eaten = (slices_eaten / total_slices) * 100 result = percent_eaten return result
Mr. Patel had 75 crayons in his art box. He bought new packages of crayons that have 12 crayons in each package. Now, he has 171 crayons. How many packages of crayons did Mr. Patel buy?
def solve() -> int: art_box = 75 total_crayons = 171 crayons_per_package = 12 bought_crayons = total_crayons - art_box packages_bought = bought_crayons / crayons_per_package result = packages_bought return result
Thirty seven donuts are cut into halves. If 3/4 of the halves are consumed, how many halves are left?
def solve() -> int: total_donuts = 37 number_of_halves = total_donuts * 2 percentage_consumed = 3/4 halves_consumed = number_of_halves * percentage_consumed halves_remaining = number_of_halves - halves_consumed result = int(halves_remaining) return result
Brett bought 40 bags of chips for $10 per bag. He sold them for $2 each during a movie marathon and earned $60 in profit. How many bags of chips did he manage to sell?
def solve() -> int: bags_of_chips = 40 cost_per_bag = 10 selling_price_per_bag = 2 profit = 60 total_cost = bags_of_chips * cost_per_bag total_revenue = total_cost + profit bags_sold = (total_revenue - total_cost) / (selling_price_per_bag - cost_per_bag) result = bags_sold ...
A rectangular swimming pool is 12 feet long and 8 feet wide. The pool is being drained and refilled. It takes 20 minutes to drain the pool and 30 minutes to fill it up. If the water used to refill the pool costs $0.10 per gallon and a gallon costs $0.005 if you recycle the water, how much can you save using recycled wa...
def solve() -> int: poolLength = 12 poolWidth = 8 poolDepth = 6 waterCost = 0.10 timeToDrain = 20/60.0 timeToFill = 30/60.0 recycledCost = 0.005 gallonsInPool = poolLength*poolWidth*poolDepth*7.5 waterSaved = (timeToFill/(timeToFill+timeToDrain))*gallonsInPool costsWithRecycling ...
Student: Jack has 7 marbles and he loses 3 of them. How many marbles does he have now?
def solve() -> int: marbles = 7 lost = 3 marbles = marbles - lost result = marbles return result
At the carnival, there were 60 people waiting in line for the Ferris wheel. After 15 minutes, 25 more people joined in. One hour later, the number of people in line doubled, but only 130 people ended up taking a ride. How many people left the line before they could ride the Ferris wheel?
def solve() -> int: people_in_line = 60 time_passed = 15 people_joined = 25 people_in_line += people_joined time_passed += 60 people_in_line *= 2 people_riding = 130 people_left = people_in_line - people_riding result = people_left return result
Emma is baking cupcakes for a school fair. She made 12 cupcakes with chocolate frosting and three times as many cupcakes with vanilla frosting. Emma also made as many cupcakes with strawberry frosting as the quotient of cupcakes with chocolate and vanilla frosting. The remaining cupcakes in her oven represent 20% of th...
def solve() -> int: chocolate = 12 vanilla = 3 * chocolate strawberry = chocolate / vanilla remaining = 0.2 * (chocolate + vanilla + strawberry) total = chocolate + vanilla + strawberry + remaining result = total return result
Michael is making a sandwich. He uses 2 slices of bread, 100 g of ham, 50 g of cheese, 2 teaspoons of mayonnaise, and four times the amount of mustard as mayonnaise. What percentage of the sandwich is ham, rounded to the nearest integer?
def solve() -> int: bread_slices = 2 ham = 100 cheese = 50 mayonnaise = 2 mustard = 4 * mayonnaise total_weight = bread_slices + ham + cheese + mayonnaise + mustard ham_percentage = (ham / total_weight) * 100 rounded_ham_percentage = round(ham_percentage) result = rounded_h...
Ben is painting his fence. He needs 2 gallons of paint to cover 100 square feet. A quart of paint costs $5 and covers 25 square feet, and a gallon of paint costs $15 and covers 100 square feet. When he is done painting his fence, he has no use for paint and so he will throw away whatever is left. How much does he spend...
def solve() -> int: total_paint = 2 * 3 cost_per_gallon_quart = 5 * 4 cost_per_gallon_gallon = 15 if cost_per_gallon_quart < cost_per_gallon_gallon: paint_container_size = 0.25 paint_container_cost = 5 else: paint_container_size = 1 paint_container_cost = 15 pain...
Result: 165 Maria has solved 10 math problems on Monday, 15 on Tuesday, 20 on Wednesday, and 25 on Thursday. Her cousin, Sofia, has solved four times as many problems as Maria. How many problems did Sofia solve?
def solve() -> int: maria_total = 10 + 15 + 20 + 25 sofia_total = maria_total * 4 result = sofia_total return result
A library has 5000 books. If 40% of the books are fiction and the rest are non-fiction, how many non-fiction books are there?
def solve() -> int: total_books = 5000 percent_of_fiction_books = 40 number_of_fiction_books = total_books*(percent_of_fiction_books/100) number_of_non_fiction_books = total_books - number_of_fiction_books result = number_of_non_fiction_books return result
Student: Michael wants to calculate the average height of his family. His father is 185 cm tall, his mother is 165 cm tall, his older brother is 183 cm tall, his younger sister is 155 cm tall and Michael himself is 175 cm tall. What is the average height of Michael's family?
def solve() -> int: father = 185 mother = 165 brother = 183 sister = 155 michael = 175 total_height = father + mother + brother + sister + michael number_of_members = 5 average_height = total_height / number_of_members result = average_height return result
Adam went shopping at the grocery store. On the first day, he bought 3 items. On the second day, he bought 4 items. On the third day, he bought the average of the items he bought the first two days. How many items did Adam buy on the third day?
def solve() -> int: items_first_day = 3 items_second_day = 4 average_items = (items_first_day + items_second_day) / 2 result = average_items return result
Student: Sarah has $500. She wants to spend half of it on a dress and split the remaining between a book and a haircut in ratio 3:2. How much money does she spend on the book?
def solve() -> int: money = 500 dress = money / 2 remaining = money - dress book = remaining * 3 / 5 result = book return result
John has 78 pieces of candy and needs to give them away evenly to 14 people. How many candie pieces will each recipient get?
def solve() -> int: pieces = 78 people = 14 num_of_pieces = pieces // people result = num_of_pieces return result
John worked for 35 hours this week and was paid $15 per hour. He needs to pay $500 for rent and spend $100 on groceries. He also pays 12% of his income as taxes. How much money does he have left after all expenses and taxes?
def solve() -> int: hours_worked = 35 hourly_wage = 15 income = hours_worked * hourly_wage taxes = income * 0.12 rent = 500 groceries = 100 expenses = rent + groceries take_home = income - taxes leftover = take_home - expenses result = leftover return result
If Megan bakes 10 cupcakes and uses a 2:1 ratio of icing to cupcakes, how many cups of icing does she need?
def solve() -> int: icing_needed = 10 * 2 result = icing_needed return result
A farm has 40 cows, with each cow giving an average of 8 liters of milk per day. If 5% of the cows are sick, how many liters of milk does the farm get in a week?
def solve() -> int: cows = 40 milk_per_cow = 8 sick_cows = 0.05 * cows healthy_cows = cows - sick_cows milk_per_day = healthy_cows * milk_per_cow milk_per_week = milk_per_day * 7 result = milk_per_week return result
Chelsea has 10 quarters, 15 dimes, and 20 nickels in her pocket. How much money does she have in total?
def solve() -> int: num_of_quarters = 10 num_of_dimes = 15 num_of_nickels = 20 total_value = num_of_quarters*0.25 + num_of_dimes*0.10 + num_of_nickels*0.05 result = total_value return result
Ubin buys 45kg of apples from a farmer at $2 per kg. He is selling the apples to market traders at $2.3 per kg. He also had to pay $25 for the transportation charges. What is his total profit?
def solve() -> int: quantity = 45 cost_per_kg = 2.0 selling_price_per_kg = 2.3 transportation_cost = 25 total_cost = quantity * cost_per_kg + transportation_cost total_selling_price = quantity * selling_price_per_kg total_profit = total_selling_price - total_cost result = total...
Student: Zoe is in school for 5.5 hours each day and she is taking 4 classes. She has physics and Spanish classes for a combined total of 1.5 hours. How many minutes does Zoe spend in one of her other classes on average?
def solve() -> int: hours_in_school = 5.5 number_of_classes = 4 hours_in_physics_and_spanish = 1.5 hours_in_other_classes = hours_in_school - hours_in_physics_and_spanish minutes_in_other_classes = hours_in_other_classes * 60 / number_of_classes result = minutes_in_other_classes return resu...
A farmer has 15 chickens and 12 rabbits in his barn. He feeds them with bags of grain that each contain 20 kilograms. Each chicken consumes 0.2 kilograms of grain per day, and each rabbit consumes 0.4 kilograms of grain per day. How many days will one bag of grain last for all the animals?
def solve() -> int: chickens = 15 rabbits = 12 bag_weight = 20 chicken_consumption = 0.2 rabbit_consumption = 0.4 total_consumption = chickens * chicken_consumption + rabbits * rabbit_consumption days = bag_weight / total_consumption result = days return result
Ethan wants to earn $75 by selling lemonade. He sells each glass of lemonade for $1 and 5 people purchased 4 glasses each. How many more glasses of lemonade does Ethan need to sell to make $75?
def solve() -> int: glasses_per_person = 4 people = 5 price_per_glass = 1 target_amount = 75 total_glasses_sold = glasses_per_person * people total_amount_earned = total_glasses_sold * price_per_glass remaining_amount = target_amount - total_amount_earned remaining_glasses = re...
Student: In a supermarket, there are 150 items. If 40% of them are food and 20% are drinks, how many cleaning items are in the supermarket?
def solve() -> int: food = 150 * 0.4 drinks = 150 * 0.2 cleaning = 150 - (food + drinks) result = cleaning return result
Student: In a park, there are 5 benches, and each bench can seat 4 people. If there are 12 people sitting on the benches and 8 people standing in the park, how many seats are empty on the benches?
def solve() -> int: benches = 5 seats_per_bench = 4 people_sitting = 12 people_standing = 8 total_seats = benches * seats_per_bench empty_seats = total_seats - people_sitting result = empty_seats return result
Tina has been practicing yoga for 45 minutes a day. She wants to increase her yoga time by 10 minutes each day. How much time will she spend practicing yoga in a week?
def solve() -> int: minutes_per_day = 45 increase_per_day = 10 days_per_week = 7 total_time = minutes_per_day + increase_per_day * (days_per_week - 1) result = total_time return result
arah has 100 marbles and she wants to divide them equally among her 4 friends. How many marbles will each friend get?
def solve() -> int: marbles = 100 friends = 4 marbles_per_friend = marbles / friends result = marbles_per_friend return result
John has $26.50. He wants to buy a toy that costs $14.99. How much money will he have after he buys the toy?
def solve() -> int: john_money = 26.50 toy_cost = 14.99 john_money_after_buy = john_money - toy_cost result = john_money_after_buy return result
John is laying new carpet in his living room which is 15 feet by 20 feet. If the carpet comes in rolls that are 12 feet wide, how many rolls will he need to cover the entire room?
def solve() -> int: length = 15 width = 20 roll_width = 12 total_sq_ft = length * width rolls_needed = total_sq_ft / (roll_width * width) result = rolls_needed return result
Lily the artist has 12 paint brushes. If she gives 4 paint brushes to her friend, how many paint brushes will she have left?
def solve() -> int: paint_brushes = 12 paint_brushes_given = 4 paint_brushes_left = paint_brushes - paint_brushes_given result = paint_brushes_left return result
Ella has $15 less than twice as much as Alex. If Alex has $8, how much money does Ella have?
def solve() -> int: Alex_Money = 8 Money_difference = 15 Ella_Money = Alex_Money + Money_difference*2 result = 38 return result
A company sold 7500 smartphones in a month. If the company's sales increased by 10% in the following month, how many smartphones were sold in the second month?
def solve() -> int: current_sales = 7500 percentage_increase = 10 increase_amount = current_sales * (percentage_increase/100) second_month_sales = current_sales + increase_amount result = second_month_sales return result
A coffee shop sells 400 cups of coffee per day at $5 each. If they sell for 6 days a week, how much money will the coffee shop earn in a month?
def solve() -> int: cups_per_day = 400 price_per_cup = 5 days_per_week = 6 weeks_per_month = 4 cups_per_week = cups_per_day * days_per_week income_per_week = cups_per_week * price_per_cup income_per_month = income_per_week * weeks_per_month result = income_per_month re...
A shop sells 400 pencils each day. They want to increase their sales by 20% using advertising. What is the new daily sale after advertising?
def solve() -> int: daily_sale = 400 increase_percentage = 20 new_sale = daily_sale * (increase_percentage/100 + 1) result = new_sale return result
Student: John drove from his house to his work at 40 miles per hour, and drove back home at 60 miles per hour. If he spent a total of 3 hours driving, what is the distance between his house and work?
def solve() -> int: speed_to_work = 40 speed_back_home = 60 total_time = 3 distance_to_work = speed_to_work * total_time distance_back_home = speed_back_home * total_time total_distance = distance_to_work + distance_back_home result = total_distance return result
If a number is increased by 20%, and then decreased by 15%, what is the final number, if it was originally 100?
def solve() -> int: originalNum = 100 increase = originalNum * 0.2 firstResult = originalNum + increase decrease = firstResult * 0.15 finalResult = firstResult - decrease result = finalResult return result
A party rental company charges $150 for a basic party package, which includes tables and chairs for 25 people. The company charges $2 per person for additional chairs and $5 per table for additional tables. If a party has 40 guests, how much will they need to pay for the party package?
def solve() -> int: basic_package_cost = 150 guests_included = 25 cost_per_table = 5 cost_per_chair = 2 num_of_guests = 40 num_of_tables = (num_of_guests - guests_included) / cost_per_table num_of_chairs = num_of_guests - guests_included total_cost = basic_package_cost + num_of_tables*co...
A recipe calls for 2 cups of sugar and makes 6 servings. If you want to make 24 servings, how many cups of sugar do you need?
def solve() -> int: cups_sugar = (24/6)*2 result = cups_sugar return result
Student: A class of 130 students were surveyed about their favorite sport. 27% of them said soccer. How many students chose soccer?
def solve() -> int: total_students = 130 percentage_soccer = 0.27 num_soccer = total_students * percentage_soccer result = round(num_soccer) return result
If a 10-foot-long rope is cut into pieces of 2.5 feet each, how many pieces will there be?
def solve() -> int: num_of_pieces = 10 // 2.5 result = num_of_pieces return result
A store offers a 10% discount on the original price of a laptop. The original price was $800. How much money can you save if you buy this laptop with a discount?
def solve() -> int: original_price = 800 discount = 10 discounted_price = original_price * (100 - discount)/100 savings = original_price - discounted_price result = savings return result
Jessie wanted to paint the wall in her bedroom. The wall is 5 meters long and 3 meters high. Every liter of paint covers 6 square meters. How many liters of paint does Jessie need to buy?
def solve() -> int: wall_height = 3 wall_length = 5 area_covered_by_one_liter = 6 wall_area = wall_height * wall_length result = wall_area / area_covered_by_one_liter return result
The ratio of the amount of money Keith, Sean, and Kelly have is 6:7:8. If the total amount of money they have is $84, calculate the loss Keith and Sean will make if they combine their money to buy flowers and sell them at 90% of the buying price.
def solve() -> int: total_money = 84 ratio_sum = 6 + 7 + 8 keith_money = 6 / ratio_sum * total_money sean_money = 7 / ratio_sum * total_money combined_money = keith_money + sean_money selling_price = combined_money * 0.9 loss = combined_money - selling_price result = loss return res...
There are 25 students lining up. If 6 students leave, how many students are left in the line?
def solve() -> int: students_lining_up = 25 students_left = 6 students_in_line = students_lining_up - students_left result = students_in_line return result
The sum of three consecutive odd numbers is 63. What is the largest one of these numbers?
def solve() -> int: n_1 = 19 n_2 = n_1 + 2 n_3 = n_2 + 2 while n_1 + n_2 + n_3!= 63: n_1 += 2 n_2 = n_1 + 2 n_3 = n_2 + 2 largest_number = n_3 result = int(largest_number) return result
A company has 10 employees who each earn a base salary of $50,000. They each receive a 10% bonus for meeting their quarterly targets and a 25% bonus for exceeding their quarterly targets. If all the employees meet their targets, what will their total salary be for the quarter?
def solve() -> int: base_salary = 50000 meeting_bonus = 0.10 exceeding_bonus = 0.25 quarterly_salary = base_salary * (1 + meeting_bonus) exceeding_salary = base_salary * (1 + exceeding_bonus) total_salary = 10 * (quarterly_salary + 9 * exceeding_salary) result = total_salary return resu...
Lisa has 7 times as many pennies as nickels, and 4 more dimes than quarters. If she has $5.60 in total, how many quarters does she have?
def solve() -> int: num_pennies = 0 num_nickels = 0 num_dimes = 0 num_quarters = 0 result = num_quarters return result
James is saving up for a trip to Europe that costs $4000. He has already saved up $1000. If he saves $250 each month, how long will it take for him to be able to afford the trip?
def solve() -> int: trip_cost = 4000 money_saved = 1000 savings_per_month = 250 months_to_save = (trip_cost - money_saved) / savings_per_month result = months_to_save return result
adie had five books and then borrowed three more. She loaned two away, but then found another. How many books does Sadie have now?
def solve() -> int: result = 0 total_books = 5 borrow_books = 3 loaned_books = 2 found_books = 1 remaining_books = total_books + borrow_books - loaned_books + found_books result = remaining_books return result
A bookshelf has 54 books. If 20% of the books are fiction, how many non-fiction books are on the bookshelf?
def solve() -> int: total_books = 54 percent_fiction = 20/100 num_fiction = total_books * percent_fiction num_nonfiction = total_books - num_fiction result = num_nonfiction return result
A farmer needs to fence in a rectangular area for his cows. If he has 300 feet of fencing, what are the dimensions of the rectangle that will give him the maximum area?
def solve() -> int: perimeter = 300 side_length = perimeter / 4 max_area = side_length ** 2 result = max_area return result
A woman bought 3 pears, 5 cans of soda, and 2 bags of chips. The pears cost $0.60 each, the sodas cost $0.75 each, and the chips cost $1.20 each. How much did the woman spend in total?
def solve() -> int: pears = 3*0.60 sodas = 5*0.75 chips = 2*1.20 total_spent = pears+sodas+chips result = total_spent return result
A factory produces three types of lamps, and each type of lamp has a different number of bulbs. The first type has 5 bulbs, the second type has 7 bulbs, and the third type has 9 bulbs. The factory produces twice as many lamps of the second type as the first type, and three times as many lamps of the third type as the s...
def solve() -> int: lamps_type1 = 100 lamps_type2 = 2 * lamps_type1 lamps_type3 = 3 * lamps_type2 bulbs_type1 = 5 bulbs_type2 = 7 bulbs_type3 = 9 total_bulbs = (lamps_type1 * bulbs_type1) + (lamps_type2 * bulbs_type2) + (lamps_type3 * bulbs_type3) result = total_bulbs ...
A laptop is on sale for $800 with a 25% discount. If the sales tax is 6%, how much will the laptop cost after tax and discount?
def solve() -> int: discount = 0.25 * 800 subtotal = 800 - discount tax = 0.06 * subtotal total = subtotal + tax result = total return result
It takes Anna 12 hours to bake a cake and it takes Lisa 6 hours. If Anna bakes at a rate of 3 cakes per hour, what is Lisa's baking rate (in cakes per hour)?
def solve() -> int: anna_time = 12 anna_rate = 3 lisa_time = 6 anna_cakes = anna_time * anna_rate lisa_rate = anna_cakes / lisa_time result = lisa_rate return result
The sum of two numbers is 45. If one-third of the first number is equal to one-fourth of the second number, what is the second number?
def solve() -> int: y = 20 result = y return result
If a rectangular has a length of 15 cm and a width of 10 cm, what is its perimeter?
def solve() -> int: length = 15 width = 10 result = 2 * ( length + width ) return result
Lila is a archer and she is making new records. In every target shooting, she hits bulls-eyes 5 times. Over 12 sessions in the season, she also manages to break her personal records twice. The old record for hitting bulls-eyes was 80. How many more bulls-eyes did Lila hit than the old record?
def solve() -> int: bulls_eyes_per_session = 5 sessions = 12 personal_records_broken = 2 old_record = 80 bulls_eyes_hit = bulls_eyes_per_session * sessions new_record = old_record + personal_records_broken * bulls_eyes_per_session more_bulls_eyes = new_record - old_record ...
A recipe for brownies calls for 2 cups of flour, 1 cup of sugar, and 3/4 cup of cocoa powder. If a baker wants to make half a batch of brownies, how much of each ingredient should she use?
def solve() -> int: flour_for_full_batch = 2 sugar_for_full_batch = 1 cocoa_powder_for_full_batch = 0.75 flour_for_half_batch = flour_for_full_batch / 2 sugar_for_half_batch = sugar_for_full_batch / 2 cocoa_powder_for_half_batch = cocoa_powder_for_full_batch / 2 result = (flour_for...
Kate’s car gets 20 miles per gallon. If she drives 120 miles, how many gallons of gas does she need?
def solve() -> int: mile = 120 gas = mile / 20 result = gas return result
At a birthday party, Sarah said that she has one cake for every two guests at the party, but she needed to bake an extra cake because one more person unexpectedly arrived. If there were 20 guests in total, how many cakes did Sarah bake?
def solve() -> int: num_guests = 20 cakes_per_guest = 1/2 total_cakes = num_guests * cakes_per_guest extra_cakes = 1 total_baked = total_cakes + extra_cakes result = total_baked return result
A flower shop has bouquets on sale. They sold 12 bouquets and made $84, which was $42 less than they would have made selling the same number of bouquets without the sale. How much does a bouquet cost when not on sale?
def solve() -> int: bouquets_sold = 12 total_revenue = 84 revenue_without_sale = total_revenue + 42 cost_per_bouquet = revenue_without_sale / bouquets_sold result = cost_per_bouquet return result
A student wants to buy a used book for $15. If they only have $10, and the seller agrees to a payment plan where they pay 25% of the original price every week until the book is paid off, how many weeks will it take to pay for the book completely?
def solve() -> int: original_price = 15 paid_amount = 10 percent_per_week = 0.25 remaining_amount = original_price - paid_amount weeks_needed = remaining_amount / (original_price*percent_per_week) result = weeks_needed return result
The width of a rectangle is 4 less than twice its length. If the perimeter is 60, what are the dimensions of the rectangle?
def solve() -> int: perimeter = 60 width_length = (perimeter / 2) - 8 width = width_length / 3 length = width_length * 2 / 3 result = (width, length) return result
At a party, Maya saw her friend Chris enter the room with 3 strangers. If there were also 12 people already at the party, how many people are there in total?
def solve() -> int: maya_friends = 1 chris_friends = 3 total_friends = maya_friends + chris_friends people_at_party = 12 total_people = total_friends + people_at_party result = total_people return result