question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Possible questions and programs are: A group of 12 students from the chess club went to a tournament, where they joined 8 other students from different schools. The tournament had four rounds, and after each round, half of the participants were eliminated. The chess club students paid $5 each for the registration fee, ...
def solve() -> int: students = 12 others = 8 rounds = 4 fee = 5 prize = 10 participants = students + others for i in range(1, rounds + 1): participants = participants // 2 if participants == 1 and students >= 1: winner = "a chess club student" earne...
A car traveled 85 km per hour for 3 hours, and then it accelerated to 110 km per hour for the next 2 hours. What is the average speed of the car for the entire journey?
def solve() -> int: distance1 = 85*3 distance2 = 110*2 total_distance = distance1+distance2 total_time = 5 average_speed = total_distance/total_time result = average_speed return result
A baker makes 1200 cookies every day. He puts 12 cookies in each box and sells 80 boxes every day. He also throws away 24 cookies every day that are burnt or broken. How many cookies does he have left at the end of 5 days if he started with 360 cookies in his inventory?
def solve() -> int: cookies_made = 1200 cookies_sold = 80 * 12 cookies_thrown = 24 cookies_left = cookies_made - cookies_sold - cookies_thrown cookies_left_5 = cookies_left * 5 cookies_inventory = 360 cookies_inventory_final = cookies_inventory +...
If Juan spends 4 hours studying each day from his math, history, geography and science textbooks, how many pages must he read each day in order to finish all four textbooks in 8 days? His math textbook has 90 pages, his history textbook has 80 more pages than his math textbook, his geography textbook has half of the su...
def solve() -> int: totalPages = 0 totalPages += 90 totalPages += 80 totalPages += 90 + 80 totalPages += 2 * (90 + 80) totalPages = totalPages / 8 result = totalPages return result
A chemistry experiment requires 100 milliliters of a certain solution. The solution is 25% acid and 75% water. How much acid is in the solution?
def solve() -> int: acid_in_solution = 0.25 * 100 result = acid_in_solution return result
If Alex has 25 marbles, and Sophie has 75 marbles, and Ben has 50 marbles, how many times can Alex's number of marbles fit into the average amount of marbles for a person in the group?
def solve() -> int: alex_marbles = 25 sophie_marbles = 75 ben_marbles = 50 total_marbles = alex_marbles + sophie_marbles + ben_marbles average_marbles = total_marbles / 3 times_fit = average_marbles // alex_marbles result = times_fit return result
A computer game takes 2.5 GB of space. A hard drive has 250 GB of memory. How many such games can be installed?
def solve() -> int: game_size_GB = 2.5 hard_drive_size_GB = 250 games_installable = hard_drive_size_GB // game_size_GB result = games_installable return result
Possible questions and programs: Amy had a total of $120 in her savings account. She withdrew $20 to buy a gift for her friend, then deposited $15 from her allowance. Later, she earned $18 from selling some of her old books. How much money, in dollars, does Amy have in her savings account now?
def solve() -> int: savings = 120 savings = savings - 20 savings = savings + 15 savings = savings + 18 result = savings return result
Mia baked some cookies for a charity sale. She made 24 cookies in the first batch and 18 cookies in the second batch. She sold each cookie for $0.5 and donated all the money to the charity. How much money did she donate in total?
def solve() -> int: cookies_first = 24 cookies_second = 18 price = 0.5 cookies_total = cookies_first + cookies_second money = cookies_total * price result = money return result
Student: Q8: George has x books and y magazines. How many periodicals does he have in total?
def solve() -> int: x = 10 y = 5 result = x + y return result
A family wants to divide 54 flowers equally among 3 vases. How many flowers will be in each vase?
def solve() -> int: total_flowers = 54 total_vases = 3 flowers_in_vase = total_flowers/total_vases result = flowers_in_vase return result
Miguel borrowed money from his sister. He promised to pay it back in 10 months including an additional 13% of the money he borrowed. If he pays $35 per month, how much money did he borrow?
def solve() -> int: borrowed_money = 0 additional_money = 0.13 * borrowed_money total_money = borrowed_money + additional_money months = 10 monthly_payment = 35 remaining_money = total_money for i in range(months): remaining_money -= monthly_payment result = remaining_m...
A farmer has 20 cows, if each cow produces 5 gallons of milk a day, how much milk do all the cows produce in 3 days?
def solve() -> int: cows = 20 milk_per_cow = 5 days = 3 total_milk = cows * milk_per_cow * days result = total_milk return result
A toy store sells toy cars in small, medium and large sizes at $2, $5 and $7 respectively. In one day, the store made $90 from selling toy cars. They sold $8 worth of small cars and $29 worth of medium cars. How much did the store earn by selling large toy cars?
def solve() -> int: small_car_price = 2 medium_car_price = 5 large_car_price = 7 small_car_sales = 8 medium_car_sales = 29 total_sales = 90 large_car_sales = total_sales - small_car_sales - medium_car_sales large_car_count = large_car_sales // large_car_price ...
A classroom can accommodate 54 students. The teacher wants to divide them into groups of 6 students each. How many groups can be formed?
def solve() -> int: groups_of_students = 54/6 result = groups_of_students return result
A poll was conducted to find out how many people prefer cats or dogs as pets. Out of 40 people polled, 20 people said they prefer cats, 25 people said they prefer dogs, and 10 said they prefer both cats and dogs. How many people don't prefer either as pets?
def solve() -> int: num_people = 40 like_cats = 20 like_dogs = 25 like_both = 10 not_like_either = num_people - (like_cats + like_dogs - like_both) result = not_like_either return result
ome possible new questions and programs are: Lisa sells cupcakes at a local bakery. She earns 5% commission on her sales plus a fixed salary of 200$ per month. In January, she sold 100 cupcakes at 2$ each. In February, she increased her sales by 50% and the price of each cupcake by 25%. In March, she sold the same numb...
def solve() -> int: commission = 0.05 salary = 200 jan_sales = 100 jan_price = 2 feb_sales = jan_sales * 1.5 feb_price = jan_price * 1.25 mar_sales = feb_sales mar_price = feb_price * 0.9 jan_total = jan_sales * jan_price jan_earnings = salary + commission * jan_tot...
Tom has a $15 coupon. He buys 4 identical shirts, which normally cost $20 each. What is the amount he needs to pay?
def solve() -> int: discount_amount = 15 shirt_cost = 20 total_cost = shirt_cost*4 amount_to_pay = total_cost - discount_amount result = amount_to_pay return result
If a textbook is 400 pages long, and a student reads 20 pages every day, how many days will it take to finish the textbook?
def solve() -> int: num_pages = 400 pages_per_day = 20 days_to_finish = num_pages / pages_per_day result = days_to_finish return result
Sam has 50 dollars. He spent 60% of it on groceries and the rest on clothes. If he spends 20 dollars on clothes, how much did he have originally?
def solve() -> int: dollars_spent = 50 *.6 remaining_money = 50 - dollars_spent - 20 result = remaining_money return result
The sum of two numbers is 64, and one number is 15 more than the other. What are the two numbers?
def solve() -> int: total_sum = 64 difference = 15 second_number = (total_sum - difference) / 2 first_number = second_number + difference result = (first_number, second_number) return result
A pizza has 8 slices. If 3 people are sharing the pizza equally, how many slices of pizza will each person get?
def solve() -> int: pizza_slices = 8 people_sharing = 3 slices_per_person = pizza_slices / people_sharing result = slices_per_person return result
A charity organization registered 200 volunteers, but only 50% of them showed up for an event. How many volunteers did not show up?
def solve() -> int: total_volunteers = 200 showed_up_percentage = 0.5 no_show_volunteers = total_volunteers * (1 - showed_up_percentage) result = no_show_volunteers return result
Claire bought a bag for $25, 5 pairs of shoes for $40 each and a hat for $15. Calculate the total cost of her purchases with a 3% tax rate.
def solve() -> int: price_bag = 25 price_shoes = 40 price_hat = 15 num_shoes = 5 tax_rate = 0.03 subtotal = price_bag + (price_shoes*num_shoes) + price_hat tax = subtotal * tax_rate result = subtotal + tax return result
A car travels at a speed of 60 km/h for 3 hours. How far did it travel?
def solve() -> int: speed = 60 time = 3 distance = speed * time result = distance return result
A company produces 60000 pens every day. Each pen costs $0.12 to make, and the company sells each pen for $0.35. If the company operates for 300 days every year, what is the company's annual profit?
def solve() -> int: cost_per_pen = 0.12 revenue_per_pen = 0.35 profit_per_pen = revenue_per_pen - cost_per_pen annual_production = 60000*300 annual_profit = annual_production*profit_per_pen result = annual_profit return result
There are 100 centimeters in a meter. Alice has a ribbon that is 3 meters and 25 centimeters long. She cuts it into 5 equal pieces. In centimeters, how long is each piece of ribbon?
def solve() -> int: meters = 3 centimeters = 25 length = meters * 100 + centimeters piece = length / 5 result = piece return result
A construction worker earns $20 per hour. If she works 8 hours a day, 5 days a week, how much does she earn in a week?
def solve() -> int: hourly_wage = 20 hours_per_day = 8 days_per_week = 5 total_hours = hours_per_day * days_per_week total_earnings = hourly_wage * total_hours result = total_earnings return result
If the area of a rectangle is 80 square units and the length is twice the width, what are the dimensions of the rectangle?
def solve() -> int: result = None return result
Student: Sam has $100 and wants to buy some toys. Each toy costs $15. How many toys can he buy and how much money will he have left?
def solve() -> int: money = 100 toy_cost = 15 toys = money // toy_cost total_cost = toys * toy_cost remaining_money = money - total_cost result = (toys, remaining_money) return result
A boat is travelling from port A to port C with two intermediate stops at ports B and D. From A to B is 9 nautical miles, from B to C is 11 nautical miles, and from C to D is 8 nautical miles. What is the total distance travelled by the boat from port A to port C?
def solve() -> int: distAB = 9 distBC = 11 result = distAB + distBC return result
Five students are running a relay race. The first student runs at a speed of 10 feet per second, the second runs at a speed of 12 feet per second, and the third runs at a speed of 9 feet per second, the fourth runs at a speed of 11 feet per second, and the fifth runs at a speed of 8 feet per second. What is their avera...
def solve() -> int: speed1 = 10 speed2 = 12 speed3 = 9 speed4 = 11 speed5 = 8 total_speed = speed1 + speed2 + speed3 + speed4 + speed5 average_speed = total_speed / 5 result = average_speed return result
Student: Lindsey bought four items at the store, each item originally costing $34. She was given a 10% discount on all four items. How much money did Lindsey spend in total?
def solve() -> int: original_price = 34 discount_rate = 0.1 discounted_price = original_price * (1 - discount_rate) total_spent = discounted_price * 4 result = total_spent return result
A phone has a price tag of $799, but it's on sale for $649. The tax rate is 7%. What is the final price of the phone, including sales tax?
def solve() -> int: original_price = 799 sale_price = 649 discount = original_price - sale_price price_with_discount = sale_price tax_rate = 0.07 price_with_tax = price_with_discount * (1+tax_rate) result = price_with_tax return result
Maria the baker is making a cake that requires 3 cups of flour. For every half cup of flour, she must use one egg, and for every egg, she uses two tablespoons of sugar. She buys a bag of 20 tablespoons of sugar for the job. How many tablespoons of sugar will be left after she makes the cake?
def solve() -> int: flour_needed = 3 eggs_needed = flour_needed * 2 sugar_needed = eggs_needed * 2 sugar_bought = 20 sugar_left = sugar_bought - sugar_needed result = sugar_left return result
Dale goes to the store and buys $50 worth of stuff. The taxes were 11%. After taxes, he got a $15 discount. Dale and his great grandmother split the final price equally. How much did Dale pay?
def solve() -> int: price = 50 tax = price * 0.11 newprice = price + tax - 15 total = newprice / 2 result = total return result
Charlie and Daisy are friends who garden. Charlie plants 12 flowers every day, and each flower needs 3 liters of water. Daisy plants 15 flowers every day, and each flower needs 2 liters of water. How much water do Charlie and Daisy need in total for their flowers after 7 days?
def solve() -> int: charlie_flowers = 12 * 7 daisy_flowers = 15 * 7 charlie_water = 3 * charlie_flowers daisy_water = 2 * daisy_flowers total_water = charlie_water + daisy_water result = total_water return result
A jar contains 40 pieces of candy. Five people divide the candy evenly. How many pieces of candy does each person get?
def solve() -> int: piecesCandy = 40 numPeople = 5 result = piecesCandy // numPeople return result
am needs to buy 30 pens for a school project. Each pen costs $2. How much money will he need?
def solve() -> int: result = 60 num_pens = 30 cost_per_pen = 2 result = num_pens * cost_per_pen return result
Student: The average income of 5 employees is $50,000, the average income of 10 employees is $60,000, and the average income of 15 employees is $70,000. What is the average income of all employees?
def solve() -> int: employee_1_to_5_income = 50000 employee_6_to_15_income = 60000 employee_16_to_30_income = 70000 total_income = (employee_1_to_5_income * 5) + (employee_6_to_15_income * 10) + (employee_16_to_30_income * 15) total_employees = 5 + 10 + 15 average_income = total_income / total_e...
Alex and Sarah are baking cookies and brownies. Alex bakes 35 cookies and 8 more brownies than Sarah. Sarah bakes 20 fewer cookies than Alex and 15 brownies. How many desserts do they bake altogether?
def solve() -> int: alex_cookies = 35 alex_brownies = alex_cookies + 8 sarah_cookies = alex_cookies - 20 sarah_brownies = 15 total_desserts = alex_cookies + alex_brownies + sarah_cookies + sarah_brownies result = total_desserts return result
7. Jacob bought 504 boxes of cereal and Justin bought 215 fewer boxes of cereal. How many boxes of cereal did Jacob buy?
def solve() -> int: number_of_cereal_boxes_jacob = 504 number_of_cereal_boxes_justin = number_of_cereal_boxes_jacob - 215 result = number_of_cereal_boxes_justin return result
A shop sells cupcakes for $2 each. The shop owner notices that whenever they increase the price by $0.25, the demand decreases by 10%. If the owner wants to maximize profit, what price should they sell each cupcake for?
def solve() -> int: p1 = 2 x = 0.25 d = 0.1 max_profit = 0 best_price = 0 for p2 in range(200, 250): qd = 1 - ((p2 - p1) / (x * p1)) * d revenue = qd * p2 cost = qd * p1 profit = revenue - cost if profit > max_profit: max_profit = profit ...
-The new questions and the programs should be **independent** of each other, do not use the same variables or values in different questions or programs. Possible new questions and programs: Adam wants to save up for a new bike that costs $250. He earns $10 per week from doing chores and gets $15 every month from his al...
def solve() -> int: cost = 250 earn_weekly = 10 earn_monthly = 15 spend_weekly = 5 total = 0 weeks = 0 while total < cost: total = total + earn_weekly - spend_weekly if weeks % 4 == 0: total = total + earn_monthly weeks = weeks + 1 result = weeks retur...
Mark went to a store to buy a mobile phone. He found that the price of the phone was 25% lower than the price he originally thought. If the phone originally costs $800, how much will Mark pay for the phone?
def solve() -> int: original_price = 800 discount_percentage = 25 discount_amount = original_price * (discount_percentage/100) final_price = original_price - discount_amount result = final_price return result
Possible questions and programs: Tina and Leo baked 24 cookies and sold them for $0.50 each. They also sold 15 muffins for $1 each and 9 lemonades for $0.75 each. How much money did they make in total?
def solve() -> int: cookies_revenue = 24 * 0.5 muffins_revenue = 15 * 1 lemonades_revenue = 9 * 0.75 total_revenue = cookies_revenue + muffins_revenue + lemonades_revenue result = total_revenue return result
Sarah went to the pet store and bought 12 goldfish for her aquarium and was given 2 more by the friendly clerk. How many goldfish does Sarah have now?
def solve() -> int: goldfish_bought = 12 goldfish_given = 2 total_goldfish = goldfish_bought + goldfish_given result = total_goldfish return result
Mia is making lemonade for a bake sale. She needs 8 cups of water, 1.5 cups of lemon juice, and 1 cup of sugar for each pitcher of lemonade. If she has 16 cups of water, 6 cups of lemon juice, and 4 cups of sugar, how many pitchers of lemonade can she make?
def solve() -> int: pitchers_water = 16 // 8 pitchers_lemon = 6 // 1.5 pitchers_sugar = 4 // 1 pitchers = min(pitchers_water, pitchers_lemon, pitchers_sugar) result = pitchers return result
Susan drives her car at a speed of 60 mph. If she wants to travel 840 miles, how long will it take her to get there?
def solve() -> int: time_to_travel = 840 / 60 result = time_to_travel return result
On a weather map, 1/8 inch represents 4 millimeters of actual rainfall. The cities of Jackson and Summerset are represented by points 2 3/4 inches apart on the map. What is the actual distance, in millimeters, between the cities?
def solve() -> int: distance_in_inches = 11/4 actual_distance_in_millimeters = distance_in_inches * 8 * 4 result = actual_distance_in_millimeters return result
A sports store has 4 basketballs, 10 baseball gloves, 7 soccer balls, 2 tennis rackets, and a frisbee. Each basketball costs $25, each baseball glove costs $30, each soccer ball costs $20, each tennis racket costs $50, and the frisbee costs $5. What is the total cost of the sports equipment in the store?
def solve() -> int: basketballs = 4 baseball_gloves = 10 soccer_balls = 7 tennis_rackets = 2 frisbee = 1 basketball_cost = 25 baseball_glove_cost = 30 soccer_ball_cost = 20 tennis_racket_cost = 50 frisbee_cost = 5 total_cost = (basketballs * basketball_cost) + (base...
If there are 75 people in a hall and 3/5 of them were women. If 1/4 of the women left the hall and 1/3 of the men left the hall, how many people were left in the hall?
def solve() -> int: total_people = 75 women = total_people * 3/5 men = total_people - women women_left = women * 1/4 men_left = men * 1/3 people_left = total_people - women_left - men_left result = people_left return result
A furniture store has a 25% discount on all items. If Emily paid $1,500 for a sofa, how much did she save?
def solve() -> int: price_of_sofa = 1500 discount_percentage = 25 discount_amount = price_of_sofa * (discount_percentage / 100) saved_amount = discount_amount result = saved_amount return result
A total of 800 employees work in a company, and the total bonus distributed among the employees was $80,000. Each male employee received $200, and each female employee received $300. If 40% of the employees are female, how much revenue did the company earn in the year 2020?
def solve() -> int: total_employee = 800 total_bonus = 80000 male_bonus = 200 female_bonus = 300 female_employee = 0.4 * total_employee male_employee = total_employee - female_employee revenue = (male_employee * male_bonus) + (female_employee * female_bonus) / 0.25 result = revenue ...
A pizza is divided into 8 equal slices. If I eat 3 slices, what fraction of the pizza is left?
def solve() -> int: num_slices = 8 slices_eaten = 3 slices_remaining = num_slices - slices_eaten fraction_remaining = slices_remaining / num_slices result = fraction_remaining return result
Cindy has 4 bags of candy with 15 pieces each. She ate 3 pieces from each bag and then shared the rest equally with her 3 friends. How many pieces of candy did each friend get?
def solve() -> int: bags = 4 pieces = 15 cindy = 3 friends = 3 left = bags * pieces - bags * cindy each_friend = left // friends result = each_friend return result
Student: Tim has a farm of acres of land. He plants 24 trees per acre, and each tree takes up 10 square feet of land. How many square feet of land do Tim’s trees take up in total?
def solve() -> int: acres = 10 trees_per_acre = 24 tree_area = 10 acre_area = 43560 farm_area = acres * acre_area trees_total = acres * trees_per_acre trees_area = trees_total * tree_area result = trees_area return result
Sue wants to pay for her $60 purchase in monthly installments over 6 months. If she has to pay a 3% interest rate, how much does she have to pay per month?
def solve() -> int: total_purchase_price = 60 number_of_installments = 6 interest_rate = 3 interest_rate_fraction = interest_rate / 100 total_purchase_price_with_interest = total_purchase_price + (total_purchase_price * interest_rate_fraction) cost_per_installment = total_purchase_price_with_int...
There are some bikes in a shop. 3/4 of the bikes are new, and 1/6 of the new bikes are blue. There are 45 blue bikes in the shop. How many bikes are there in the shop altogether?
def solve() -> int: new_bikes = 45 / (1/6) bikes = new_bikes / (3/4) result = round(bikes) return result
Mr. Davis is a taxi driver who charges $2.50 per mile. If he drives 200 miles every day and works 7 days a week, what is his monthly income for the month of February?
def solve() -> int: miles_per_day = 200 cost_per_mile = 2.50 days_per_week = 7 weeks_in_february = 4 total_miles_driven = miles_per_day * days_per_week * weeks_in_february total_income = total_miles_driven * cost_per_mile result = total_income return result
A store sells two types of shirts, white and black, each for $13 and $15, respectively. If the store sells 70 white shirts and 30 black shirts, calculate the total revenue earned.
def solve() -> int: white_price = 13 black_price = 15 white_shirts = 70 black_shirts = 30 total_white_revenue = white_price * white_shirts total_black_revenue = black_price * black_shirts total_revenue = total_white_revenue + total_black_revenue result = total_revenue return result
A bag contains 20 red balls and 30 blue balls. If two balls are drawn at random, what is the chance that at least one ball is red?
def solve() -> int: total_balls = 50 red_balls = 20 blue_balls = 30 chance_no_red = (blue_balls/total_balls) * ((blue_balls-1)/(total_balls-1)) chance_at_least_one_red = 1 - chance_no_red result = chance_at_least_one_red return result
Student: Lucy ran 10 laps in the track last week, and this week she ran 15 laps. How many more laps did she run this week than last week?
def solve() -> int: last_week_laps = 10 this_week_laps = 15 more_laps = this_week_laps - last_week_laps result = more_laps return result
Nathan earns 2/9 the salary that Rachel earns. Rachel makes $4200 per month. How long will it take Nathan to earn the same amount of money that Rachel does in 12 months?
def solve() -> int: rachel_salary = 4200 nathan_salary = rachel_salary * (2/9) nathan_earnings_12_months = nathan_salary * 12 time_taken = nathan_earnings_12_months / nathan_salary result = time_taken return result
A recipe calls for 3 cups of flour to make 24 cookies. How many cups of flour would be needed to make 36 cookies?
def solve() -> int: flour_per_cookie = 3 / 24 result = flour_per_cookie * 36 return result
Diana has 900 apples and wants to divide them between 4 friends. How many apples does each friend get?
def solve() -> int: n_apples = 900 n_friends = 4 apples_per_friends = n_apples / n_friends result = apples_per_friends return result
If Michael has 6 cousins and each of them has 4 children, except for one who has 9 children, how many third cousins does Michael have in total?
def solve() -> int: cousins = 6 children_per_cousin = 4 special_cousin_children = 9 third_cousins = cousins * (children_per_cousin * 3) + special_cousin_children * 3 result = third_cousins return result
Student: A pizza parlor offers a small pizza with 8 slices, and a large one with 12 slices. If twin brothers got the same amount of pizza, how many slics did each of thme get?
def solve() -> int: small = 8 large = 12 total = small + large slices_per_brother = total // 2 result = slices_per_brother return result
Amanda and her family are buying groceries. Amanda's family bought a total of 70 items. If each item cost 3.50, how much does Amanda's family need to pay in total?
def solve() -> int: num_of_items = 70 Item_price = 3.50 result = num_of_items * Item_price return result
ofia has 20 more than three times as many siblings as Amir. If Amir has 15 siblings, how many siblings does Sofia have?
def solve() -> int: amir_siblings = 15 sofia_siblings = 3*amir_siblings + 20 result = sofia_siblings return result
Student: Linda drove from point A to point B, which is 700 miles away. She drove 40 miles at a speed of 100mph and stopped for a 10-minute break. She then drove 60 miles at a speed of 80mph and then stopped for another 15-minute break. Finally, she drove the last 500 miles at a speed of 60mph. How many hours did Linda ...
def solve() -> int: distance = 700 time_1 = 40 / 100 break_1 = 10 / 60 time_2 = 60 / 80 break_2 = 15 / 60 time_3 = 500 / 60 total_time = time_1 + break_1 + time_2 + break_2 + time_3 result = total_time return result
10. Thomas, Nancy, and Jun earned a total of $90 from babysitting all week. Thomas earned a third of the total earnings and Nancy earned 75% more than Jun. How much did Jun earn in total?
def solve() -> int: total = 90 thomas_total = total/3 nancy_total = 1.75*thomas_total jun_total = (total - thomas_total - nancy_total)/1 result = jun_total return result
A group of 8 friends went out to eat and agreed to split the cost of the meal evenly. If the total cost of the meal, including tax and tip, was $160, how much should each person pay?
def solve() -> int: total_cost = 160 number_of_people = 8 cost_per_person = total_cost/number_of_people result = cost_per_person return result
A bag contains red and green marbles in the ratio of 2:5. If there are 28 green marbles in the bag, how many red marbles are there?
def solve() -> int: result = 56 / 5 return result
A pizza restaurant has 12 large pizzas. If each pizza can be sliced into 8 pieces, how many pieces of "larges" pizzas are there in total?
def solve() -> int: num_pizzas = 12 num_slices = 8 total_slices = num_pizzas * num_slices result = total_slices return result
If Jacob earns $512 for 8 days of work, how much does he earn in a day?
def solve() -> int: earnings = 512 days_worked = 8 earnings_per_day = earnings / days_worked result = earnings_per_day return result
Student: If a store bought a product for $100 and added 25% markup, what is the selling price?
def solve() -> int: cost = 100 markup = 0.25 markup_amount = cost * markup selling_price = cost + markup_amount result = selling_price return result
Clara has a 450 page book to read. She read the first 30% of the book with a speed of 9 pages per day, then she doubled her speed for the next 20% of the book, and then she halved her speed for the last 50% of the book. How many days did Clara spend reading the book in total?
def solve() -> int: d1 = 15 d2 = 5 d3 = 25 result = d1 + d2 + d3 return result
- Ben can run 5 km in 25 minutes. If he runs at the same speed for 40 minutes on Monday and 30 minutes on Wednesday, how many km can he run in total?
def solve() -> int: speed = 5 / 25 total_minutes = 40 + 30 total_distance = speed * total_minutes result = total_distance return result
Kristen bought a computer for $800 and a gaming console for $400. She received a 15% discount on the computer and a 10% discount on the gaming console. If there is an 8% sales tax on the total purchase, how much did Kristen pay in total?
def solve() -> int: computer_cost = 800 console_cost = 400 discount = 0.15*computer_cost + 0.1*console_cost tax = 0.08*(computer_cost + console_cost - discount) result = computer_cost + console_cost - discount + tax return result
Richard borrowed some money from his mother, including 12% interest. If he promised to pay it back within 9 months and paid $80 each month, how much money did he borrow?
def solve() -> int: borrowed_amount = 0 interest_rate = 0.12 months = 9 monthly_payment = 80 total_paid = months * monthly_payment total_interest = total_paid - (borrowed_amount * (1 + interest_rate)**(months/12)) borrowed_amount = (total_paid - total_interest) / (1 + interest...
John had 9 boxes of cookies. Each box had 6 cookies left. His friend, Jake, also had 9 boxes of cookies. One of his boxes had 11 cookies left and the other had 2 cookies left. How many more cookies did John have than Jake?
def solve() -> int: john_boxes = 9 john_cookies_per_box = 6 john_total_cookies = john_boxes * john_cookies_per_box jake_boxes = 9 jake_total_cookies = (jake_boxes - 2) * 6 + 11 + 2 difference = john_total_cookies - jake_total_cookies result = difference return result
Mike invested $1200 for 3 years at an interest rate of 8% per annum. How much interest did he receive at the end of the 3 years?
def solve() -> int: principal_amount = 1200 time_period = 3 interest_rate = 8 simple_interest = (principal_amount * time_period * interest_rate) / 100 result = simple_interest return result
Here are some possible questions and programs: Kimberly sold some bracelets. She sold three gold ones that cost $12 each, and some silver ones that cost $8 each. How many silver bracelets did Kimberly sell if she earned a total of $96?
def solve() -> int: gold_bracelets = 3 gold_cost = 12 silver_cost = 8 total_earned = 96 gold_total = gold_bracelets * gold_cost remaining = total_earned - gold_total silver_bracelets = remaining // silver_cost result = silver_bracelets return result
Jack has twice as many marbles as Jill has. If Jill has 20 marbles, how many marbles do Jack and Jill have in total?
def solve() -> int: jill_marbles = 20 jack_marbles = jill_marbles * 2 total_marbles = jill_marbles + jack_marbles result = total_marbles return result
Student: Emily rode a train from station A to station B and then boarded a bus from station B to station C. The train ride was 2 hours and the bus ride was 3 hours. What was the total trip time, in hours?
def solve() -> int: train_time = 2 bus_time = 3 total_time = train_time + bus_time result = total_time return result
A business started with $1000 and makes a profit of $200 each month. After how many months will they have $3000 in total?
def solve() -> int: start_money = 1000 monthly_profit = 200 goal_money = 3000 months = (goal_money - start_money)/monthly_profit result = months return result
The local park has a concession stand where they sell candy bars for $2 each, bags of chips for $2.50 each, and soda cans for $1. If they sold 25 candy bars, 40 bags of chips, and 100 soda cans, what is their total revenue?
def solve() -> int: candy = 25*2 chips = 40*2.5 soda = 100*1 revenue = candy + chips + soda result = revenue return result
Mia runs a bakery and sells cupcakes for $1.50 each. She estimates that 3% of her cupcakes are unsold at the end of the day and have to be thrown away. How many cupcakes does she need to bake each day to make a profit of $100?
def solve() -> int: price = 1.5 profit = 100 sold_percentage = 1 - 0.03 revenue = price * sold_percentage cupcakes = profit / revenue result = int(cupcakes) + 1 return result
There are 9 red, 5 blue, and 6 green balls in a bag. If one ball is picked at random, what is the probability that it's red?
def solve() -> int: total_balls = 9 + 5 + 6 red_balls = 9 probability_red = red_balls/total_balls result = probability_red return result
Ethan has 80 dollars. Chloe has 120 dollars. Leah has 250 dollars. How many more dollars does Leah have than both Ethan and Chloe combined?
def solve() -> int: ethan_money = 80 chloe_money = 120 leah_money = 250 total_money = ethan_money + chloe_money difference = leah_money - total_money result = difference return result
Jamie is planning a road trip. The distance between his starting point and his destination is 1200 miles. He plans to drive for 8 hours each day. If his car gets 30 miles per gallon and gas costs $3 per gallon, how much will he spend on gas for the whole trip?
def solve() -> int: distance = 1200 hours_per_day = 8 miles_per_gallon = 30 gas_price = 3 days = distance/(hours_per_day*miles_per_gallon) total_gas_cost = days*distance/miles_per_gallon*gas_price result = f"Jamie will spend ${total_gas_cost} on gas for the whole trip" return result
Emily has $900. She spent 20% of it on a new laptop and then spent $100 on a new phone. How much money does Emily have left?
def solve() -> int: money = 900 laptop = money*0.2 money = money - laptop money = money - 100 result = money return result
A computer game requires players to collect a certain number of coins to win. Each level has a different number of coins. If Player A collects 20 more coins than Player B in Level 1, and Player B collects 30 less coins than Player A in Level 2. If the total number of coins required to win the game is 300, and Player A ...
def solve() -> int: num_coins_a_lvl1 = 100 num_coins_b_lvl1 = num_coins_a_lvl1 - 20 num_coins_a_lvl2 = num_coins_b_lvl1 * 2 num_coins_b_lvl2 = num_coins_a_lvl2 - 30 num_coins_total = num_coins_a_lvl1 + num_coins_b_lvl1 + num_coins_a_lvl2 + num_coins_b_lvl2 num_coins_b_to_win = 300 - (num_coins_a...
Student: A rectangle has a length of 5 cm and a width of 3 cm. What is its area?
def solve() -> int: length = 5 width = 3 area = length * width result = area return result
A square has a perimeter of 28 cm. What is its area?
def solve() -> int: perimeter = 28 side_length = perimeter / 4 area = side_length ** 2 result = area return result
A machine can fill 200 bottles of water in 1.25 hours. How many bottles of water can the machine fill in 10 hours maintaining the same efficiency?
def solve() -> int: bottles_per_hour = 200 / 1.25 total_bottles = bottles_per_hour * 10 result = total_bottles return result
Student: Kyle has 33 pencils and 17 erasers. He gave away 5 pencils and 8 erasers. How many school supplies does he have left?
def solve() -> int: pencils = 33 erasers = 17 pencils_given_away = 5 erasers_given_away = 8 pencils_left = pencils - pencils_given_away erasers_left = erasers - erasers_given_away school_supplies_left = pencils_left + erasers_left result = school_supplies_left return result
Student: A treasure chest contained 45 jewels and a wicked pirate stole half of them. He then gave a third of the remaining jewels to his new crew. How many jewels did the pirate’s crew receive?
def solve() -> int: total_jewels = 45 stolen_jewels = total_jewels / 2 remaining_jewels = total_jewels - stolen_jewels crew_jewels = remaining_jewels / 3 result = crew_jewels return result
A gym charges a $100 initiation fee and $50 a month for membership. If Jane joins the gym, how much will she have paid after 8 months?
def solve() -> int: initiation_fee = 100 monthly_fee = 50 num_months = 8 total_cost = (monthly_fee * num_months) + initiation_fee result = total_cost return result