question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A toy factory produces 60 toys every hour. It has been asked to produce 28800 toys for a new project. How many days will it take to complete the order if the factory works for 9 hours every day?
def solve() -> int: time = 0 total_produced = 0 while total_produced < 28800: total_produced += 60 time += 1 result = time // (9 * 24) return result
Anna is observing a flagpole. At the same time, the flagpole and Anna are casting shadows - the flagpole of 8 meters and Anna of 0.4 meters. Anna is 1.9 meters tall. How tall is the flagpole?
def solve() -> int: flagpole_shadow = 8 anna_shadow = 0.4 anna_height = 1.9 shadow_ratio = flagpole_shadow / anna_shadow flagpole_height = shadow_ratio * anna_height result = flagpole_height return result
7. Sara has saved up an amount of $900 in her bank account. If she earned an interest rate of 5%, how much money would she have in her account at the end of the year?
def solve() -> int: initial_amount = 900 interest_rate = 0.05 amount_after_month_one = initial_amount + (initial_amount * interest_rate) amount_after_month_two = amount_after_month_one + (amount_after_month_one * interest_rate) amount_after_month_three = amount_after_month_two + (amount_after_month...
David has 7 dollars to spend on the first day. He will spend an extra dollar each day. If he spends all of his money every day, how much money will he have spent in a week?
def solve() -> int: day1 = 7 day2 = day1+1 day3 = day2+1 day4 = day3+1 day5 = day4+1 day6 = day5+1 day7 = day6+1 total_spent = day1+day2+day3+day4+day5+day6+day7 result = total_spent return result
John has 8 different colored t-shirts and wants to wear a different one each day for a week. What is the probability that he wears a blue t-shirt on Monday and a red t-shirt on Friday?
def solve() -> int: POSSIBLE_SHIRTS = 8 MONDAY_PROBABILITY = 1/POSSIBLE_SHIRTS FRIDAY_PROBABILITY = 1/(POSSIBLE_SHIRTS-1) PROBABILITY = MONDAY_PROBABILITY * FRIDAY_PROBABILITY result = PROBABILITY return result
Samantha wants to buy a new phone which costs $700. She has saved $300 from her previous salary and her parents promised her to give $200 as a gift. How much more money does Samantha need to buy the phone?
def solve() -> int: savings = 300 parent_gift = 200 phone_cost = 700 money_needed = phone_cost - savings - parent_gift result = money_needed return result
In a classroom, there are 35 students. Fifteen students scored 80 on a test, 10 scored 10 points less, and the rest scored 60. What was the average score for the whole class?
def solve() -> int: students = 35 score_80 = 15 score_70 = 10 score_60 = students - score_80 - score_70 total_score = (score_80 * 80) + (score_70 * 70) + (score_60 * 60) average_score = total_score / students result = average_score return result
A family of four is going to a museum. The admission fee is $12 for adults and $8 for children under 12. The family has a coupon that gives them 25% off the total cost. How much do they have to pay after using the coupon?
def solve() -> int: adult_fee = 12 child_fee = 8 discount = 0.25 total_cost = 2 * adult_fee + 2 * child_fee discounted_cost = total_cost * (1 - discount) result = round(discounted_cost, 2) return result
-Have space between each question/program Possible math questions and programs are: Bella had 60 cookies in her jar. She ate 1/4 of them for breakfast and gave 1/3 of the remaining cookies to her friend Jake. Then, she baked 12 more cookies and put them in the jar. How many cookies did Bella have in her jar at the end ...
def solve() -> int: cookies = 60 breakfast = cookies // 4 cookies -= breakfast jake = cookies // 3 cookies -= jake cookies += 12 result = cookies return result
John has a collection of 10 toy cars. His friend gives him 3 more toy cars. If John loses 2 cars, how many toy cars does he have now?
def solve() -> int: toy_cars_owned = 10 toy_cars_gifted = 3 toy_cars_lost = 2 total_toy_cars = toy_cars_owned + toy_cars_gifted - toy_cars_lost result = total_toy_cars return result
If a rectangular field is 20 meters wide and has a perimeter of 100 meters, what is the length of the field?
def solve() -> int: perimeter = 100 width = 20 length = (perimeter - 2*width) / 2 result = length return result
A store is selling textbooks. A math textbook is $50, a history textbook is $40 and an English textbook is $35. If someone buys one of each textbook, and they get a 20% discount on their total purchase, how much would they need to pay in total?
def solve() -> int: math_textbook_cost = 50 history_textbook_cost = 40 english_textbook_cost = 35 total_cost = math_textbook_cost + history_textbook_cost + english_textbook_cost discounted_cost = total_cost * 0.8 result = discounted_cost return result
A rectangle has a perimeter of 72cm. If one side is 10cm long, how long is the other side?
def solve() -> int: perimeter = 72 side1 = 10 side2 = (perimeter-2*side1)/2 result = side2 return result
Michael cooked dinner that took him 30 more minutes than it took Maria to cook. Maria cooked for 1 hour and 10 minutes. How long, in total, did they spend cooking?
def solve() -> int: maria_cooking_time = 70 michael_cooking_time = maria_cooking_time + 30 total_cooking_time = maria_cooking_time + michael_cooking_time result = total_cooking_time return result
A school is organizing a field trip, and they need transportation for 40 students. Each bus can hold 20 students. How many buses does the school need to hire?
def solve() -> int: num_students = 40 bus_capacity = 20 num_buses = num_students // bus_capacity + (num_students % bus_capacity > 0) result = num_buses return result
A student needs to buy 4 notebooks at $2 each, 3 pens at $1 each, and a calculator for $20. What is the total cost of these items?
def solve() -> int: notebooks_cost = 4 * 2 pens_cost = 3 * 1 calculator_cost = 20 total_cost = notebooks_cost + pens_cost + calculator_cost result = total_cost return result
A bus can carry 40 passengers. It takes 5 trips to transport all the students from a school to a museum. How many students are in the school?
def solve() -> int: passengers = 40 total_passengers = passengers * 5 result = total_passengers return result
Rosa wants to buy a pair of shoes that costs $120, but there is a 15% discount on all items in the store. How much does she have to pay for the shoes, including 7% sales tax?
def solve() -> int: discounted_price = 120 * (1 - 0.15) total_price = discounted_price * (1 + 0.07) total_price = round(total_price, 2) result = total_price return result
At the science fair, there are 500 projects. A third of the projects are about biology. Of the projects about biology, half of them are done by female student researchers. Of the female-student researchers, a fifth of them are presenting their projects for the first time. How many female student researchers are present...
def solve() -> int: projects = 500 biology_projects = projects / 3 female_researchers = biology_projects / 2 first_time_presenters = female_researchers / 5 result = first_time_presenters return result
``` A bookshelf contains 36 books. Two-third of the books are fiction and the rest are non-fiction. How many non-fiction books are there?
def solve() -> int: total_books = 36 fiction_books = (2/3)*total_books non_fiction_books = total_books - fiction_books result = non_fiction_books return result
A store is having a sale with 25% off on all products. If buy a shirt for $40 before discount, what is the price of the shirt after the discount?
def solve() -> int: original_price = 40 discount = original_price * 0.25 new_price = original_price - discount result = new_price return result
Ali has a video camera that can record 60 minutes of high-definition video at 3 gigabytes per hour. He also has a memory card that can hold 12 gigabytes of data. How many minutes of high-definition video can he record on his memory card?
def solve() -> int: gigabyte = 1024 video_size = 3 * gigabyte memory_card_size = 12 * gigabyte ratio = video_size / memory_card_size recording_time = ratio * 60 result = recording_time return result
The cost of a toy is $24.75 inclusive of a tax of 5%. What is the price of the toy before tax?
def solve() -> int: total_cost = 24.75 tax_rate = 5 price_before_tax = total_cost / (1 + (tax_rate/100)) result = price_before_tax return result
Student: A recipe for a smoothie calls for 1 banana, 1/2 cup of berries, and 1 cup of milk. If the blender can only hold 2 cups of liquid at most, what is the maximum number of smoothies that can be made at once?
def solve() -> int: banana = 1 berries = 0.5 milk = 1 max_liquid = 2 result = min(max_liquid // milk, max_liquid // (banana + berries)) return result
Bob is a taxi driver. He charges $1.5 per mile and a $2 base fare. He drives an average of 150 miles per day and works 5 days a week. He spends $50 on gas and $20 on maintenance per week. How much money does he make in a month?
def solve() -> int: rate = 1.5 distance = 150 base_fare = 2 income_per_day = rate * distance + base_fare number_of_days = 5 income_per_week = income_per_day * number_of_days number_of_weeks = 4 income_per_month = income_per_week * number_of_weeks gas = 50 maintenance = 20 exp...
A bakery sells cupcakes for $2.50 each. If Emily bought 6 cupcakes, what is the total cost, including a 6% sales tax?
def solve() -> int: num_cupcakes = 6 cost_cupcake = 2.50 subtotal = num_cupcakes*cost_cupcake sales_tax_rate = 0.06 sales_tax = sales_tax_rate*subtotal total_cost = subtotal + sales_tax result = f'Emily should pay ${total_cost} for the cupcakes, including sales tax.' result = total_cost ...
Sarah has 90 balloons for her party. She pops ten accidentally, inflates fifteen more, and then gives away twenty to her guests. Afterwards, she decides to take six balloons to her neighbor. How many balloons are left for Sarah's party?
def solve() -> int: balloons = 90 balloons -= 10 balloons += 15 balloons -= 20 balloons -= 6 result = balloons return result
Frank has 24 pencils. He uses 4 pencils every week for his homework. How many pencils will he have left after 5 weeks?
def solve() -> int: pencils = 24 pencils_used = 4 * 5 pencils_left = pencils - pencils_used result = pencils_left return result
A travel agency sold 100 vacation packages, with 60 of them being for cruises. If they want the cruises to make up at least 75% of the packages sold, how many more packages need to be sold total?
def solve() -> int: total_packages = 100 cruise_packages = 60 target_percentage = 0.75 target_packages = total_packages * target_percentage additional_packages = target_packages - cruise_packages result = additional_packages return result
There are 30 children in a class. The teacher wants to distribute 120 pencils equally among all children. Each child should get how many pencils?
def solve() -> int: number_of_children = 30 total_pencils = 120 pencils_per_child = total_pencils // number_of_children result = pencils_per_child return result
Question8:Judy had 5 packs of stickers. Each pack had 30 stickers of different colors. She gave away 3 packs and kept the other 2. How many stickers did she have left?
def solve() -> int: packs_of_stickers = 5 stickers_per_pack = 30 gave_away = 3 total = (packs_of_stickers - gave_away) * stickers_per_pack result = total return result
``` The perimeter of a rectangle is 26 inches and its width is 4 inches. What is the length of the rectangle?
def solve() -> int: perimeter = 26 width = 4 length = (perimeter - 2*width) / 2 result = length return result
ve wants to buy a new phone. The phone costs $736.00 and he wants to buy a case and a pair of headphones as well. The case costs $15.00 and the headphones cost $50.00. How much money will Steve need to pay in total?
def solve() -> int: phonePrice = 736.00 casePrice = 15.00 headphonesPrice = 50.00 totalPhoneCost = phonePrice totalCaseCost = casePrice totalHeadphonesCost = headphonesPrice totalCost = totalPhoneCost + totalCaseCost + totalHeadphonesCost result = totalCost ...
Luis wants to build a rectangular swimming pool in his backyard, which has an area of 400 sq ft. He wants the pool to have a length of 20 ft and a width that is half of the length. He also wants to leave a 5 ft border around the pool for landscaping. How much sq ft of his backyard will be left for landscaping?
def solve() -> int: backyard = 400 length = 20 width = length / 2 border = 5 pool = length * width pool_with_border = (length + 2 * border) * (width + 2 * border) landscaping = backyard - pool_with_border result = landscaping return result
A class has 20 students. If there are 8 girls in the class, how many boys are there in the class?
def solve() -> int: girls = 8 boys = 20 - girls result = boys return result
David wants to invest $10,000 in a bank. The interest rate is 5%. If he wants to earn an interest of $1,000, after how many years does he need to withdraw his money?
def solve() -> int: principal = 10000 interest_rate = 0.05 required_interest = 1000 time = required_interest / (principal * interest_rate) result = time return result
William works at a restaurant. If he earns $13 an hour, how much will he earn for 8 hours?
def solve() -> int: rate_of_pay = 13 number_of_hours_worked = 8 total_wage = rate_of_pay * number_of_hours_worked result = total_wage return result
If the area of a square is 121 sq. cm, what is the length of its sides?
def solve() -> int: area = 121 side = area**0.5 result = side return result
Lisa has 12 oranges and each orange has 17 seeds. How many total seeds does she have?
def solve() -> int: oranges = 12 seeds = 17 total = oranges * seeds result = total return result
I invested $5000 in a scheme for 2 years at an interest rate of 8% per annum. How much money did I get back after 2 years?
def solve() -> int: principal_amount = 5000 interest_rate = 8 time_in_years = 2 interest = (principal_amount * interest_rate * time_in_years) / 100 maturity_amount = principal_amount + interest result = maturity_amount return result
A car travels 120 miles in 2 hours. If it maintains this speed, how far will it travel in 3.5 hours?
def solve() -> int: distance = 120 time = 2 speed = distance / time new_time = 3.5 new_distance = speed * new_time result = new_distance return result
Nina baked 24 muffins and sold them for $1.50 each. She spent $8 on the ingredients and $2 on the paper cups. How much profit did she make?
def solve() -> int: muffins = 24 muffin_price = 1.5 ingredients = 8 cups = 2 revenue = muffins * muffin_price cost = ingredients + cups profit = revenue - cost result = profit return result
A store sells apples for $0.75 each. If a customer buys 6 apples, they get the 7th for half-off. How much will it cost to buy 10 apples?
def solve() -> int: apple_cost = 0.75 num_apples = 10 num_seven_sets = num_apples // 7 discounted_apples = num_seven_sets remaining_apples = num_apples % 7 if remaining_apples >= 6: discounted_apples += 1 total_cost = (num_apples - discounted_apples) * apple_cost + discounted_apples * ...
Jaden's family is buying gifts for the holidays. There are 8 family members and they want to buy a gift for 25% of them. If gifts cost $50 each, and they have $300, what percentage of their money will they spend on gifts?
def solve() -> int: family_members = 8 gift_percentage = 0.25 gift_cost = 50 total_money = 300 gifts_to_buy = family_members * gift_percentage total_cost = gifts_to_buy * gift_cost percentage_spent = (total_cost / total_money) * 100 result = percentage_spent return result
A store purchased 4 tablets at $950 each. If it sold all four tablets at an 8.33% mark-up, how much total profit did the store make?
def solve() -> int: cost = 950 * 4 sale = 950 * 4 * 1.0833 profit = sale - cost result = profit return result
A car travels at a speed of 60 miles per hour. How long will it take the car to travel a distance of 480 miles?
def solve() -> int: distance = 480 speed = 60 time = distance / speed result = time return result
A pencil shop has 100 pencils originally. If the shop purchases 20 more pencils, and the shop then sells 3 times as many pencils as it initially had, how many total pencils does it now have?
def solve() -> int: initial_pencils = 100 added_pencils = 20 total_pencils = initial_pencils + added_pencils pencils_sold = total_pencils * 3 remaining_pencils = total_pencils - pencils_sold result = remaining_pencils return result
Question6:If you have $87 and you want to buy 3 sweaters that cost $21 each, how much money will you have left from the purchase?
def solve() -> int: leftover_money = 87 - 3*21 result = leftover_money return result
A car can travel 48 miles on 1 gallon of fuel. If a journey is 320 miles long, how many gallons of fuel does the car need?
def solve() -> int: Fuel_used = 320/48 result = Fuel_used return result
In a class of 30 students, 1/3 of the students wear glasses and among those, 2/5 are boys. How many boys in the class wear glasses?
def solve() -> int: num_students = 30 glasses_wearers = num_students * (1/3) boys_glasses = glasses_wearers * (2/5) result = boys_glasses return result
A printer is sold for $100 with a profit of 50%. How much did the printer cost?
def solve() -> int: printer_sale_price = 100 profit = 0.5 printer_cost = printer_sale_price/(1+profit) result = f'<<<{printer_cost}>>>' result = printer_cost return result
There are 3 red apples, 5 green apples, and 7 yellow apples in a basket. What percentage of the apples are green?
def solve() -> int: total_apples = 15 green_apples = 5 percent_green = (green_apples / total_apples) * 100 result = percent_green return result
On a blueprint, 1/8 inch represents 5 feet of actual building length. The offices of Smith and Jones are represented by points 1 7/8 inches apart. What is the actual distance, in feet, between the offices?
def solve() -> int: distance_in_inches = 1 + 7/8 distance_in_feet = distance_in_inches * (1/8 * 5) result = distance_in_feet print return result
A pizza is regularly priced at $20 for a large and $16 for a medium. If there is a 25% off sale, what is the sale price for a large and a medium pizza?
def solve() -> int: reg_price_large = 20 reg_price_medium = 16 discount_rate = 25 discount_amount_large = reg_price_large * (discount_rate/100) discount_amount_medium = reg_price_medium * (discount_rate/100) sale_price_large = reg_price_large - discount_amount_large sale_price_medium = reg_p...
A rectangle has a length of 12 feet and a width of 8 feet. What is the perimeter of the rectangle?
def solve() -> int: length = 12 width = 8 perimeter = 2 * length + 2 * width result = perimeter return result
A family went on a road trip and rented a car for $100 per day. The car also had a fuel efficiency of 25 miles per gallon and the family had to pay for the gas they used. The gas price was $3 per gallon. The family drove a total of 400 miles in 3 days and returned the car with a full tank of gas. How much did the famil...
def solve() -> int: rental_rate = 100 fuel_efficiency = 25 gas_price = 3 total_miles = 400 days = 3 gallons = total_miles / fuel_efficiency gas_cost = gallons * gas_price rental_cost = rental_rate * days result = gas_cost + rental_cost return result
A store sells a dress for $50. It costs them $30 to make the dress. What profit does the store make if they sell 20 dresses?
def solve() -> int: dress_cost = 30 dress_price = 50 dress_profit = dress_price - dress_cost total_profit = dress_profit * 20 result = total_profit return result
If Ali told her daughter that a good quality car tire can last 2 years more than an average tire, and an average tire can last for 4 years. How long can a good quality car tire last?
def solve() -> int: average_tire = 4 good_quality_tire = average_tire + 2 result = good_quality_tire return result
Meha wants to have a water treasure hunt with her friends. She goes to the store to buy balloons and sees that they sell small bags for $2, medium bags for $3 and large bags for $5. She has $20 and wants to get the greatest value of balloons as possible. If the $2 bags contain 30 balloons, the $3 bags contain 50 balloo...
def solve() -> int: cost_sm_bags = 2 cost_med_bags = 3 cost_lrg_bags = 5 num_sm_balloons = 30 num_med_balloons = 50 num_lrg_balloons = 100 total_money = 20 max_sm_bags = total_money // cost_sm_bags max_value_sm_bags = max_sm_bags * num_sm_balloons max_med_bags = total_m...
Alex's mom is 4 times as old as Alex. When Alex is 12 years old, how old will his mom be?
def solve() -> int: alex_age = 12 mom_age = 4 * alex_age mom_age_when_alex_is_12 = mom_age + (12 - alex_age) result = mom_age_when_alex_is_12 return result
A baking recipe calls for 3 cups of sugar and 4 cups of flour to make 12 cupcakes. If a baker wants to make 48 cupcakes, how many cups of sugar and how many cups of flour does the recipe require?
def solve() -> int: original_sugar = 3 original_flour = 4 original_cupcakes = 12 num_cupcakes = 48 sugar_per_cupcake = original_sugar / original_cupcakes flour_per_cupcake = original_flour / original_cupcakes sugar_required = sugar_per_cupcake * num_cupcakes flour_required = flour_per_cu...
If a car travels at an average speed of 80 kilometers per hour and covers a distance of 320 kilometers, how long does it take to complete the journey?
def solve() -> int: speed = 80 distance = 320 time = distance / speed result = time return result
There are 60 students in a class and 70% of them passed an exam. How many students failed the exam?
def solve() -> int: total_students = 60 pass_percentage = 70 fail_percentage = 100 - pass_percentage students_failed = (fail_percentage / 100) * total_students result = students_failed return result
acey wants to bake cookies for a party. Her recipe calls for 3/4 cups of sugar and makes 12 cookies. If she wants to make 48 cookies, how much sugar will she need?
def solve() -> int: sugar_for_12_cookies = 0.75 cookies_wanted = 48 sugar_needed = (sugar_for_12_cookies / 12) * cookies_wanted result = sugar_needed return result
Ryan and his family played two different board games. The first game took 20 minutes to finish while the second game took 25 minutes longer than the first. Before playing the games, they spent 10 minutes setting up the game boards. How long did they spend playing board games?
def solve() -> int: first_game_time = 20 second_game_time = first_game_time + 25 setup_time = 10 total_time = first_game_time + second_game_time + setup_time result = total_time return result
If the sum of two numbers is 35 and one number is 11 more than the other, what are the two numbers?
def solve() -> int: sum_numbers = 0 number1 = 0 number2 = 0 result = (number1, number2) return result
A man wants to purchase a house worth $250,000 with a 20% down payment. How much does he need to pay as the down payment?
def solve() -> int: home_price = 250000 down_payment_percentage = 20/100 down_payment = home_price * down_payment_percentage result = down_payment return result
A factory makes 12 toys per hour. If they need to make 1200 toys in a week of 40 hours, how many machines must they use for the job?
def solve() -> int: hours_per_week = 40 toys_per_hour = 12 total_toys = 1200 machines_needed = (total_toys)/(hours_per_week*toys_per_hour) result = round(machines_needed) return result
Harry started painting when he was 15. When he first started he could paint a small canvas with basic colors in an hour. He manages to increase his speed by 50% and improve his color blending skills. What is his new painting capacity?
def solve() -> int: starting_age = 15 starting_capacity = 1 speed_increase = 0.5 new_capacity = starting_capacity * (1 + speed_increase) result = new_capacity return result
In a certain class, there are twice as many quizzes as tests. There are also 25 more homework assignments than quizzes. If the class has 225 assignments, how many tests are there?
def solve() -> int: assignments = 225 quizdiffer = 25 testnum = (assignments - quizdiffer) // 3 result = testnum return result
Lisa and Mary both bake cookies for a bake sale. Lisa bakes 24 cookies every hour and Mary bakes 18 cookies every hour. Lisa starts baking one hour earlier than Mary. If Lisa stops baking after 3 hours, how long will Mary have to bake to make the same number of cookies as Lisa?
def solve() -> int: cookies_lisa = 24 * 3 time_mary = cookies_lisa / 18 result = time_mary return result
Kate and her brother Julian went to the pet store. Kate bought 6 hermit crabs and Julian bought half the number of crabs that Kate bought. How many crabs did Julian buy?
def solve() -> int: katesCrabNum = 6 juliansCrabNum = katesCrabNum / 2 result = juliansCrabNum return result
Robert has 70 baseball cards. He decided to keep only 5 cards and gave some of his cards to David. Then, he met 3 friends and gave them each 9 cards. The rest of his cards were given equally to his 5 nieces. If each niece got 13 cards, how many cards did Robert give to David?
def solve() -> int: cards_initial = 70 cards_kept = 5 cards_given_away = cards_initial - cards_kept cards_given_to_David = cards_given_away - (3*9) - (5*13) result = cards_given_to_David return result
A sunflower has 34 petals, while a daisy has 21 petals. What is the percentage difference in their petal number, expressed as a percentage of the sunflower's petal number?
def solve() -> int: result = (13 / 34) * 100 return result
Peter likes exploring new neighborhoods on his bike. Starting from his house, he rides 300 yards to the town center. Then he rides 2 kilometers down the Main Street until he reaches the outskirts of town. He decides to ride halfway back to the town center before turning around and riding to the end of his route. Finall...
def solve() -> int: distance_to_town_center = 300 distance_down_main_street = 2000 total_distance = distance_to_town_center + distance_down_main_street halfway_distance = total_distance / 2 remaining_distance = total_distance - halfway_distance total_distance_ridden = remaining_distanc...
Liam picks three more than three times as many blue marbles as yellow marbles. If there are 15 yellow marbles, how many marbles are there in total?
def solve() -> int: blue_marbles = 3 * 15 + 3 total_marbles = blue_marbles + 15 result = total_marbles return result
Jonathan sells cupcakes from a cart. He has a total of 48 cupcakes, 12 with sprinkles, 16 with icing, and 4 with both. How many cupcakes don't have any decorations?
def solve() -> int: sprinkles_cupcakes = 12 icing_cupcakes = 16 both_sprinkles_and_icing = 4 total_cupcakes = sprinkles_cupcakes + icing_cupcakes + both_sprinkles_and_icing result = 48 - total_cupcakes return result
If Tyler spent 2 hours completing 500 work tasks at $0.10 each and then spent 1.5 hours completing 8 work tasks at $2.50 each, how much more money did he make doing the high-paying work than the low-paying work?
def solve() -> int: low_hours = 2 low_tasks = 500 low_rate = 0.10 high_hours = 1.5 high_tasks = 8 high_rate = 2.50 low_earnings = low_hours * low_tasks * low_rate high_earnings = high_hours * high_tasks * high_rate difference = high_earnings - low_earnings ...
John has 5 dimes, 3 quarters, and 11 pennies. If he trades one dime for a nickel, how much money does he have now?
def solve() -> int: dimes = 5 quarters = 3 pennies = 11 dimes -= 1 nickels = 2 total_money = (dimes * 10) + (quarters * 25) + (nickels * 5) + pennies result = total_money return result
A bag of candy has 20 pieces. Lola ate 1/5 of the candy and then shared the rest equally with her two brothers. How many pieces of candy did each brother get?
def solve() -> int: pieces_eaten_by_Lola = 1/5 * 20 pieces_left_after_Lola = 20 - pieces_eaten_by_Lola pieces_per_brother = pieces_left_after_Lola / 2 result = pieces_per_brother return result
A laptop costs $1000 and a printer costs two thirds as much. If you buy two laptops and three printers, what is the total cost?
def solve() -> int: laptop_cost = 1000 printer_cost = 2/3 * laptop_cost total_cost = 2 * laptop_cost + 3 * printer_cost result = total_cost return result
Tom ran 6 miles to the West and then walked 3 miles to the South. He then ran twice as far as he had walked in the opposite direction before stopping. If his total trip took 2 hours and his running speed is 6 miles per hour while his walking speed is 3 miles per hour, how long did he run?
def solve() -> int: distance_west = 6 distance_south = 3 distance_east = 2 * distance_south total_distance = distance_west + distance_south + distance_east time_walking = (distance_south + distance_east) / 3 time_running = (total_distance - time_walking * 3) / 6 result = time_running re...
A library had 120 books on its shelves. In the first week of the month, they lent out 25 books, added 17, and had to replace 3 books. How many books does the library have now?
def solve() -> int: books_on_shelves = 120 books_lent_out = 25 books_added = 17 books_replaced = 3 books_on_shelves -= books_lent_out books_on_shelves += books_added books_on_shelves -= books_replaced result = books_on_shelves return result
A student takes 5 courses, each costing $200. If the student drops one course and receives a 50% refund, how much money did the student save?
def solve() -> int: num_courses = 5 course_cost = 200 percent_refund = 0.5 original_total_cost = num_courses * course_cost new_total_cost = (num_courses - 1) * course_cost * (1 - percent_refund) amount_saved = original_total_cost - new_total_cost result = amount_saved return result
After their vacation, three roommates agreed to split the cost of the hotel room, which is $360. If one roommate is only able to pay $163, how much does the other two need to pay in order to make the cost of the hotel room equal?
def solve() -> int: amount_owed_by_1 = 163 amount_owed_for_all = 360 amount_owed_for_2 = amount_owed_for_all - amount_owed_by_1 result = amount_owed_for_2 return result
A carpenter bought 360 ft of wood. If he used 3/4 of it, how many feet of wood did he use?
def solve() -> int: total_feet = 360 used_fraction = 3/4 used_feet = total_feet * used_fraction result = used_feet return result
Three people go to a movie theater and split equally a bill of $45. If there are 2 types of tickets available, regular tickets for $7 and VIP tickets for $12, and they bought a total of 5 VIP tickets, how many regular tickets did they buy?
def solve() -> int: num_people = 3 total_cost = 45 num_vip_tickets = 5 vip_ticket_cost = 12 regular_ticket_cost = 7 vip_tickets_cost = num_vip_tickets * vip_ticket_cost regular_tickets_cost = total_cost - vip_tickets_cost num_regular_tickets = regular_tickets_cost // regular_ticket_cost...
The ages of Sophie and George are in the ratio of 3:4. In 10 years, Sophie will be 30 years old. What's the age of George at present?
def solve() -> int: ratio_4 = [3,4] x = 20 value_of_part_4 = x / sum(ratio_4) george_age = ratio_4[1] * value_of_part_4 result = george_age return result
A farmer needs to sell 200 crates of eggs at $6 per crate to make $400 in profit. He bought the eggs for $2 per dozen. Each crate has 2.5 dozen eggs. How many dozens of eggs did he buy in total?
def solve() -> int: total_dozen_eggs = (200*6 + 400)/(2*2.5 - 2) result = total_dozen_eggs return result
Student: If it takes 8 electricians 30 days to set up lightings in 200 rooms, how many electricians are needed to set up lightings in 400 rooms in 45 days?
def solve() -> int: electricians_1 = 8 days_1 = 30 rooms_1 = 200 rooms_2 = 400 days_2 = 45 electricians_2 = (electricians_1 * rooms_2 * days_1) / (rooms_1 * days_2) result = round(electricians_2) return result
Charlie went to a candy store to buy some sweets. He bought 3 chocolate bars for $1 each, 2 lollipops for $0.5 each, and 4 gummy bears for $0.25 each. He had $5 for his shopping. How much money did Charlie have left?
def solve() -> int: chocolate = 1 lollipop = 0.5 gummy = 0.25 chocolate_num = 3 lollipop_num = 2 gummy_num = 4 total = chocolate * chocolate_num + lollipop * lollipop_num + gummy * gummy_num left = 5 - total result = left return result
Student: Ray earns $10 per hour, and he worked for 5 hours a day for 16 days. If he saves 1/4 of his earnings, how much did he save in the end?
def solve() -> int: hourly_rate = 10 hours_per_day = 5 days_worked = 16 total_earnings = hourly_rate * hours_per_day * days_worked savings_percentage = 1/4 savings_amount = total_earnings * savings_percentage result = savings_amount return result
Student: Stella painted 8 houses, and each house took her 3 hours. How many hours did she spend painting?
def solve() -> int: houses = 8 hours_per_house = 3 total_hours = houses * hours_per_house result = total_hours return result
A car traveled 80 miles in 2 hours. If it maintained the same speed, how many miles will it travel in 5 hours?
def solve() -> int: distance = 80 time = 2 speed = distance / time new_time = 5 new_distance = speed * new_time result = new_distance return result
A rectangular garden has a length of 10 feet and a width of 8 feet. What is the perimeter of the garden in feet?
def solve() -> int: length = 10 width = 8 perimeter = 2 * (length + width) result = perimeter return result
If Jane drinks 2 cups of water one day, then drinks 1 more cup than that the following day, and then doubles the previous amount the next day, and then finally triples the previous amount the final day, how many cups of water did she drink in that four day period?
def solve() -> int: total_water = 0 day1 = 2 total_water += day1 day2 = day1 + 1 total_water += day2 day3 = day2 * 2 total_water += day3 day4 = day3 * 3 total_water += day4 result = total_water return result
Anna spent $45 on 9 pens. What was the cost of one pen?
def solve() -> int: total_cost = 45 num_pens = 9 cost_per_pen = total_cost/num_pens result = cost_per_pen return result
Possible questions and programs are: Brenda wants to drive from her home to her friend's house, which is 36 miles away. She knows that the average speed limit on the roads is 45 miles per hour, but she also expects to spend 15 minutes in traffic. How much time does she have to leave before her friend's party starts at ...
def solve() -> int: time_in_traffic = 15 / 60 time_on_road = 36 / 45 total_time = time_in_traffic + time_on_road total_time_in_minutes = total_time * 60 time_to_leave = 360 - total_time_in_minutes result = time_to_leave return result
A store sells socks in packs of 5 pairs each. If the store sold 185 pairs of socks, how many packs of socks did they sell?
def solve() -> int: socks_sold = 185 packs_sold = socks_sold // 5 result = packs_sold return result
A box of chocolates contains 16 candies. A group of 10 people, each person takes 3 candies. What is the total number of chocolate boxes needed for the group?
def solve() -> int: people = 10 candy_per_person = 3 candy_per_box = 16 total_candy_needed = people * candy_per_person total_box_needed= total_candy_needed//candy_per_box if (total_candy_needed % candy_per_box!= 0): total_box_needed += 1 result = total_box_needed return result