question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A farmer has 18 chickens and 12 cows. Each chicken lays 6 eggs per week and each egg sells for $0.2. Each cow produces 15 liters of milk per week and each liter sells for $0.8. How much money does the farmer earn per week from selling eggs and milk?
def solve() -> int: eggs = 18 * 6 milk = 12 * 15 egg_income = eggs * 0.2 milk_income = milk * 0.8 money = egg_income + milk_income result = money return result
A rectangular garden has a perimeter of 36 meters. The garden is twice as long as it is wide. What is the area of the garden?
def solve() -> int: width = 36 / 2 / (1 + 2) length = 2 * width area = width * length result = area return result
Bob has a pack of 24 pencils. He wants to give 5 pencils to each of his friends. How many friends can he give pencils to?
def solve() -> int: pencils = 24 pencils_per_friend = 5 friends = pencils//pencils_per_friend result = friends return result
If a pizza is cut into 8 slices and 3 slices are eaten, how many slices remain?
def solve() -> int: total_slices = 8 eaten_slices = 3 remaining_slices = total_slices - eaten_slices result = remaining_slices return result
A car is traveling at a speed of 50 miles per hour. How far will the car travel in 3 hours?
def solve() -> int: distance = 50*3 result = distance return result
Tom and Mia are playing a card game. They each start with 10 cards. Then they draw some cards from a deck. Tom draws 6 cards, but 2 of them are jokers, so he discards them. Mia draws 5 cards, but 1 of them is a joker, so she discards it. How many cards do Tom and Mia have altogether?
def solve() -> int: tom = 10 mia = 10 tom_draw = 6 mia_draw = 5 tom_joker = 2 mia_joker = 1 tom_keep = tom_draw - tom_joker mia_keep = mia_draw - mia_joker total = tom + mia + tom_keep + mia_keep result = total return result
John can mow a lawn in 3 hours. If his friend Peter helps, the same lawn can be mowed in 1.5 hours. How long would it take Peter to mow the lawn alone?
def solve() -> int: time_for_john_alone = 3 time_for_john_and_peter = 1.5 time_for_peter_alone = (time_for_john_alone * time_for_john_and_peter) / (time_for_john_alone - time_for_john_and_peter) result = time_for_peter_alone return result
A factory produces 1000 widgets per hour, but has a 10% error rate. Of the 10% of the widgets with errors, 80% can be fixed and sold at a reduced price. How many sellable widgets are produced in a 8-hour workday?
def solve() -> int: widgets_per_hour = 1000 error_rate = 0.1 fixed_error_rate = 0.8 hours_worked = 8 total_widgets_produced = widgets_per_hour * hours_worked errored_widgets = total_widgets_produced * error_rate error_fixed_widgets = errored_widgets * fixed_error_rate sellable_widge...
Alice and Bob collected some apples and oranges from their garden. Alice collected 24 apples and 18 oranges, while Bob collected 12 apples and 24 oranges. They decided to share their fruits equally with their friends Carol and Dan. How many apples did each friend get?
def solve() -> int: total_apples = 24 + 12 total_oranges = 18 + 24 share_apples = total_apples // 4 share_oranges = total_oranges // 4 result = share_apples return result
Mia wants to paint her rectangular bedroom wall that has a length of 12 feet and a height of 8 feet. She has a can of paint that can cover 400 square feet of surface area. How many cans of paint does she need to paint the entire wall?
def solve() -> int: area = 12 * 8 cans = area / 400 result = cans return result
In a school, there are 190 students. On the first day, 40 percent of the students ate an apple, on the second day, 45 percent of the remaining students ate an orange. How many students ate a fruit on both days?
def solve() -> int: students_ate_apple = 190 / 100 * 40 students_ate_orange = (190 - students_ate_apple) / 100 * 45 total_students_ate_fruit = students_ate_apple + students_ate_orange result = total_students_ate_fruit return result
Ben is taking 30 piano classes. The first class is free and after the first 15 paid classes, he only needs to pay for every fourth class. Each class costs $10. His mom pays for 80% of the classes. How much does Ben pay?
def solve() -> int: classes = 30 first_class = 0 paid_classes = 15 free_classes = 1 cost_per_class = 10 mom_payment_percentage = 0.8 total_cost = (paid_classes - free_classes) * cost_per_class + (classes - paid_classes) // 4 * cost_per_class ben_payment = total_cost * (1 - mom_payme...
Student: John owns a dog store which earns a net income of $100,000. He decides to expand his business by opening a new store in a nearby city and wants to save 20% of his earnings for the new store. How much money does John need to save?
def solve() -> int: net_income = 100000 savings_percentage = 0.2 savings_amount = net_income * savings_percentage result = savings_amount return result
A family of six go to an amusement park. The cost of admission is $50 per person. If they also spend $100 on food and souvenirs, and one person pays for everything, how much does that person pay?
def solve() -> int: num_people = 6 cost_per_person = 50 total_cost_admission = num_people * cost_per_person cost_food_souvenirs = 100 total_cost = total_cost_admission + cost_food_souvenirs result = total_cost return result
Student: A company sold 220 items at a sale and made a total profit of $732. If each item was sold for the same amount, how much did the company make per item?
def solve() -> int: items_sold = 220 total_profit = 732 price_per_item = total_profit / items_sold result = price_per_item return result
Student: **Question 1**: Amy has 25 pencils and John has 22 pencils. How many more pencils does Amy have than John?
def solve() -> int: amy_pencils = 25 john_pencils = 22 difference = amy_pencils - john_pencils result = difference return result
Maria is cooking a meal for her family. She has 2.5 pounds of carrots, 1.5 pounds of potatoes, and 3.5 pounds of cabbage that she needs to use. How many total pounds of food does Maria have?
def solve() -> int: total_weight = 2.5 + 1.5 + 3.5 result = total_weight return result
Daniel started counting jumping jacks and reached 154. If he started with 5 jumping jacks, how many did he do to reach 154?
def solve() -> int: start_jumping = 5 end_jumping = 154 number_of_jumps = end_jumping - start_jumping result = number_of_jumps return result
Susan wants to go on a vacation. She has decided to save money every month. If she started saving $300 this month, and plans to increase her savings by $75 each month, how much money will she have saved in 4 months from now?
def solve() -> int: savings = 300 increment = 75 total_savings = savings + increment*3 result = total_savings return result
A company is offering a 15% bonus to all employees who meet their sales goals for the quarter. If John's sales for the quarter were $25,000 and his goal was $30,000, how much of a bonus will he receive?
def solve() -> int: bonus_amount = (30000 - 25000) * 0.15 result = bonus_amount return result
If Carol charges $12 per hour for tutoring and made a profit of $480 while paying $6 per hour to the tutor, how many hours did she tutor for?
def solve() -> int: tutor_rate = 6 tutor_profit = 480 tutor_charge = 12 hours_tutored = tutor_profit / (tutor_charge - tutor_rate) result = hours_tutored return result
Alex painted the wall and covered five-eighths of the paint chips with the new color. As they walked across the wall afterward, their sleeve scraped off 137 chips. How many paint chips were on the wall before Alex painted if there were 293 after they finished?
def solve() -> int: paint_chips_after = 293 chips_scraped_off = 137 paint_chips_covered = 5/8 total_paint_chips = (paint_chips_after + chips_scraped_off) / (1 - paint_chips_covered) result = total_paint_chips return result
Ethan can run 1 mile in 5 minutes. This morning, he ran for 4 minutes, stopped for 20 seconds to tie his shoelaces, and then ran for another 5 minutes. However, he realized that he had runThere are 38 pink marbles, 21 blue marbles, and 16 green marbles in a jar. If Sarah takes away 7 pink marbles and Tom takes away 3 p...
def solve() -> int: mile_time = 5 run_time_1 = 4 stop_time = 20 run_time_2 = 5 total_run_time = run_time_1 + (stop_time/60) + run_time_2 distance = total_run_time / mile_time pink_marbles = 38 blue_marbles = 21 green_marbles = 16 pink_marbles -= 7 pink_ma...
Student: A train travels 600 miles from point A to point B at an average speed of 60 miles per hour. The train then travels another 600 miles back from point B to point A, but at a reduced speed of 40 miles per hour. What is the train's average speed for the entire trip?
def solve() -> int: distance_AB = 600 distance_BA = 600 speed_AB = 60 speed_BA = 40 time_AB = distance_AB / speed_AB time_BA = distance_BA / speed_BA total_time = time_AB + time_BA total_distance = distance_AB + distance_BA result = total_distance / total_time return result
Student: Jamie rode his bike for 3 miles to his friend's house. They then walked 2 miles to the supermarket. Later, Jamie took an Uber back home for 4 miles. How many miles did Jamie cover in total?
def solve() -> int: bike = 3 walk = 2 uber = 4 total = bike + walk + uber result = total return result
Cindy has 100 dollars in her purse. She spent half of her money on clothes and half of the remaining on stationery. If she finally had 20 dollars left in her purse, how much did she spend on clothes and stationery?
def solve() -> int: starting_money = 100 ending_money = 20 clothes_spending = starting_money / 2 remaining_money = starting_money - clothes_spending stationery_spending = remaining_money / 2 total_spent = clothes_spending + stationery_spending remaining_money = ending_money result = tota...
Alex splits his weekly chores allowance between buying new shoes and donating to charity in the ratio of 3:5. If he has $90 in his allowance, how much money will he donate to charity?
def solve() -> int: allowance = 90 ratio = 3/5 donation = allowance * ratio result = donation return result
Student: In a class of 40, 16 students are taking Physics, 22 students are taking Arithmetic and 10 students are taking both Physics and Arithmetic. How many students are not taking either?
def solve() -> int: physics = 16 arithmetic = 22 both = 10 not_taking_either = 40 - (physics + arithmetic - both) result = not_taking_either return result
Joan baked 12 cookies on a Wednesday. That week, she baked three more cookies than the previous day. How many cookies did Joan bake by Friday that week?
def solve() -> int: wednesday_cookies = 12 thursday_cookies = wednesday_cookies + 3 friday_cookies = thursday_cookies + 3 total_cookies = wednesday_cookies + thursday_cookies + friday_cookies result = total_cookies return result
A rectangle has a width of 4 meters and a length of 10 meters. What is its area in square meters?
def solve() -> int: width = 4 length = 10 area = width * length result = area return result
Mr. Johnson has a daily goal of walking 2 miles. If he walks for a total of 50 days, how many miles did he walk in total?
def solve() -> int: goal_per_day = 2 total_days = 50 total_miles = goal_per_day * total_days result = total_miles return result
Rachel bought 8 apples, 9 oranges, and 6 pears altogether. How many fruits did Rachel buy in total?
def solve() -> int: numberOfFruits = 8 + 9 + 6 result = numberOfFruits return result
Matthew is packing for his camping trip and he needs to set up a sleeping bag for the night. The sleeping bag needs a rectangular space of 8 feet by 5 feet. How much area does Matthew need of a flat surface for his sleeping bag?
def solve() -> int: length = 8 width = 5 required_area = length * width result = required_area return result
Emily works as a bartender and makes $7.50 per drink. In one night, she serves 30 customers and gets a $3 tip from each one. How much money did she make that night?
def solve() -> int: drinks_price = 7.50 tip_amount = 3 num_customers = 30 total_drinks_income = drinks_price * num_customers total_tip_income = tip_amount * num_customers total_income = total_drinks_income + total_tip_income result = total_income return result
Anna has 48 apples and wants to give each of her 3 friends the same number of apples. How many apples will each friend receive?
def solve() -> int: apples = 48 friends = 3 apples_per_friend = apples // friends result = apples_per_friend return result
A bicycle wheel has a circumference of 66 cm. How many full rotations does the wheel make if the bicycle travels 462 cm in a straight line?
def solve() -> int: circumference = 66 distance = 462 rotations = distance / circumference result = rotations return result
A restaurant charges $15 per person for a buffet. If there are 30 people in the group, and a 10% service charge, how much does the group need to pay?
def solve() -> int: subtotal = 15 * 30 service_charge = subtotal * 0.1 total = subtotal + service_charge result = total return result
Alex saved $200 this month and plans to save $300 next month. How much will Alex save in total?
def solve() -> int: this_month_savings = 200 next_month_savings = 300 total_savings = this_month_savings + next_month_savings result = total_savings return result
For her baking project, Emily has to bake 12 cupcakes, 2 loaves of bread, and a dozen cookies. She can bake each cupcake in 15 minutes, each loaf of bread in 45 minutes, and each cookie in 2 minutes. How long will it take Emily to finish her baking project?
def solve() -> int: cupcakes = 12 loaves_of_bread = 2 cookies = 12 time_per_cupcake = 15 time_per_loaf_of_bread = 45 time_per_cookie = 2 total_time = (cupcakes * time_per_cupcake) + (loaves_of_bread * time_per_loaf_of_bread) + (cookies * time_per_cookie) result = total_tim...
Student: Sarah bought an expensive sweater for $130. She used a coupon that saved her 25% off the original price. How much money did Sarah save by using the coupon?
def solve() -> int: original_price = 130 discount_percentage = 0.25 discount_amount = original_price * discount_percentage final_price = original_price - discount_amount saved_amount = original_price - final_price result = saved_amount return result
Tom drives 3 hours to a friend's house at an average speed of 50 mph. He comes back home at an average speed of 60 mph due to less traffic, taking only 2 hours. What is the total distance he traveled?
def solve() -> int: distance_to_friends_house = 3 * 50 distance_back_home = 3 * 60 total_distance = distance_to_friends_house + distance_back_home result = total_distance return result
Rachel and her friend Lily decide to go jogging every day for 30 days. If Rachel jogs for an average of 2.5 miles a day and Lily jogs for an average of 3 miles a day, how much farther did Lily jog than Rachel in total?
def solve() -> int: rachel_distance = 2.5 lily_distance = 3 days = 30 rachel_total_distance = rachel_distance * days lily_total_distance = lily_distance * days difference = lily_total_distance - rachel_total_distance result = difference return result
Student: James needs to buy 3 lamps that cost $46 each, 5 books that cost $17 each, and 4 magazines that cost $12 each. What is the total cost of all the items?
def solve() -> int: lamps = 3 books = 5 magazines = 4 cost_lamp = 46 cost_book = 17 cost_magazine = 12 total_cost = lamps * cost_lamp + books * cost_book + magazines * cost_magazine result = total_cost return result
Paul buys a pack of 12 pencils for $3. He uses one pencil per week for his homework. He also earns $0.5 for each homework he completes. How much money will he have left after he uses all the pencils?
def solve() -> int: pencil_cost = 3 / 12 total_cost = pencil_cost * 12 total_earnings = 0.5 * 12 money_left = total_earnings - total_cost result = money_left return result
Bradley can finish a job 3 times faster than Priya. If it takes Priya 8 hours to finish the job, how long should it take Bradley?
def solve() -> int: Priya_time = 8 Bradley_time = 1/3 * Priya_time result = Bradley_time return result
In a warehouse, there are 620 boxes of produce. The warehouse has 8 aisles, each of the same size. How many more boxes of produce can one aisle fit if there are already 15 boxes on that aisle?
def solve() -> int: num_boxes = 620 num_aisles = 8 num_boxes_on_aisle = 15 total_boxes_on_aisles = num_aisles * num_boxes_on_aisle remaining_boxes = num_boxes - total_boxes_on_aisles boxes_per_remaining_aisle = remaining_boxes // (num_aisles - 1) result = boxes_per_remaining_aisle...
There are 6 cans, each containing 25 liters of paint. If the price of one can of paint is $80.00, calculate the price of one liter of paint.
def solve() -> int: cans = 6 liters_per_can = 25 cost_per_can = 80.0 total_liters = cans * liters_per_can cost_per_liter = cost_per_can / total_liters result = cost_per_liter return result
A music playlist has 50 songs. 60% of the songs are pop. 20% of the pop songs are by Ariana Grande. How many songs in the playlist are pop songs by Ariana Grande?
def solve() -> int: playlist = 50 pop_songs = 0.60*playlist ariana_songs = 0.20*pop_songs result = ariana_songs return result
Jack starts weight lifting every day and begins by lifting 50 pounds. He increases the weight by 5 pounds every day. On which day will he lift more than 20 times the weight he lifted on the first day?
def solve() -> int: first_day_weight = 50 daily_increase = 5 current_weight = first_day_weight day_count = 1 while current_weight <= 20 * first_day_weight: current_weight += daily_increase day_count += 1 result = day_count return result
A contractor charges $25/hour for repairing drywall. If the total cost to repair a wall is $150, how many hours did the contractor work?
def solve() -> int: hours_worked = 150 / 25 result = hours_worked return result
Tom has $25 and he wants to buy apples that cost 75 cents each. How many apples can Tom buy?
def solve() -> int: money = 25 cost_per_apple = 0.75 num_apples = money / cost_per_apple result = num_apples return result
Mark has 26 candy bars. He wants to give the same number of candy bars to each of his four friends. How many candy bars will each of his friends get?
def solve() -> int: bars_total = 26 friends = 4 bars_per_friend = bars_total // friends result = bars_per_friend return result
A laptop costs $1500 without tax. With a tax rate of 10%, how much will the total cost be?
def solve() -> int: cost = 1500 tax_rate = 0.1 total_cost = cost + (cost * tax_rate) result = total_cost return result
Tessa wants to give her mom a bouquet of flowers. A bouquet of roses costs $35. She also wants to add two more types of flowers into the bouquet. The first type costs $15 and the second type costs $21. How much will the the bouquet of flowers cost in total?
def solve() -> int: base_price = 35 first_add_on = 15 second_add_on = 21 total_price = base_price + first_add_on + second_add_on result = total_price return result
If 30% of a number is 90, what is the number?
def solve() -> int: percent = 30 quantity = 90 number = quantity / (percent / 100) result = number return result
The perimeter of a square is 20 cm. What is the length of each side of the square?
def solve() -> int: side_length = 20/4 result = side_length return result
Student: Stan invested $500 in a certificate of deposit that pays a 7% annual rate of return. How much will he have after 6 months?
def solve() -> int: principal = 500 rate = 0.07 time = 0.5 result = principal * (1 + rate * time) return result
Lucy and Tom are selling lemonade at a stand. Lucy started with 60 cups of lemonade and sold 3 cups for every 5 cups that Tom sold. Tom started with 50 cups of lemonade and sold 2 cups for every 3 cups that Lucy sold. How many cups of lemonade did each of them sell?
def solve() -> int: lucy_cups = 60 tom_cups = 50 lucy_ratio = 3 tom_ratio = 5 total_cups = lucy_cups + tom_cups lucy_sold = lucy_ratio * total_cups / (lucy_ratio + tom_ratio) tom_sold = tom_ratio * total_cups / (lucy_ratio + tom_ratio) result = "Lucy sold " + str...
A store sells an item at $2. The store's cost for making the item is $0.7. The store offers 15% discount. Find the store's total profit if he sold 185 items.
def solve() -> int: item_price = 2 item_cost = 0.7 discount = 0.15 number_of_items_sold = 185 total_income = number_of_items_sold * item_price total_cost = number_of_items_sold * item_cost total_discount = total_income * discount total_revenue = total_income - total_discount total_pr...
Question10: Timmy's mom is 15 years older than him, and his dad is 25 years older than him. If Timmy is 10 years old, how old is his dad?
def solve() -> int: age_timmy = 10; age_mom = age_timmy + 15; age_dad = age_timmy + 25; result = age_dad return result
In a bag, Allen has twice as many apples as oranges. If he has 18 apples, how many oranges does he have?
def solve() -> int: apples = 18 oranges = apples / 2 result = oranges return result
In total, Danny bought 5 pairs of shoes this month. Each pair cost $28. How much did Danny spend on shoes this month?
def solve() -> int: total = 0 total += (5*28) result = total return result
A group of friends went out to dinner and received a bill for $125. If they want to leave a 15% tip, what is the total amount they will pay including the tip?
def solve() -> int: tip = 0.15 bill = 125 total = bill * (1 + tip) result = total return result
A group of 10 friends go to a seafood grill and order 2 lobster tails for $36.00 each, 4 orders of stuffed clams for $10.00 each, and 6 orders of fries for $5.00 each. If they split the bill equally, how much will each person have to pay?
def solve() -> int: lobster_tails = 2 lobster_tail_price = 36.00 stuffed_clams = 4 stuffed_clam_price = 10.00 fries = 6 fries_price = 5.00 total_bill = (lobster_tails * lobster_tail_price) + (stuffed_clams * stuffed_clam_price) + (fries * fries_price) num_friends = 10 each_perso...
Thomas wants to visit a museum that is 20 miles away from his home. The trip takes 45 minutes each way. If he spends 1.5 times as long at the museum as his total driving time, how much time will the trip take?
def solve() -> int: distance = 20 driving_time = 45 * 2 / 60 museum_time = driving_time * 1.5 total_time = driving_time * 2 + museum_time result = total_time return result
A recipe calls for 2 1/2 cups of flour. If a cup is 8 ounces, how many ounces of flour are needed for the recipe?
def solve() -> int: cups_of_flour = 2.5 ounces_per_cup = 8 total_ounces = cups_of_flour * ounces_per_cup result = total_ounces return result
Rachel is a librarian who organizes books by their genre and size. She has 6 shelves for fiction books, each with 20 books. She has 8 shelves for non-fiction books, each with 15 books. She has 5 shelves for children's books, each with 25 books. She spends 10 seconds per book to scan the barcode and 5 seconds per shelf ...
def solve() -> int: fiction_shelves = 6 fiction_books = 20 nonfiction_shelves = 8 nonfiction_books = 15 children_shelves = 5 children_books = 25 books_total = fiction_shelves * fiction_books + nonfiction_shelves * nonfiction_books + children_shelves * children_books scan_time =...
A water bottle has a volume of 500 mL. If Emma drinks 125 mL of water every hour, how many hours will the water bottle last her?
def solve() -> int: volume = 500 drink_rate = 125 hours = volume / drink_rate result = round(hours, 1) return result
John walked 30 km in 5 hours. If he walks at the same pace, how long will it take him to walk 15 km?
def solve() -> int: distance_walked = 30 time_taken = 5 required_distance = 15 required_time = (required_distance / distance_walked) * time_taken result = required_time return result
Lisa has 320 cents in quarters. She gives 75 cents to David, and then gives five times as many cents to Maria as she gave to David. How many more quarters does Maria have than David?
def solve() -> int: quarters = 320 cents_given_to_david = 75 cents_given_to_maria = cents_given_to_david * 5 quarters_given_to_david = cents_given_to_david // 25 quarters_given_to_maria = cents_given_to_maria // 25 quarters_maria_has_more = quarters_given_to_maria - quarters_given_to_d...
Tyler is considering taking on a higher paying job. He currently earns $20 an hour and the new job offers $30 an hour. However, he would have to pay $15 in FICA taxes and $100 a month in healthcare premiums. If he works 40 hours a week, how much more would he make per month?
def solve() -> int: hourly_wage_current = 20 hourly_wage_new = 30 fica_tax = 15 healthcare_premiums = 100 hours_per_week = 40 weekly_income_current = hourly_wage_current * hours_per_week weekly_income_new = hourly_wage_new * hours_per_week monthly_income_current = weekly_income...
A student took 40 questions test. He got 32 questions right. What percent of the questions did he answer correctly?
def solve() -> int: total_questions = 40 correct_questions = 32 percentage_correct = (correct_questions/total_questions) *100 result = percentage_correct return result
Sarah had $1500 in her savings account on Monday. On Tuesday, she withdrew $300 to buy a new laptop. On Wednesday, she deposited $1000 from her paycheck. On Thursday, she invested $450 in stocks. On Friday, she paid $70 for a gym membership. How much money does Sarah have in her savings account now?
def solve() -> int: savings_account = 1500 withdrawal = 300 deposit = 1000 investment = 450 gym_membership = 70 savings_account -= withdrawal savings_account += deposit savings_account -= investment savings_account -= gym_membership result = savings_account ret...
``` A ladder of length 15 feet leans against a wall at a point 10 feet high. What is the distance from the bottom of the ladder to the wall?
def solve() -> int: ladder_length = 15 height_on_wall = 10 distance_on_ground = (ladder_length ** 2 - height_on_wall ** 2) ** 0.5 result = distance_on_ground return result
Every 5 seconds, a coin is flipped, and every 7 seconds, a die is rolled. How many heads and odd numbers will be obtained in 3 minutes?
def solve() -> int: minutes = 3 seconds = minutes * 60 lcm = 35 both = seconds // lcm coin = seconds // 5 die = seconds // 7 tosses = coin - both + die - both result = tosses * 0.5 return result
Alex's electric company charges $0.15 per kilowatt hour for the first 300 kilowatt hours and $0.20 per kilowatt hour for anything above that. If Alex uses 350 kilowatt hours in a month, how much will he have to pay?
def solve() -> int: total_kwh_used = 350 first_300_rate = 0.15 after_300_rate = 0.20 if total_kwh_used <= 300: total_cost = total_kwh_used * first_300_rate else: total_cost = 300 * first_300_rate + (total_kwh_used - 300) * after_300_rate result = total_cost return result
Student: A baker has to bake a total of 165 loaves of bread. If a mixing machine can mix 5 loaves of bread at a time, how many times will the machine have to be used to mix all the loaves of bread?
def solve() -> int: total_loaves = 165 loaves_per_mix = 5 num_mixes = total_loaves // loaves_per_mix remaining_loaves = total_loaves % loaves_per_mix total_num_mixes = num_mixes + (1 if remaining_loaves > 0 else 0) result = total_num_mixes return result
Kevin collected 180 stamps from different countries. He sorted them into six albums by continent and put the same number of stamps in each album. He then gave one album to each of his five friends and kept one for himself. How many stamps did he give to each friend?
def solve() -> int: stamps_per_album = 180 // 6 stamps_per_friend = stamps_per_album result = stamps_per_friend return result
A restaurant has a special offer that if 2 adults and 2 children booked a meal, they would only be charged for 3 adults. If the meal for 3 adults costs $95, how much would the entire meal cost?
def solve() -> int: def meal_cost(adults, children): adult_cost = adults * 95 total = adult_cost if adults == 2 and children == 2: total = (adults - 1) * 95 result = total adults = 2 children = 2 meal_cost(adults, children) result = 190 return result
Student: Josh sells buttons for $2 each. He started with 68 buttons and made a profit of $48, how many buttons did he sell?
def solve() -> int: buttons_start = 68 price_per_button = 2 profit = 48 buttons_sold = buttons_start + profit // price_per_button result = buttons_sold return result
A coffee shop sells small coffees for $3.50, medium coffees for $4.50 and large coffees for $5.75. If they sell 100 small coffees, 80 medium coffees and 60 large coffees, how much money do they make in total?
def solve() -> int: coffee_shop_total = (100 * 3.50) + (80 * 4.50) + (60 * 5.75) result = coffee_shop_total return result
John saved $150 each month for 6 months. If he also received a birthday gift of $50, how much money did he save in total?
def solve() -> int: monthly_savings = 150 num_months = 6 birthday_gift = 50 total_savings = monthly_savings * num_months + birthday_gift result = total_savings return result
A marathon runner runs 26 miles in a total of 3 hours. If she runs at a constant pace, how long does it take her to cover 5 miles?
def solve() -> int: total_distance = 26 total_time = 3 * 60 distance = 5 time = (distance / total_distance) * total_time result = time return result
A bee travels from a beehive to a flower and back. The bee flies straight from the hive to the flower and then straight back to the hive. If the bee traveled a total distance of 500 meters and the distance from the hive to the flower is half the distance from the flower to the hive, what is the distance from the hive t...
def solve() -> int: distance_total = 500 distance_hive_flower = distance_total / 3 distance_flower_hive = 2 * distance_hive_flower result = distance_hive_flower return result
Tom has 20 coins in his piggy bank. They are either quarters or dimes. If the total value of the coins is $3.50, how many quarters and how many dimes does he have?
def solve() -> int: from sympy import symbols, solve q, d = symbols('q, d') equations = [q + d - 20, 0.25 * q + 0.1 * d - 3.5] solution = solve(equations) quarters = solution[q] dimes = solution[d] result = quarters, dimes return result
A train is moving at a speed of 55 miles per hour. It takes 2 hours to reach its destination. What is the distance between the source and the destination?
def solve() -> int: speed = 55 time = 2 distance = speed * time result = distance return result
A company has 80 employees and wants to give each a $500 bonus. How much money is needed for all the bonuses?
def solve() -> int: num_employees = 80 bonus_amount = 500 total_bonus = num_employees*bonus_amount result = total_bonus return result
A car travels at a speed of 60 km/h. How many kilometers does the car travel in 3 hours?
def solve() -> int: distance = 60 * 3 result = distance return result
Alex spent 1/4 of his salary on rent. He then spent 3/8 of the remaining money to pay bills. If he has $900 left in his wallet, how much is his salary?
def solve() -> int: salary = 900 / (1 - 1/4 - 3/8) result = salary return result
If a factory produces 200 widgets in 8 hours, how many widgets will it produce in 24 hours?
def solve() -> int: widgets_per_hour = 200/8 widgets_per_day = widgets_per_hour * 24 result = widgets_per_day return result
Possible new questions and programs are: Tanya has 4 times as many books as Tina. Toby has 5 less books than Tina. If Tanya has 36 books, how many books do they have in total?
def solve() -> int: tanya = 36 tina = tanya // 4 toby = tina - 5 total = tanya + tina + toby result = total return result
During a school play, Alex wants to serve the same number of cups of water, soda, and juice to the audience. It takes 30 seconds to pour 1 cup of water, 20 seconds to pour 1 cup of soda, and 15 seconds to pour 1 cup of juice. If Alex serves 50 cups of water and 75 cups of juice, how many cups of soda should he pour to ...
def solve() -> int: water_time = 30 * 50 juice_time = 15 * 75 total_time = water_time + juice_time soda_time = total_time / 3 soda_cups = soda_time / 20 result = soda_cups return result
Student: - Luna the unicorn has 60 rainbow hairs, 40 glitter dust, and 18 magic stars. If each glitter dust is worth 6 magic stars, and each rainbow hair is worth 4 glitter dust, what is the total value of Luna's accessories expressed as a number of magic stars?
def solve() -> int: rainbow_hairs = 60 glitter_dust = 40 magic_stars = 18 total_value = rainbow_hairs * 4 * 6 + glitter_dust * 6 + magic_stars result = total_value return result
Student: A car travels at an average speed of 60 km/hr. If the car has traveled for 2.5 hours, how far has it traveled?
def solve() -> int: speed = 60 time = 2.5 distance = speed * time result = distance return result
A gardener has 150 flowers to plant in his garden. There are 3 types of flowers - rose, lily, and daisy. If he wants to plant an equal number of flowers of each type, how many flowers of each type will he plant?
def solve() -> int: total_flowers = 150 num_types = 3 flowers_per_type = total_flowers / num_types result = flowers_per_type return result
Linda has to bike 4 miles to her yoga class every day. One day, she took a detour to the grocery store which was 1 mile away from her class. How many miles did she bike that day?
def solve() -> int: distance_to_yoga_class = 4 distance_to_grocery_store = 1 total_distance = distance_to_yoga_class + distance_to_grocery_store result = total_distance return result
A race car travels at 200 km/h. If they travel for 3 hours, how far have they gone?
def solve() -> int: speed = 200 time = 3 distance = speed*time result = distance return result
Joshua received 999 gifts from his friends. He kept 25 percent and gave away the rest. How many gifts did Joshua keep?
def solve() -> int: total_gifts = 999 gifts_twentyfifth = total_gifts * 25/100 total_gifts = total_gifts - gifts_twentyfifth result = total_gifts return result
Emma and Lucas want to bake some cookies for their classmates. They have a recipe that makes 24 cookies with 2 cups of flour, 1 cup of sugar, and 0.5 cup of butter. They have 6 cups of flour, 4 cups of sugar, and 2 cups of butter in their pantry. How many cookies can they bake with the ingredients they have?
def solve() -> int: cookies_per_batch = 24 flour_per_batch = 2 sugar_per_batch = 1 butter_per_batch = 0.5 flour_available = 6 sugar_available = 4 butter_available = 2 flour_batches = flour_available // flour_per_batch sugar_batches = sugar_available // sugar_per_batch ...
A store has a 20% discount on all items. If an item is normally priced at $100, what is the new price after the discount?
def solve() -> int: original_price = 100 discount_percent = 20 discount_amount = original_price * discount_percent / 100 new_price = original_price - discount_amount result = new_price return result