question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
Kaelan decides to buy a new iPhone and uses a coupon to get 15% discount. The iPhone cost $1,200 before discounts and the tax rate is 8%. How much did Kaelan pay?
def solve() -> int: original_cost = 1200 discount = 0.15 discount_price = original_cost * (1-discount) tax = 0.08 total_price = discount_price + discount_price * tax result = total_price return result
Student: During a book sale, books are discounted by 25%. If the original price of a book is $32, how much will it cost with the discount?
def solve() -> int: original_price = 32 discount_rate = 0.25 discount_amount = original_price * discount_rate discounted_price = original_price - discount_amount result = discounted_price return result
Colin is driving to the gas station. He has 5 gallons of gas in his car and his car gets 35 miles per gallon. How far can he drive before he runs out of gas?
def solve() -> int: gallons = 5 mpg = 35 miles = gallons * mpg result = miles return result
Emma needs 5 cartons of orange juice for her party. Each carton holds 12 glasses of juice. If she already has 24 glasses, how many more glasses of juice should she buy?
def solve() -> int: cartons_needed = 5 glasses_per_carton = 12 glasses_already_had = 24 total_glasses_needed = (cartons_needed * glasses_per_carton) - glasses_already_had result = total_glasses_needed return result
A factory produces 9,600 bottles of juice every day and packs them in crates of 24. If one fifth of the bottles are orange juice, and one sixth of the orange juice bottles have pulp, how many crates of juice with pulp are packed every day?
def solve() -> int: orange_juice_bottles = 9600 * 1/5 juice_bottles_with_pulp = orange_juice_bottles * 1/6 crates_of_juice_with_pulp = juice_bottles_with_pulp / 24 result = crates_of_juice_with_pulp return result
Sarah has 12 pens. Her mother gives Sarah her own collection of 36 pens. Over the month, Sarah receives one-sixth of that amount of pens between her birthday and Christmas. How many pens does Sarah now have?
def solve() -> int: sarah_pens = 12 mother_pens = 36 total_pens = sarah_pens + mother_pens pens_received = mother_pens / 6 sarah_pens_now = total_pens + pens_received result = sarah_pens_now return result
If Roque spends 5 minutes locking his bike, how many minutes does he spend a week locking and unlocking his bike?
def solve() -> int: total_ride = 2 * 1 total_lock = total_ride * 5 result = total_lock return result
A garden is 25 feet wide and 40 feet long. If James needs to cover the garden in grass seed, and one bag of grass seed covers 50 square feet, how many bags does he need to buy?
def solve() -> int: width = 25 length = 40 square_feet_per_bag = 50 total_square_feet = width * length bags_of_grass_seed = total_square_feet / square_feet_per_bag result = bags_of_grass_seed return result
The base of a triangle is 6 cm and its height is 8 cm. What is the area of the triangle?
def solve() -> int: base = 6 height = 8 area = 0.5 * base * height result = area return result
In a bag containing 20 balls, 12 are blue and the rest are red. What is the ratio of blue balls to red balls?
def solve() -> int: red = 20 - 12 ratio = 12/red result = ratio return result
Kim took two exams with different formats. The first exam had 25 multiple choice questions, each worth 4 points, and the second exam had 10 short answer questions, each worth 10 points. Kim got 80% of the multiple choice questions right and 70% of the short answer questions right. What was her total score on both exams...
def solve() -> int: first_exam_questions = 25 first_exam_points = 4 second_exam_questions = 10 second_exam_points = 10 first_exam_accuracy = 0.8 second_exam_accuracy = 0.7 first_exam_score = first_exam_questions * first_exam_points * first_exam_accuracy second_exam_score = seco...
Sarah weighed 75 kilograms before starting a diet program. She has lost 5 kilograms since then. What is her weight loss percentage?
def solve() -> int: start_weight = 75 current_weight = 70 lost_weight = start_weight - current_weight percentage = (lost_weight / start_weight) * 100 result = percentage return result
Kevin bought 5 notebooks for $2.50 each and 2 pencils for $0.25 each. He also bought a backpack for $25. He had a $5 off coupon for the backpack. He paid with a $50 bill. How much change did he receive?
def solve() -> int: total_cost = 5 * 2.5 + 2 * 0.25 backpack_cost = 25 - 5 final_cost = total_cost + backpack_cost change = 50 - final_cost result = change return result
A pizza with a diameter of 14 inches has been cut into 8 equal slices. If each slice has 200 calories, how many calories are in the entire pizza?
def solve() -> int: radius = 14/2 area = 3.14 * radius ** 2 calories = area * 8 * 200 result = calories return result
Tom and Jerry are organizing a food festival. Tom said he would raise 20% of the total cost. If the cost of the festival is $10,000, how much does Jerry need to pay to complete the cost?
def solve() -> int: total_cost = 10000 tom_contribution = total_cost * 0.2 jerry_contribution = total_cost - tom_contribution result = jerry_contribution return result
Javier has 25 apples. He gives away 3/5 of them to his friends. How many apples does he have left?
def solve() -> int: apples = 25 given_away = 3/5 * apples left = apples - given_away result = left return result
A single car tire needs 6 bolts. A pack of 120 bolts costs $30. How much would it cost to replace all the bolts on 8 car tires?
def solve() -> int: bolts_per_tire = 6 pack_cost = 30 pack_size = 120 tire_count = 8 bolts_needed = bolts_per_tire * tire_count packs_needed = bolts_needed / pack_size cost = packs_needed * pack_cost result = cost return result
Jacob had 80 baseball cards in his collection. He lost a fifth of them, gave a quarter to his friend, and traded 10 for a rare one. Then, his grandfather gifted him twice the number of cards he traded. How many baseball cards does Jacob have now?
def solve() -> int: cards_in_collection = 80 lost_cards = cards_in_collection / 5 cards_after_loss = cards_in_collection - lost_cards cards_given_to_friend = cards_after_loss / 4 cards_after_giving = cards_after_loss - cards_given_to_friend cards_traded = 10 cards_after_trading = cards_after...
A store's inventory of a certain item decreases by 10% each day. If the store had 500 of these items to start with, how many items will they have left after one week?
def solve() -> int: starting_inventory = 500 decrease_percentage = 0.1 days_passed = 7 current_inventory = starting_inventory * (1 - decrease_percentage)**days_passed result = current_inventory return result
Question1: Alice bought 30 apples for $24. What was the average cost per apple?
def solve() -> int: price_per_apple = 24 / 30 result = price_per_apple return result
Rachel is buying groceries for the week. She has a budget of $50. She wants to buy apples, bananas, and oranges. Apples cost $2 per pound, bananas cost $0.50 each, and oranges cost $1 per pound. She wants to buy 5 pounds of apples, 12 bananas, and enough oranges to spend all of her budget. How many pounds of oranges ca...
def solve() -> int: budget = 50 apples = 5 apple_price = 2 bananas = 12 banana_price = 0.5 orange_price = 1 orange_weight = (budget - (apples * apple_price) - (bananas * banana_price)) / orange_price result = orange_weight return result
At a juice store, 35% of the juices cost $3 and the rest cost $7. If 252 juices were sold, how much money was made in total?
def solve() -> int: total_num_juices = 252 cheap_juices_percentage = 0.35 cheap_juices_price = 3 expensive_juices_price = 7 cheap_juices_num = total_num_juices * cheap_juices_percentage expensive_juices_num = total_num_juices - cheap_juices_num total_sale = (cheap_juices_num ...
Joe needs to buy snacks for his basketball team. Each person gets 3 cookies and 2 bags of chips. There are 10 people on the team. How many bags of chips should Joe buy?
def solve() -> int: num_people = 10 num_cookies = 3 num_chips = 2 snacks_per_person = num_cookies + num_chips total_snacks = snacks_per_person * num_people num_chips_to_buy = total_snacks // 2 result = num_chips_to_buy return result
Kylie puts 20 notebooks in a box to give to her sister as a present. If there are 3 notebooks in each stack, how many stacks of notebooks is there?
def solve() -> int: notebooks = 20 notebooks_stack = 3 stacks = notebooks // notebooks_stack result = stacks return result
If a bird flew between two trees 14 times, and covered 2/3 of the distance on each flight, how far did the bird fly?
def solve() -> int: num_flights = 14 distance_covered_fraction = 2/3 total_distance = num_flights * distance_covered_fraction result = total_distance return result
Maria bought a pack of markers for $6.50. She then returned two markers and got a $0.95 refund. What was the price per marker?
def solve() -> int: original_price = 6.50 refund_amount = 0.95 number_of_markers = 3 price_per_marker = (original_price - refund_amount) / number_of_markers result = 2.28 return result
Danielle bakes cupcakes for her son's birthday party. She makes batches of 12 cupcakes and fills the liners 3/4 of the way full. In total how much batter did Danielle use?
def solve() -> int: batter_cupcake = 3/4 batches_cupcakes = (48/12) total_batter = 12*batches_cupcakes*batter_cupcake result = total_batter return result
Ava and Noah are required to row a total of 5000 meters in the lake. The lake length is 200 meters. If they each have rowed 10 laps, how many more laps do they have to row to achieve 5000 meters?
def solve() -> int: lake_length = 200 total_distance = 5000 laps_per_person = 10 distance_per_lap = lake_length * 2 total_laps_needed = total_distance / distance_per_lap laps_already_done = laps_per_person * 2 laps_left_to_do = total_laps_needed - laps_already_done result ...
A bakery made 60 cupcakes. They want to put 5 cupcakes in each box. How many boxes do they need?
def solve() -> int: cupcakes = 60 cupcakes_box = 5 boxes_needed = cupcakes // cupcakes_box result = boxes_needed return result
Ella saves $600 every month and starts with $10,000 in her account. After 4 months, she withdraws 5% of her savings. Then, she wins a reward that’s worth 50% more than what is left in her account. How much money does she have in total?
def solve() -> int: savings_per_month = 600 starting_amount = 10000 total_savings = starting_amount + (savings_per_month * 4) withdrawal_amount = total_savings * 0.05 remaining_savings = total_savings - withdrawal_amount reward_amount = remaining_savings * 1.5 total_...
Daniel has a bag of marbles. There are 500 red marbles and 400 blue marbles. What is the ratio of red marbles compared to blue marbles?
def solve() -> int: red = 500 blue = 400 ratio = red/blue result = ratio return result
Jeff has a stack of books that consists of 12 small books and 7 big books. Each small book is 3 inches thick and each big book is 5 inches thick. How many inches of thickness does the whole stack have?
def solve() -> int: small_books = 12 big_books = 7 small_thickness = 3 big_thickness = 5 result = small_books * small_thickness + big_books * big_thickness return result
A car travels 45 miles per hour. How far will it travel in 5 hours?
def solve() -> int: velocity = 45 time = 5 distance = velocity * time result = distance return result
Mia cut 60 pieces of ribbon on Monday, 20% more pieces of ribbon on Tuesday than on Monday, and 16 fewer pieces of ribbon on Wednesday than on Tuesday. How many pieces of ribbon did Mia cut in total?
def solve() -> int: monday = 60 tuesday = 1.2 * monday wednesday = tuesday - 16 total = monday + tuesday + wednesday result = total return result
A jar of cookies has 36 cookies. If you take away 8 cookies, what percentage of the original amount is left?
def solve() -> int: initial_cookies = 36 removed_cookies = 8 remaining_cookies = initial_cookies - removed_cookies percentage_left = (remaining_cookies / initial_cookies) * 100 result = percentage_left return result
Amanda invited 8 of her friends to the movies. Tickets cost $3.50 each. Amanda has a discount coupon that gives her 30% off the total cost. How much money did Amanda spend on the tickets?
def solve() -> int: num_friends = 8 ticket_cost = 3.5 discount = 0.3 cost_without_discount = ticket_cost * num_friends cost_after_discount = cost_without_discount * (1 - discount) result = cost_after_discount return result
If it takes 2 chefs 2 hours to bake 10 pizzas, how many pizzas can 1 chef bake in 2 hours?
def solve() -> int: chefs = 2 time = 2 pizzas = 10 pizzas_per_chef = pizzas / chefs pizzas_per_hour = pizzas_per_chef / time pizzas_baked = 1 * pizzas_per_hour result = pizzas_baked return result
Rachel is planning a party and needs to buy beverages. She estimates that each guest will drink 2 cans of soda and 1 bottle of water. If she is expecting 20 guests, how many cans of soda and bottles of water should she buy? Assume that soda is sold in packs of 12 and water is sold in packs of 6.
def solve() -> int: soda_needed = 20*2 water_needed = 20*1 soda_packs = soda_needed/12 water_packs = water_needed/6 result = (soda_packs, water_packs) return result
Student: 7. Ian is running a lemonade stand with a goal of selling 132 cup. He has 42 cups already. How many more cups does he need to reach his goal?
def solve() -> int: goal = 132 cups_sold = 42 cups_needed = goal - cups_sold result = cups_needed return result
A bookseller buys books for $3 each and sells them for $6 each. The bookseller bought 10 books and sold them all. How much was the bookseller’s total profit?
def solve() -> int: profit = (6-3)*10 result = profit return result
A rectangular field has a length of 25 meters and a width of 15 meters. What is its area in square meters?
def solve() -> int: length = 25 width = 15 area = length * width result = area return result
Rachel harvested 18 carrots from her garden. She turned 1/3 of them into carrot juice and sold it for $3 per glass, turned 1/6 of them into roasted carrots and sold them for $6 per plate, and kept the rest as whole carrots. It takes 6 carrots to make 1 glass of carrot juice and 3 carrots to make 1 plate of roasted carr...
def solve() -> int: carrots_harvested = 18 carrots_juice = carrots_harvested / 3 carrots_roasted = carrots_harvested / 6 carrots_whole = carrots_harvested - carrots_juice - carrots_roasted glasses_juice = carrots_juice / 6 plates_roasted = carrots_roasted / 3 money_juice = glasses_...
Maria has 3 boxes of candies. Each box contains 25 candies. If she eats 7 candies every day, how many days will it take her to finish all the candies?
def solve() -> int: candies = 3 * 25 days = candies // 7 result = days return result
John is a plumber who gets paid per job. He has $8000 in his account from previous jobs. He has three clients lined up, and the first client pays him 40% of his account once he finishes the job. The second client pays him 2/5 more than the first client. The third client pays him twice the amount paid by the first two c...
def solve() -> int: account = 8000 client1_payment = account * 0.4 client2_payment = client1_payment * (1 + 2/5) client3_payment = (client1_payment + client2_payment) * 2 total_payment = client1_payment + client2_payment + client3_payment result = account + total_payment return result
There are 72 students in a school bus, each sitting in rows of 3. However, 20% of the students are absent. How many rows of students were there on the school bus?
def solve() -> int: total_students = 72 absent_ratio = 0.2 seats_per_row = 3 present_students = total_students * (1 - absent_ratio) rows = present_students / seats_per_row result = rows return result
A bookstore is delivering 250 books to a library, and each book can either be fiction or non-fiction or a mixture of both. Out of the 250 books, 60 are fiction, 110 are non-fiction, and the rest are a mixture of the two. If the delivery man gives a fourth of the number of each book of genre to the first section, how ma...
def solve() -> int: total_books = 250 fiction_books = 60 non_fiction_books = 110 mixture_books = total_books - fiction_books - non_fiction_books non_fiction_first_section = non_fiction_books / 4 result = non_fiction_first_section return result
Student: John drove for 500 miles with an average speed of 50 mph. Calculate the time John took to complete the trip.
def solve() -> int: distance = 500 speed = 50 time = distance / speed result = time return result
Zoe and her family are having a picnic at the park. They have a total of 12 sandwiches for 5 people. How many sandwiches does each person get?
def solve() -> int: total_sandwiches = 12 num_people = 5 sandwiches_per_person = total_sandwiches/num_people result = sandwiches_per_person return result
Student: Abigail brought 2 bags of candy to a party. Each bag of candy had 6 pieces of candy. Abigail only wanted to give everyone 3 pieces of candy. How many people can Abigail give candy to?
def solve() -> int: bag_of_candy = 2 pieces_per_bag = 6 pieces_per_person = 3 total_pieces = bag_of_candy * pieces_per_bag total_people = total_pieces // pieces_per_person result = total_people return result
Student: Nina is a painter who sells her paintings online. She spends a sixth of an hour on painting each small painting and a quarter of an hour on painting each large painting. She also spends a tenth of an hour on packing each painting. If she sells 12 small paintings and 8 large paintings in a week, how many hours ...
def solve() -> int: small_paintings = 12 large_paintings = 8 time_spent_on_small_paintings = small_paintings * (1/6) time_spent_on_large_paintings = large_paintings * (1/4) total_time_spent_on_painting = time_spent_on_small_paintings + time_spent_on_large_paintings time_spent_on_packing = (small...
A book store buys books from a publisher for $8 each. The store sells one book for $15. However, for every 5 books that it buys, the publisher gives one free. If the store sells 100 books, how many did it buy from the publisher?
def solve() -> int: buy_price = 8 sell_price = 15 free_books_ratio = 5 num_sold = 100 num_bought = num_sold / (1 - 1/free_books_ratio) cost = num_bought * buy_price revenue = num_sold * sell_price profit = revenue - cost result = num_bought return result
If a bus travels at an average speed of 40 miles per hour and the journey takes 3.5 hours, how far did the bus travel?
def solve() -> int: average_speed = 40 journey_time = 3.5 distance = average_speed * journey_time result = distance return result
In a store, 70 percent of the customers buy apples, 50 percent of those who buy apples also buy bananas, and 40 percent of the customers buy neither apples nor bananas. If the store has 5000 customers, how many customers only buy bananas?
def solve() -> int: total_customers = 5000 apple_buyers_percent = 70 apple_and_banana_buyers_percent = 50 neither_apple_nor_banana_buyers_percent = 40 apple_buyers = (apple_buyers_percent/100)*total_customers only_banana_buyers = (apple_and_banana_buyers_percent/100)*apple_buyers neither_app...
Robert has 12 more coins than Luke. Luke has 24 coins. How many coins does Robert have?
def solve() -> int: Luke_coins = 24 Robert_coins = Luke_coins + 12 result = Robert_coins return result
Graeme paid $29.82 for 10 apples. How much did each apple cost?
def solve() -> int: total_cost = 29.82 num_apples = 10 cost_per_apple = total_cost / num_apples result = cost_per_apple return result
Possible questions and programs are: Alicia had $40 to buy some books for her school project. She bought 3 books that cost $9 each and 2 magazines that cost $4 each. How much money did Alicia have left?
def solve() -> int: total_cost = 3 * 9 + 2 * 4 money_left = 40 - total_cost result = money_left return result
The garden of Jimmy's house has 5 rows of plants and each row has 6 plants. How many plants does Jimmy's garden have in total?
def solve() -> int: rows = 5 plants_per_row = 6 result = rows * plants_per_row return result
6. Jacob's stick is four feet long. He covers 10 inches of the stick in dirt. The rest of the stick is one fifth of the length of Tina's stick. Wendy's stick is one and a half feet shorter than Tina's stick. How many inches long is Wendy's stick?
def solve() -> int: jacob_stick_length = 4 * 12 coverage_length = 10 dirt_free_length = jacob_stick_length - coverage_length tina_stick_length = dirt_free_length / 5 * 4 wendy_stick_length = tina_stick_length - 18 result = wendy_stick_length return result
Student: A store has a 20% sale on all items. A shirt costs 25€, a pair of shoes is 80€ and a backpack costs 50€. Calculate the total cost after the discount.
def solve() -> int: shirt = 25 shoes = 80 backpack = 50 discount = 0.2 shirt_discounted = shirt * (1 - discount) shoes_discounted = shoes * (1 - discount) backpack_discounted = backpack * (1 - discount) total_cost = shirt_discounted + shoes_discounted + backpack_discounted result = t...
Student: A restaurant bill comes to $75. If a 15% tip is to be given, what will be the total amount?
def solve() -> int: bill = 75 tip_percentage = 0.15 tip = bill * tip_percentage total_amount = bill + tip result = total_amount return result
A recipe calls for 1 cup of sugar and 2 cups of flour to make 12 muffins. If Jack wants to make 48 muffins, how much sugar and how much flour does he need?
def solve() -> int: muffins = 48 sugar_per_muffin = 1/12 flour_per_muffin = 2/12 sugar = muffins * sugar_per_muffin flour = muffins * flour_per_muffin result = (sugar, flour) return result
Student: Kelly bakes 4 15-minute batches of cookies and 2 20-minute batches of brownies. How long does she spend baking?
def solve() -> int: batches_cookies = 4 baking_time_cookies = 15 batches_brownies = 2 baking_time_brownies = 20 total_baking_time_cookies = batches_cookies * baking_time_cookies total_baking_time_brownies = batches_brownies * baking_time_brownies total_baking_time = total_baking_time_cooki...
Mary is buying a new laptop. The laptop costs $850 and the tax rate is 8%. If Mary also buys a carrying case for $40, what is the total cost?
def solve() -> int: price = 850 tax_rate = 0.08 carrying_case = 40 tax = price * tax_rate total_cost = price + tax + carrying_case result = total_cost return result
Student: Emily and Sarah are planning a picnic for their classmates. Emily buys six sandwiches at $4 each and eight juice boxes at $1.50 each. Sarah purchases seven granola bars at $2 each and twelve water bottles at $0.75 each. How much money do they spend in total?
def solve() -> int: sandwiches_price = 4 juice_price = 1.50 granola_price = 2 water_price = 0.75 sandwiches_num = 6 juice_num = 8 granola_num = 7 water_num = 12 total_spent_by_emily = sandwiches_price * sandwiches_num + juice_price * juice_num total_spent_by_sarah = granola_price...
Student: In a class of 30 students, 1/3 of the students are girls. If 2/5 of the boys are absent, how many boys are present in the class?
def solve() -> int: total_students = 30 girls = total_students / 3 boys = total_students - girls absent_boys = boys * 2 / 5 present_boys = boys - absent_boys result = present_boys return result
A pizza slice has an area of 24 square inches. If a whole pizza pie has an area of 144 square inches, how many slices can you get from the pizza?
def solve() -> int: slice_area = 24 pie_area = 144 num_slices = pie_area // slice_area result = num_slices return result
A classroom has 20 desks. Each desk can seat 2 students. If there are 35 students in the class, how many extra desks are there?
def solve() -> int: desks = 20 students = 35 seats = 2 total_seats = desks * seats extra_desks = (students - total_seats // seats) // seats result = extra_desks return result
Emma wants to reach her sister's house, which is 60 miles away. She bikes to her sister's house at 10 miles per hour. After biking for half an hour, she realizes that she forgot her phone at home. Her sister drives to her to give the phone at a speed of 30 miles per hour. How long does her sister travel in minutes?
def solve() -> int: distance = 60 emma_speed = 10 emma_time = 0.5 emma_distance = emma_speed * emma_time remaining_distance = distance - emma_distance sister_speed = 30 sister_time = remaining_distance / sister_speed sister_time_minutes = sister_time * 60 result = sister_time_minutes...
Tom collected 60 pencils. Emma collected three times as many pencils as Tom. If Tom lost a third of his pencils and Emma gave out a quarter of hers, how many pencils do they have left now?
def solve() -> int: tom_pencils = 60 emma_pencils = 3 * tom_pencils tom_lost = tom_pencils / 3 emma_gave_out = emma_pencils / 4 tom_left = tom_pencils - tom_lost emma_left = emma_pencils - emma_gave_out result = tom_left + emma_left return result
A soccer team played 4 games and have scored 7 goals. In the last game, they scored 3 goals. What was their average goals per game before the last game?
def solve() -> int: games_played = 4 total_goals_scored = 7 goals_scored_in_last_game = 3 average_goals_per_game = (total_goals_scored - goals_scored_in_last_game) / (games_played - 1) result = average_goals_per_game return result
A student's average grade for 3 tests is 83. If the first two tests had an average grade of 82 and the first and third tests had an average grade of 84, what was the student's grade on the third test?
def solve() -> int: average_grade = 83 average_first_two = 82 average_first_and_third = 84 third_test_grade = (3 * average_grade) - (2 * average_first_two) - average_first_and_third result = third_test_grade return result
John spent a third of his savings on a bike, then spent half of what he had left on clothes. If he had $300 left, how much money did he originally have?
def solve() -> int: money_left = 300 money_spent_on_clothes = money_left * 2 money_left_after_bike_purchase = money_spent_on_clothes * 3 original_money = money_left_after_bike_purchase result = original_money return result
The corner store has 40 pounds of apples that need to be divided equally among 4 customers. How many pounds of apples will each customer get?
def solve() -> int: total_pounds = 0 pounds_per_customer = 0 num_customers = 4 total_pounds = 40 pounds_per_customer = total_pounds/num_customers result = pounds_per_customer return result
A jar contains 890 black buttons and 458 white buttons. What fraction of the buttons in the jar are black?
def solve() -> int: total_buttons = 890 + 458 black_buttons = 890 black_fraction = black_buttons/total_buttons result = black_fraction return result
Nathan needed to buy cleaning supplies for his business and purchased 4 bottles of glass cleaner for $15 each, 2 jugs of floor cleaner for $25 each, and 3 bottles of cleaning solution for $20 each. How much did he pay in total?
def solve() -> int: num_of_glass_cleaner = 4 cost_per_glass_cleaner = 15 num_of_floor_cleaner = 2 cost_per_floor_cleaner = 25 num_of_cleaning_solution = 3 cost_per_cleaning_solution = 20 total_cost = (num_of_glass_cleaner * cost_per_glass_cleaner) + (num_of_floor_cleaner * cos...
A grocery store has a shelf that holds 24 cans of soda. If they have a total of 720 cans, how many shelves will be completely filled?
def solve() -> int: cans_per_shelf = 24 total_cans = 720 filled_shelves = total_cans // cans_per_shelf result = filled_shelves return result
Student: A small company has 12 employees who work for 8 hours/day and earn $20/hour. If the company also spends $300/month on office supplies, how much does the company pay in total for one month?
def solve() -> int: employees = 12 hours_per_day = 8 wage_per_hour = 20 office_supplies_cost = 300 total_hours_per_month = employees * hours_per_day * 30 total_wage_per_month = total_hours_per_month * wage_per_hour total_cost_per_month = total_wage_per_month + office_supplies_cost result...
Max is a mechanic who repaired a car engine and charged the customer $200 less than six times more than he charged for his previous engine repair. If he charged $500 for his previous engine repair, how much did he charge for the recent repair?
def solve() -> int: previous_repair_charge = 500 recent_repair_charge = (6 * previous_repair_charge) - 200 result = recent_repair_charge return result
A pyramid has a base of 10 meters by 8 meters, and has a height of 6 meters. What is the volume of the pyramid?
def solve() -> int: base_length = 10 base_width = 8 height = 6 base_area = base_length*base_width volume = (1/3)*base_area*height result = round(volume, 2) return result
Student: Najwa went to the store and bought 12 cans of foods. Each can contained 6 servings. If she ate 4 servings from one can, how many servings are still left in the 12 cans?
def solve() -> int: cans = 12 servings_per_can = 6 servings_eaten = 4 servings_left = (cans * servings_per_can) - servings_eaten result = servings_left return result
James has 7 hours to work on a project and 1 hour to walk his dog, then divides the remainder of his day equally between practicing piano and singing. He sleeps 9 hours. If all of this happened within one day, how many hours did James spend practicing piano?
def solve() -> int: total_hours = 24 work_hours = 7 dog_walk_hours = 1 sleep_hours = 9 leisure_hours = total_hours - work_hours - dog_walk_hours - sleep_hours piano_hours = leisure_hours / 2 result = piano_hours return result
Ella wants to buy a book that costs $18. She has $12 in her wallet and $6 in her piggy bank. She also finds a coupon that gives her a 10% discount on the book. How much money does she have left after buying the book?
def solve() -> int: discounted = 18 * 0.9 total = 12 + 6 left = total - discounted left = round(left, 2) result = left return result
Student: In a class of 80 students, the ratio of boys to girls is 9:11. How many girls are in the class?
def solve() -> int: boys = 80 * (9/20) girls = 80 * (11/20) result = girls return result
Student: Mr. Johnson's garden is 20 feet long and 10 feet wide. What is the area of his garden?
def solve() -> int: length = 20 width = 10 area = length * width result = area return result
Ben and Sam are collecting stickers for a contest. Ben has 150 stickers and Sam has 90 stickers. Each sticker has a point value from 1 to 5. Ben has 50 stickers with 1 point, 40 stickers with 2 points, 30 stickers with 3 points, 20 stickers with 4 points, and 10 stickers with 5 points. Sam has 30 stickers with 1 point,...
def solve() -> int: ben_points = 50 * 1 + 40 * 2 + 30 * 3 + 20 * 4 + 10 * 5 sam_points = 30 * 1 + 20 * 2 + 15 * 3 + 12 * 4 + 13 * 5 result = ben_points - sam_points return result
Olivia began practicing yoga in 2013. If she was born in 1997 and has been practicing for 8 years, how old is she now? Ms. Johnson had 20 pencils in her bag. She buys new packs of pencils that have 12 pencils in each pack. Now, she has 92 pencils. How many new packs did Ms. Johnson buy?
def solve() -> int: birth_year = 1997 current_year = 2021 years_practicing = 8 olivia_age = current_year - birth_year olivia_age_now = olivia_age + years_practicing pencils_in_bag = 20 pencils_per_pack = 12 total_pencils = 92 pencils_bought = total_pencils - pencils_in...
Chantelle opened a bag of candy and found small lollipops. In the bag there were 27 lollipops. If Chantelle can fit 5 lollipops in 1 bag, how many bags will she need to put all 27 lollipops in?
def solve() -> int: total_bags = 0 lollipops_in_bag = 5 total_lollipops = 27 while total_lollipops > 0: if total_lollipops >= lollipops_in_bag: total_bags += 1 total_lollipops -= lollipops_in_bag else: total_bags += 1 total_lol...
A rectangular garden is 20 meters long and 15 meters wide. How many trees are needed in the garden if there should be one tree every 10 square meters?
def solve() -> int: garden_area = 20 * 15 trees_per_square_meter = 1/10 trees_needed = garden_area * trees_per_square_meter result = trees_needed return result
A car travels at a rate of 60 miles per hour. If the car travels for 2.5 hours, how far does it travel?
def solve() -> int: rate = 60 time = 2.5 distance = rate*time result = distance return result
Jim has a part-time job that pays him $12.50 per hour. He worked 15 hours this week, and gets a bonus of $50.00. He saves 30% of his income. How much money will he save this week?
def solve() -> int: hourly_rate = 12.50 hours_worked = 15 bonus = 50 savings_percentage = 30 earnings_this_week = hourly_rate * hours_worked + bonus savings_this_week = earnings_this_week * savings_percentage / 100 result = savings_this_week return result
A car rental charges $50 per day for a car and $20 per day for a GPS. During a one-week trip, a family rented a car with a GPS for 3 days and then returned the GPS but kept the car for the remaining 4 days. Calculate the total rental charge.
def solve() -> int: car = 50*4 gps = 20*3 total = car+gps result = total return result
10. Andy bought 5 gallons of fuel this week, and next week he will buy 15% more fuel. How much fuel will he buy in total?
def solve() -> int: fuel_this_week = 5 fuel_next_week = fuel_this_week * 1.15 result = fuel_this_week + fuel_next_week return result
A car travels 80 miles in 2 hours. If it continues driving at the same speed, how far will it travel in 3.5 hours?
def solve() -> int: distance1 = 80 time1 = 2 time2 = 3.5 distance2 = (distance1 / time1) * time2 result = distance2 return result
A community center raised $150 during their annual book sale fundraiser on Thursday. On Friday, they raised $10 more than five times their earnings from Thursday. They made an additional $70 on Saturday than what they made on Thursday. What is the total amount they raised over the three days?
def solve() -> int: thursday_earnings = 150 friday_earnings = (5 * thursday_earnings) + 10 saturday_earnings = thursday_earnings + 70 total_earnings = thursday_earnings + friday_earnings + saturday_earnings result = total_earnings return result
A machine can produce 60 items in an hour. How many items can it produce in 8 hours?
def solve() -> int: items_per_hour = 60 total_items = items_per_hour * 8 result = total_items return result
The Abraj Al-Bait Clock Tower in Mecca is 1,972 feet tall with 120 floors. If the first to 119th floors have height each equal to 18.2 feet, how high is the 120th floor?
def solve() -> int: height_per_floor = 18.2 total_floors = 120 tower_height = height_per_floor * (total_floors - 1) floor_120_height = tower_height - (height_per_floor * 118) result = floor_120_height return result
Andrew's gym bag is 3 times the size of Kevin's gym bag. If Kevin's gym bag can hold 20 pounds of equipment and it's filled up to 80% of its capacity, and Andrew's gym bag is filled to 50% of its capacity, calculate the total weight that both bags can carry.
def solve() -> int: kevin_bag_size = 20 andrew_bag_size = kevin_bag_size * 3 kevin_bag_capacity = kevin_bag_size * 0.8 andrew_bag_capacity = andrew_bag_size * 0.5 total_capacity = kevin_bag_capacity + andrew_bag_capacity result = total_capacity return result
-Put each new question on a new line (blank lines are also allowed). Some possible questions and programs are: A baker makes 150 muffins for a school event. He sells 1/6 of them in the morning and another 2/5 of the remaining muffins in the afternoon. At the end of the day, he gives away 1/4 of what he has left to a ch...
def solve() -> int: muffins = 150 morning_sold = muffins // 6 muffins = muffins - morning_sold afternoon_sold = muffins * 2 // 5 muffins = muffins - afternoon_sold charity_given = muffins // 4 muffins = muffins - charity_given result = muffins ...
Tom has 5 boxes of cat food. The first two boxes contain 10 cans each and the other three boxes have 2 fewer cans of cat food than the first two. If Tom feeds his cats twice a day, how many cans of cat food will he need in a week?
def solve() -> int: box1 = 10 box2 = 10 box3 = box1 - 2 box4 = box2 - 2 box5 = box1 - 2 total_cans = box1 + box2 + box3 + box4 + box5 cans_per_day = total_cans / 2 cans_per_week = cans_per_day * 7 result = cans_per_week return result
A baker made 16 loaves of bread in the morning. Each hour, he sold 20% of the remaining bread and made 4 more loaves. After 6 hours, how many loaves of bread did he have left?
def solve() -> int: loaves = 16 hours = 6 for hour in range(hours): loaves = loaves * 0.8 + 4 result = loaves return result