question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Sam ran a 10-kilometer race in 50 minutes. What was his average speed in kilometers per hour?
def solve() -> int: result = 10 / (50 / 60) return result
A rectangular box is 12 inches long, 8 inches wide and 6 inches tall. What is the volume of the box in cubic inches?
def solve() -> int: length = 12 width = 8 height = 6 box_volume = length * width * height result = box_volume return result
A store offers a 10% discount on all items. If the original price of a product is $30, what is the new price?
def solve() -> int: original_price = 30 discount = 0.10 new_price = original_price - (original_price * discount) result = new_price return result
10% of Marcus's grade is participation, 20% is the homework grade, and 70% is the test grade. If his homework grade is 80%, what should his test grade be to get an overall grade of 85%?
def solve() -> int: participation_weight = 0.1 homework_weight = 0.2 test_weight = 0.7 homework_grade = 80 overall_grade = 85 test_grade = (overall_grade - (participation_weight * 100) - (homework_weight * homework_grade)) / test_weight result = test_grade return result
Alex bought 8 items from the store at a total price of $128. If the items did not have the same price, what is the maximum price of one item?
def solve() -> int: items = 8 price = 128 each_item = price / items result = each_item return result
``` Liam has 3 times more marbles than Mary and Mary has 25 marbles. How many marbles does Liam have?
def solve() -> int: mary_marbles = 25 liam_marbles = 3 * mary_marbles result = liam_marbles return result
Student: John sold 100 shirts in his store on Monday and 75 shirts on Tuesday. If he wants to sell a total of 500 shirts in a week, how many more shirts does he need to sell from Wednesday to Sunday combined?
def solve() -> int: monday = 100 tuesday = 75 goal = 500 first_two_days = monday + tuesday remaining = goal - first_two_days result = remaining return result
Hannah runs 3 miles 5 days a week, and 5 miles twice a week. How many miles does she run in one week?
def solve() -> int: days_3_miles = 5 miles_3_miles = 3 days_5_miles = 2 miles_5_miles = 5 total_miles_run = (days_3_miles*miles_3_miles) + (days_5_miles*miles_5_miles) result = total_miles_run return result
A gym has 3 treadmills and each treadmill has a maximum capacity of 200 pounds. If 5 people want to workout on the treadmills, but only 2 treadmills are available, can all 5 people workout?
def solve() -> int: treadmills = 3 capacity_per_treadmill = 200 people = 5 available_treadmills = 2 total_capacity = available_treadmills * capacity_per_treadmill if total_capacity >= people: result = "Yes, all 5 people can workout" else: result = "No, there isn't enough capa...
If a grocery store had 500 customers on Monday, 650 on Tuesday, and 750 on Wednesday, how many customers visited the store over the three days?
def solve() -> int: monday = 500 tuesday = 650 wednesday = 750 total_customers = monday + tuesday + wednesday result = total_customers return result
Lily used to solve 10 math problems a day, but now she increased her daily goal by 125%. If each math problem took her 5 minutes, how long will it take her to solve her new daily goal of problems?
def solve() -> int: num_problems = 10 increase_percent = 125 new_num_problems = num_problems * (1 + increase_percent/100) time_per_problem = 5 total_time = new_num_problems * time_per_problem result = total_time return result
A pizza shop makes 12 large pizzas per day and 15 small pizzas per day. If a large pizza costs $18 and a small pizza costs $12, what will be the total sales at the end of the day?
def solve() -> int: large_pizzas = 12 small_pizzas = 15 cost_large_pizza = 18 cost_small_pizza = 12 total_sales = (large_pizzas * cost_large_pizza) + (small_pizzas * cost_small_pizza) result = total_sales return result
The sum of two numbers is 37. If one number is 9 less than the other, what is the value of the larger number?
def solve() -> int: total = 37 difference = 9 smaller_num = (total - difference) / 2 larger_num = smaller_num + difference result = larger_num return result
Justin has a jar with 40 marbles in it. If he takes out 5 marbles per day, how many days will it take him to empty the jar completely?
def solve() -> int: jar_capacity = 40 marbles_per_day = 5 days = jar_capacity / marbles_per_day result = days return result
san has a total of 25 dolls. She gives 1/5th of her dolls to her friend. How many dolls does she have with her now?
def solve() -> int: susans_dolls = 25 dolls_given_to_friend = susans_dolls//5 dolls_left = susans_dolls - dolls_given_to_friend result = dolls_left return result
Three friends shared a pizza equally. If the pizza has 6 slices, how many slices did each friend get?
def solve() -> int: num_friends = 3 num_slices = 6 slices_friend = num_slices//num_friends result = slices_friend return result
Kevin agreed to pay 25% of the cost of his friend's birthday cake, which costs $12 per pound. The cake weighs 3.5 pounds. How much will Kevin pay for the cake?
def solve() -> int: cake_cost = 12 * 3.5 percentage = 0.25 result = cake_cost * percentage return result
A bottle of shampoo costs $7, and a tube of toothpaste costs $5. A person wants to buy some toiletries. He has $35. How many bottles of shampoo can he buy?
def solve() -> int: shampoo_cost = 7 toothpaste_cost = 5 total_money = 35 max_shampoo = total_money // shampoo_cost result = max_shampoo return result
Laura wants to buy a dress that costs $49.99, a pair of shoes that cost $29.99, and a purse that costs $19.99. She has $100.00. How much money will Laura have left after buying the dress, shoes, and purse?
def solve() -> int: total_cost = 49.99 + 29.99 + 19.99 money_left = 100.00 - total_cost result = money_left return result
Tom has 5 apples. He gives 2 apples to Tina and 1 apple to John. How many apples does Tom have now?
def solve() -> int: starting_apples = 5 apples_given_tina = 2 apples_given_john = 1 ending_apples = starting_apples - apples_given_tina - apples_given_john result = ending_apples return result
Rachel can jog a mile in 10 minutes. It takes her friend, Brandon, 4 minutes longer to jog the same distance. If Rachel starts jogging first, how many minutes will Brandon take to catch up with Rachel?
def solve() -> int: rachel_time = 10 brandon_time = rachel_time + 4 time_difference = brandon_time - rachel_time result = time_difference return result
A pizza place sells large pizzas for $10 each, but is currently having a 20% off sale. If a customer orders 3 pizzas, how much will they save?
def solve() -> int: pizza_price = 10 discount = 0.2 num_pizzas = 3 total_cost_before_discount = pizza_price * num_pizzas discount_amount = total_cost_before_discount * discount total_cost_after_discount = total_cost_before_discount - discount_amount result = total_cost_before_disco...
Sophia owed $1000 in car payments. Due to non-payment, she was charged a 12% late fee. Next month, she paid $800, but didn't make any further payments. What is the current balance owed?
def solve() -> int: owed = 1000 late_fee = owed * 0.12 owed = owed + late_fee owed = owed - 800 result = owed return result
Nour bought three books, each costing 12 dollars, and four notebooks, each costing 3 dollars. She also paid a 10 percent sales tax on her purchase. How much, in dollars, did she pay in total?
def solve() -> int: book_price = 12 notebook_price = 3 subtotal = book_price * 3 + notebook_price * 4 tax = subtotal * 0.1 total = subtotal + tax result = total return result
A bag contains 8 blue marbles, 5 red marbles, and 7 green marbles. If a marble is chosen at random, what is the probability that it is not red?
def solve() -> int: total_marbles = 8 + 5 + 7 num_non_red = 8 + 7 prob_not_red = num_non_red/total_marbles result = prob_not_red return result
How many boxes of tissues must be purchased if each box contains an equal number of 75 tissues, but you only want 50 tissues?
def solve() -> int: tissues_per_box = 75 desired_tissues = 50 boxes_needed = desired_tissues / tissues_per_box result = boxes_needed return result
Student: Lisa bought 10 pencils for $2.50 and sold them for $0.50 each. What was her profit?
def solve() -> int: pencils_bought = 10 cost_per_pencil = 2.50 / pencils_bought selling_price_per_pencil = 0.50 profit_per_pencil = selling_price_per_pencil - cost_per_pencil total_profit = profit_per_pencil * pencils_bought result = total_profit return result
``` A grocery store sold 100 bananas on Monday, 200 on Tuesday, and 300 on Wednesday. If they sell an average of 250 bananas for the rest of the week, how many bananas will they sell in total?
def solve() -> int: bananas_mon = 100 bananas_tue = 200 bananas_wed = 300 avg_bananas = (bananas_mon + bananas_tue + bananas_wed + (250 * 4)) / 7 total_bananas = avg_bananas * 7 result = total_bananas return result
A farmer is planting corn. He needs 240 seeds to plant a row of corn. If he has 12 packets of seeds that can plant 15 rows each, how many seeds does he have left after planting 8 rows?
def solve() -> int: packets = 12 rows_per_packet = 15 seeds_per_row = 240 seeds = packets * rows_per_packet * seeds_per_row seeds_used = 8 * seeds_per_row seeds_left = seeds - seeds_used result = seeds_left return result
Student: A toy store ordered 400 teddy bears and 300 dolls from a supplier. The supplier charged $2.50 for each teddy bear and $3.00 for each doll. The toy store also had to pay a shipping fee of $50. The toy store sold each teddy bear for $5.00 and each doll for $6.00. If the toy store sold all the toys, how much prof...
def solve() -> int: teddy_bears = 400 dolls = 300 teddy_bear_cost = 2.50 doll_cost = 3.00 shipping_fee = 50 teddy_bear_price = 5.00 doll_price = 6.00 total_cost = (teddy_bears * teddy_bear_cost) + (dolls * doll_cost) + shipping_fee total_revenue = (teddy_bears * teddy_bear_price) + (...
Ethan is 45 years old and is the oldest in his group of friends. His friend is 35 percent younger than he is, and his friend's sibling is one-third his friend's age. How old is his friend's sibling?
def solve() -> int: ethan_age = 45 friend_age = ethan_age - (ethan_age * 0.35) sibling_age = friend_age / 3 result = sibling_age return result
A play center charges $25 admission fee and $10 for a pizza party. A group of 8 people goes to the play center and attends the party, while a group of 6 people only goes to the play center. How much does the play center earn?
def solve() -> int: admission_fee = 25 pizza_party_fee = 10 group1_size = 8 group2_size = 6 group1_earnings = (admission_fee + pizza_party_fee) * group1_size group2_earnings = admission_fee * group2_size total_earnings = group1_earnings + group2_earnings result = total_earnings...
Maria has 20 stamps in her collection, 15 of the stamps are from the United States. 10 of those 15 stamps are Christmas themed. How many of the 20 stamps are non-Christmas themed and from the United States?
def solve() -> int: num_US_stamps = 15 num_US_Christmas_stamps = 10 result = num_US_stamps - num_US_Christmas_stamps return result
Kyle and his friends went on a 4-day hike. If each day Kyle had to follow the trail for 7 miles and his friends had to follow the trail for 6 miles each day, how many miles did they follow in total?
def solve() -> int: num_friends = 3 miles_per_day_kyle = 7 miles_per_friend = 6 total_miles = (miles_per_day_kyle * num_friends * 4) + (miles_per_friend * num_friends * 4) result = total_miles return result
Alex is throwing a birthday party for his son and wants to make sure he has enough goody bags for each kid. He invites 12 friends and orders 10 goody bags. But, he soonDuring a charity event, the local bakery was selling cupcakes. One cupcake cost $1.50. They also had a special where you could buy six cupcakes for $8.5...
def solve() -> int: friends = 12 goody_bags = 10 cupcake_cost = 1.50 special_cost = 8.50 total_cupcakes = 6 + 2 total_cost = (total_cupcakes // 6) * special_cost + (total_cupcakes % 6) * cupcake_cost result = total_cost return result
Alex is restocking the drink cooler at a gas station. He can fit 160 cans of soda in the cooler. Each row holds eight cans, and the cooler has five rows. How many coolers does Alex need?
def solve() -> int: cans_per_row = 8 num_rows = 5 total_cans = cans_per_row * num_rows num_coolers = 160 // total_cans + (160 % total_cans > 0) result = num_coolers return result
A square has a perimeter of 16 units. What is the length of each side of the square?
def solve() -> int: perimeter = 16 side_length = perimeter / 4 result = side_length return result
If 5 pencils cost $2, how much will 7 pencils cost?
def solve() -> int: skillfully_priced_pencils = 5 cost_for_pencils = 2 pencils = 7 total_cost = cost_for_pencils * pencils / skillfully_priced_pencils result = total_cost return result
A bartender works four nights a week and earns $100, $50, $200, and $75 in tips, respectively. How much does he need to earn on his fifth night to have an average of $120 in tips per night?
def solve() -> int: tip1 = 100 tip2 = 50 tip3 = 200 tip4 = 75 avg_tip = 120 total_tips = tip1 + tip2 + tip3 + tip4 num_of_nights = 4 target_total_tips = avg_tip * 5 target_tip5 = target_total_tips - total_tips result = target_tip5 return result
David was decorating his bedroom and had 16 picture frames on hand. His grandma brought 12 more frames from the thrift store. His cousin came over with one-sixth of the number of frames that David had originally. After visiting an art gallery, David bought 5 more than twice the number of frames he started with. How man...
def solve() -> int: frames_on_hand = 16 frames_from_grandma = 12 frames_from_cousin = frames_on_hand / 6 frames_bought = 2 * frames_on_hand + 5 total_frames = frames_on_hand + frames_from_grandma + frames_from_cousin + frames_bought result = total_frames return result
Harry had 4 more than twice as many candies as Peter. If Peter had 7 candies, how many candies does Harry have now after eating 2 candies?
def solve() -> int: peter_candies = 7 harry_candies = 2 * peter_candies + 4 harry_candies -= 2 result = harry_candies return result
David and Lisa went to a fancy restaurant and ended up paying $150 in total. David paid 2/3 of the bill and Lisa paid the rest. How much did David and Lisa each pay?
def solve() -> int: total_bill = 150 david_paid_fraction = 2 / 3 david_paid_amount = david_paid_fraction * total_bill lisa_paid_amount = total_bill - david_paid_amount result = david_paid_amount, lisa_paid_amount return result
Claire is having a party and needs to order 300 drinks. If one bottle contains 6 drinks, how many bottles of drinks does she need?
def solve() -> int: number_of_bottles = 300 / 6 result = number_of_bottles return result
Rachel is decorating her room. She has 3 walls that are 9 feet long and 1 wall that is 12 feet long. How many feet of trim does she need?
def solve() -> int: wall_lengths = [9, 9, 9, 12] total_length = sum(wall_lengths) result = total_length return result
If the cost of a shirt goes from $30 to $45, what is the percent increase?
def solve() -> int: percent_increase = ((45 - 30) / 30) * 100 result = percent_increase return result
Jack and Jill are filling buckets with water from a well. Jack fills his bucket in 12 minutes, while Jill fills hers in 15 minutes. If they start at the same time and work until they have 10 buckets of water, how many buckets does Jack fill?
def solve() -> int: result = round(5.56) return result
David has $60. He spends 1/4 of it on lunch and 2/3 of what is left on a video game. How much money does David have left?
def solve() -> int: starting_money = 60 spent1 = starting_money/4 remaining_money = starting_money - spent1 spent2 = 2/3 * remaining_money total_spent = spent1 + spent2 money_left = starting_money - total_spent result = money_left return result
Bob wants to participate in a cycling competition that takes place in another city. The round trip train ticket costs $50. Bob also needs to pay $20 for food and other expenses during the trip. Bob has only $80. Can he afford the trip?
def solve() -> int: round_trip_cost = 50 expenses = 20 budget = 80 total_cost = round_trip_cost + expenses can_afford = budget >= total_cost result = can_afford return result
Student: Jack, Danny and Ana are going on a road trip. Jack will pay $35, Danny will pay $40 and Ana will pay $45 for the gasoline. They want to evenly split an additional 6% state tax. How much will each person contribute to the tax?
def solve() -> int: jack_pay = 35 danny_pay = 40 ana_pay = 45 tax_rate = 0.06 total_pay = jack_pay + danny_pay + ana_pay tax_amount = total_pay * tax_rate each_pay = tax_amount / 3 result = each_pay return result
The ratio of the length to the width of a rectangle is 6:4. The perimeter of the rectangle is 80cm. What is the length of the rectangle?
def solve() -> int: total_ratio = 6+4 perimeter = 80 length_ratio = 6/total_ratio width_ratio = 4/total_ratio length = length_ratio*perimeter/2 result = length return result
Jessica runs at a speed of 7 mph for the first 30 minutes of her run, then slows to 5 mph for the next hour. What is her average speed for the entire run?
def solve() -> int: distance = 7 * 0.5 + 5 * 1 total_time = 0.5 + 1 avg_speed = distance / total_time result = avg_speed return result
A bag of marbles contains 10 red marbles, 15 blue marbles, and 8 green marbles. What is the probability of selecting a blue marble at random?
def solve() -> int: total_marbles = 10 + 15 + 8 probability_of_blue = 15 / total_marbles result = probability_of_blue return result
It takes 3 hours for a car to travel 180 miles. How long will it take the car to travel 240 miles?
def solve() -> int: distance = 180 time = 3 new_distance = 240 new_time = (time / distance) * new_distance result = new_time return result
The Iron Man movie cost 30 million to make and earned 500 million at the box office. If it earned a profit that was one-third of what Batman made and Batman cost 60 million to make, how many millions did Batman earn?
def solve() -> int: iron_man_cost = 30 iron_man_earnings = 500 batman_cost = 60 iron_man_profit = iron_man_earnings - iron_man_cost batman_profit = 3 * iron_man_profit batman_earnings = batman_profit + batman_cost result = batman_earnings return result
There ared 480 students in Anup School and each class has 15 students. How many classes are there in Anup School?
def solve() -> int: no_students = 480 class_size = 15 no_classes = no_students // class_size result = no_classes return result
A school has a total of 500 students. The ratio of girls to boys is 3:5. How many boys are there in the school?
def solve() -> int: total_ratio = 3+5 boys_ratio = 5/total_ratio num_boys = boys_ratio * 500 result = num_boys return result
Emily has 24 apples and she wants to divide them equally among her 4 friends. How many apples will each friend receive?
def solve() -> int: apples = 24 friends = 4 apples_per_friend = apples / friends result = apples_per_friend return result
Tom sells chicken Caesar wraps for $8.50. If a tortilla costs $0.80, a slice of chicken costs $2.00, and a handful of lettuce costs $0.25, how many cents does a wrap with one of each protein cost Tom to make?
def solve() -> int: tortilla_cost = 0.80 chicken_cost = 2.00 lettuce_cost = 0.25 wrap_cost = tortilla_cost + chicken_cost + lettuce_cost wrap_cost_cents = wrap_cost * 100 result = wrap_cost_cents return result
Student: A cyclist can travel at a speed of 15 miles per hour. How long will it take him to travel 60 miles?
def solve() -> int: speed = 15 distance = 60 time = distance / speed result = time return result
Student: 2. Theo bought 200 pieces of furniture, 40% of which were tables. 75% of the tables were wooden chairs. How many wooden chairs did Theo buy?
def solve() -> int: total_furniture = 200 percent_tables = 0.4 percent_wooden_chairs = 0.75 num_tables = total_furniture * percent_tables num_wooden_chairs = num_tables * percent_wooden_chairs result = num_wooden_chairs return result
Student: Adam biked at the rate of 12 mph for 90 minutes. How far he traveled in miles?
def solve() -> int: rate = 12 time = 90 time_in_hours = time / 60 distance = rate * time_in_hours result = distance return result
``` A factory has 400 employees. If 25% of the employees are male and 60% of the male employees are married, how many married male employees does the factory have?
def solve() -> int: num_employees = 400 male_ratio = 0.25 male_employees = male_ratio * num_employees married_ratio = 0.6 married_male_employees = male_employees * married_ratio result = married_male_employees return result
A rectangle has a length which is 2 less than 5 times its width. If the perimeter of the rectangle is 40 feet, what are the length and width of the rectangle?
def solve() -> int: perimeter = 40 width = (perimeter / 2) / (5 + (2 * -1)**-1) length = 5 * width - 2 result = (length, width) return result
A bag contains 5 red marbles, 3 blue marbles, and 2 green marbles. What is the probability of picking a red marble?
def solve() -> int: probability = 5 / (5 + 3 + 2) result = f'<<<{probability}>>>' result = probability return result
A store sells two different types of products, product A and product B. Product A costs $7 per item and product B costs $3 per item. If the store sells 26 items and makes a total of $124, how many product A items did they sell?
def solve() -> int: total_items = 26 total_sales = 124 A_sales = (total_sales - 3 * total_items) / 4 result = A_sales return result
A dress originally costs $150. If the price is decreased by 20%, what is the new price of the dress?
def solve() -> int: original_price = 150 discount_percentage = 20 discount_amount = (discount_percentage / 100) * original_price new_price = original_price - discount_amount result = new_price return result
Student: A recipe calls for 2 cups of flour to make 12 cookies. If you want to make 36 cookies, how many cups of flour do you need?
def solve() -> int: cookies_needed = 36 cookies_per_cup = 12 cups_of_flour = cookies_needed / cookies_per_cup result = cups_of_flour return result
Student: A baker has 9 bags of flour, each weighing 10 kg. How many kg of flour does the baker have in total?
def solve() -> int: bags = 9 weight = 10 total = bags * weight result = total return result
Possible new questions are: Mia, Leo and Wai played a word game. Mia made 15 words, Leo made half as many words as Mia, and Wai made one less word than Leo. If each word was worth 3 points, how many more points did they earn than their friend Ada, who made 12 words?
def solve() -> int: mia_words = 15 leo_words = mia_words / 2 wai_words = leo_words - 1 mia_points = mia_words * 3 leo_points = leo_words * 3 wai_points = wai_words * 3 team_points = mia_points + leo_points + wai_points ada_points = 12 * 3 difference = team_points - ada_points res...
Emily receives $20 for her birthday and spends $7.50 on a new book and $9 on a movie ticket. How much money does she have left?
def solve() -> int: initial_amount = 20 book_price = 7.50 movie_ticket_price = 9 remaining_amount = initial_amount - book_price - movie_ticket_price result = remaining_amount return result
Marco bought a bike for $240, which was 40% off the original price. What was the original price of the bike?
def solve() -> int: final_price = 240 discounted_price = final_price/(1-0.40) result = discounted_price return result
Jen is drawing a 3D cube on a piece of paper. The 3D cube is made up of five squares. If the length of one side of one square is 4 inches, what is the total perimeter of the 3D cube in inches?
def solve() -> int: length_side_square = 4 n_sides_cube = 5 total_perimeter = n_sides_cube * length_side_square result = total_perimeter return result
A pizza has 12 slices. If 3 slices are eaten, how many slices are left?
def solve() -> int: slices_initial = 12 slices_eaten = 3 slices_left = slices_initial - slices_eaten result = slices_left return result
Rebecca has to study for 1hr 30min for her exam and then drive for 45 minutes to get to the exam center. If she cannot be late for the exam which starts at 8am, what is the earliest time she needs to start studying?
def solve() -> int: study_time = 90 drive_time = 45 total_time = study_time + drive_time exam_start_time = 8 * 60 earliest_start_time = exam_start_time - total_time result = f'{earliest_start_time//60}:{earliest_start_time%60:02}' return result
The length of a rectangle is twice the width. The perimeter of the rectangle is 84 meters. What's the length of the rectangle?
def solve() -> int: perimeter = 84 width = perimeter/10 length = 2*width result = length return result
Jake has a budget of $20 to buy ingredients for a fruit salad. He wants to include apples, grapes, and strawberries in his salad. He can buy apples for $0.5 each, grapes for $2 per pound, and strawberries for $3 per carton (each carton has 10 strawberries). He wants to have at least 8 apples, 2 pounds of grapes, and 5 ...
def solve() -> int: apples_price = 0.5 apples_qty = 8 grapes_price = 2 grapes_qty = 2 strawberries_price = 3 strawberries_qty = 5 total_cost = (apples_price*apples_qty) + (grapes_price*grapes_qty) + (strawberries_price*strawberries_qty) budget = 20 money_left = budget-total_cost ...
John has a 10 % decrease in his salary since last year. If his salary was $3500 last year, how much money does he have now?
def solve() -> int: salary_last_year = 3500 decrease_rate = 0.1 salary_this_year = salary_last_year * (1 - decrease_rate) result = salary_this_year return result
If Sarah wants to earn a total profit of $1000 by selling handmade bracelets, and she makes a profit of $5 for each bracelet sold, how many bracelets does she need to sell if it costs her $2 to make each bracelet?
def solve() -> int: profit_goal = 1000 profit_per_bracelet = 5 cost_per_bracelet = 2 profit_per_bracelet = profit_per_bracelet - cost_per_bracelet num_bracelets = profit_goal / profit_per_bracelet result = num_bracelets return result
A bank account earns 5% interest per year. If you deposit $2000, how much money will you have after 3 years?
def solve() -> int: principal = 2000 interest_rate = 0.05 time = 3 amount = principal * (1 + interest_rate) ** time result = amount return result
A farmer has 12 cows and 7 pigs. How many legs does the farmer’s herd have?
def solve() -> int: cows = 12 pigs = 7 cows_legs = cows * 4 pig_legs = pigs * 4 total_legs = cows_legs + pig_legs result = total_legs return result
Mary wants to buy a laptop that costs $1200. She has saved $800. She gets paid $400 every week. How many weeks does she have to work to save the remaining money?
def solve() -> int: savings = 800 cost = 1200 weekly_income = 400 weeks = (cost - savings) / weekly_income result = weeks return result
John cycles 25km per hour on his bike. How many kilometers will he cycle in 2.5 hours?
def solve() -> int: speed = 25 time = 2.5 distance = speed * time result = distance return result
Emily has $12 and each of her two siblings has $5. How much will Emily have to give to each of her siblings so that they all have the same amount of money?
def solve() -> int: emily_money = 12 sibling_money = 5 total_money = emily_money + sibling_money * 2 equal_money = total_money // 3 emily_give = emily_money - equal_money sibling_give = sibling_money - equal_money result = f'Emily will have to give ${emily_give} to each of her...
If a recipe calls for 8 cups of sugar for 48 servings, how many cups of sugar do you need to make 96 servings?
def solve() -> int: cups_total = 8 servings = 48 desired_servings = 96 result = cups_total * (desired_servings/servings) return result
A restaurant has an average of 200 customers per day over the last 3 months. If there are 20 tables in the restaurant, and the most popular table had 1500 customers, what is the average number of customers per table for the next month assuming the other tables continue their average?
def solve() -> int: avg_customers_per_day = 200 num_days_in_3_months = 90 total_customers_in_3_months = avg_customers_per_day * num_days_in_3_months num_tables = 20 most_popular_table_customers = 1500 total_customers_except_popular = total_customers_in_3_months - most_popular_table_customer...
A store sells T-shirts for $20 each. If Sam buys 3 T-shirts, but gets a 10% discount on the total price of his purchase, what is the final price that he pays?
def solve() -> int: price = 20 * 3 discount = price * 0.1 total_price = price - discount result = total_price return result
The weight of a book is 2 pounds 8 ounces. What is the weight of the book in ounces?
def solve() -> int: pounds = 2 ounces = 8 total_ounces = (pounds * 16) + ounces result = total_ounces return result
If an astronaut stayed on Orbius-5 for 146 days, how many weeks did he/she stay there?
def solve() -> int: days_in_weeks = 7 stayed_weeks = 146 / days_in_weeks result = stayed_weeks return result
A box of chocolates has 10 dark chocolates, 4 fewer milk chocolates, and 3 times as many white chocolates as milk chocolates. How many chocolates are there in the box?
def solve() -> int: dark = 10 milk = dark - 4 white = milk * 3 total = dark + milk + white result = total return result
Emily and Stacy are going to the movies. Emily bought two movie tickets at $10 each and some snacks costing $4.50. Stacy bought three movie tickets and some snacks costing $7.50. What was the total cost each person paid?
def solve() -> int: ticket_cost = 10 emily_snack_cost = 4.50 stacy_snack_cost = 7.50 emily_total_cost = 0 stacy_total_cost = 0 emily_total_cost = (ticket_cost * 2) + emily_snack_cost stacy_total_cost = (ticket_cost * 3) + stacy_snack_cost result = emily_total_cost, st...
A bakery makes 80 cupcakes. They want to divide them equally between four customers. How many cupcakes will each customer receive?
def solve() -> int: num_cupcakes = 80 num_customers = 4 num_cupcakes_per_customer = num_cupcakes / num_customers num_cupcakes_per_customer = int(num_cupcakes_per_customer) result = num_cupcakes_per_customer return result
John drove from city A to city B, the journey took him 8 hours of driving and 4 hours of stopping for breaks. If he drove at an average speed of 65 km/h, what was the total distance between city A and city B?
def solve() -> int: time = 8 + 4 speed = 65 distance = time * speed result = distance return result
Jackie and her brother William went fishing. Jackie caught 40 fish, and William caught 8 more than Jackie. How many fish did William catch in total?
def solve() -> int: jackie_fish = 40 difference = 8 williams_fish = jackie_fish + difference result = williams_fish return result
Question4: If Rachel has a total of $1200 in the bank and spends 60% of it on a laptop, how much money will she have leftover?
def solve() -> int: bank = 1200 percentage_laptop = 0.60 laptop = bank * percentage_laptop leftover = bank - laptop result = leftover return result
Possible questions and programs are: Rohan has three times as many books as Karan. Karan has eight less books than Lisa. Lisa has twice the number of books as Meena. How many books do they have together if Meena has 22 books?
def solve() -> int: meena = 22 lisa = 2 * meena karan = lisa - 8 rohan = 3 * karan total = meena + lisa + karan + rohan result = total return result
George bought 15 decorations for a holiday party. Each decoration cost David $4. How much did George spend altogether?
def solve() -> int: number_decorations = 15 cost_per_decoration = 4 total_cost = number_decorations * cost_per_decoration result = total_cost return result
Lily is frying chicken for a family dinner. Each piece of chicken needs to cook for 10 minutes on each side. Lily can fit 8 pieces of chicken in the pan at once. If 2/3 of her 15 family members want 1 piece and the rest want 2, how long will it take Lily to cook all the chicken?
def solve() -> int: num_family_members = 15 num_one_piece = (2/3) * num_family_members num_two_pieces = num_family_members - num_one_piece num_chicken = num_one_piece + (2 * num_two_pieces) num_batches = num_chicken // 8 if num_chicken % 8!= 0: num_batches += 1 total_time = num_batch...
Student: Tom deposits $100 into his bank account every 2 weeks for 20 weeks before withdrawing $30 every week for 10 weeks. What is his account balance after 30 weeks?
def solve() -> int: deposit = 100 withdrawal = 30 num_deposits = 20 num_withdrawals = 10 total_deposits = deposit * num_deposits total_withdrawals = withdrawal * num_withdrawals result = total_deposits - total_withdrawals return result
Ryan had $90. He spent $35 on 3 books. He also bought 4 lunch boxes for $10 each. How much money does he have left?
def solve() -> int: starting_amount = 90 num_books = 3 price_book = 35 num_lunch_boxes = 4 price_lunch_box = 10 total_spent = num_books * price_book total_spent += num_lunch_boxes * price_lunch_box remaining_amount = starting_amount - total_spent result = remaining_amount return...
Student: 60 books are donated to a library. 30% of them are fiction. Half of the fiction books are novels. 1/5 of the non-fiction books are biographies. How many books are biographies?
def solve() -> int: total_books = 60 percent_fiction = 0.3 percent_novels = 0.5 percent_biographies = 0.2 num_fiction = total_books * percent_fiction num_novels = num_fiction * percent_novels num_non_fiction = total_books - num_fiction num_biographies = num_non_fiction * percent_biograph...