question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
A book of 500 pages has been read by a reader. If the reader reads 20 pages every day, how many days did it take to finish the book?
def solve() -> int: total_pages = 500 pages_per_day = 20 total_days = total_pages / pages_per_day result = total_days return result
Amaya was asked to bring 9 cookies to her family's picnic. She brought 4 batches of 3 cookies each as well as 1 single cookie for a total of 13 cookies. How many extra cookies did Amaya bring?
def solve() -> int: cookies_asked = 9 cookies_batch = 3 single_cookie = 1 result = (cookies_asked // cookies_batch + single_cookie) -cookies_asked return result
George is forming a triangular prism shape by using 3 cubes, the sides on three faces of each cube are 1 cm. What is the total surface area of the prism?
def solve() -> int: num_cubes = 3 side = 1 surface_area_cube = 6* side*side surface_area = num_cubes * surface_area_cube result = 18 return result
Jorge goes for a jog every day for 6 days in a row. He jogs for 8 miles each time. How many total miles did Jorge jog in that 6-day period?
def solve() -> int: cumulative_miles = 0 for num_jogs in range(6): cumulative_miles += 8 result = cumulative_miles return result
If it takes Alex 30 minutes to cook rice, 45 minutes to marinate the chicken, and 15 minutes to roast the vegetables, and Alex is making dinner for 4 people, how long does it take Alex to make dinner?
def solve() -> int: rice_time = 30 chicken_time = 45 vegetables_time = 15 num_people = 4 total_time = rice_time + chicken_time + vegetables_time dinner_time = total_time * num_people result = dinner_time return result
A coin was flipped 100 times, and it landed on heads 57 times. What is the probability of the coin landing on heads?
def solve() -> int: total_flips = 100 num_heads = 57 probability_of_heads = num_heads / total_flips result = probability_of_heads return result
arah wants to buy a new laptop that costs $800. She has saved $500 already and her parents agreed to give her 20% of the price as a gift. How much more money does she need to buy the laptop?
def solve() -> int: price = 800 saved_money = 500 gift_money = price * 0.2 result = price - saved_money - gift_money return result
3. In an English Test, Jacob scored 6 and has 1/2 the score of his brother, Aaron. What is Aaron's score?
def solve() -> int: score_jacob = 6 score_aaron = score_jacob * 2 result = score_aaron return result
Karen is making pancakes for herself. She needs to make 6 pancakes, and it takes her 3 minutes to cook each pancake. She also needs to mix the batter, which takes 2 minutes. How long, in minutes, does it take Karen to make her pancakes?
def solve() -> int: pancake_cooking_time = 3 pancake_quantity = 6 batter_mixing_time = 2 total_cooking_time = pancake_quantity * pancake_cooking_time total_time = total_cooking_time + batter_mixing_time result = total_time return result
There are 5 students waiting for the soccer ball and four times as many students waiting for the basketball. If each student waits 3 minutes for the soccer ball and 10 seconds for the basketball, how many seconds shorter is the shorter wait?
def solve() -> int: soccer_students = 5 basketball_students = 4 * soccer_students soccer_wait_time = 3 basketball_wait_time = 10 soccer_total_wait_time = soccer_students * soccer_wait_time basketball_total_wait_time = basketball_students * basketball_wait_time shorter_wait_time = s...
Mark has $15 and wants to buy some snacks. Apples cost 50 cents each and oranges cost 25 cents each. How many apples and oranges can he buy?
def solve() -> int: num_apples = 0 num_oranges = 0 money = 15 apple_price = 0.5 orange_price = 0.25 num_apples = money // apple_price num_oranges = (money - (num_apples * apple_price)) // orange_price result = num_apples, num_oranges return result
There are 24 computers in a lab. On the first day, one-third of them were updated, and on the second day, one-quarter were updated. How many computer updates are left?
def solve() -> int: computers = 24 updates1 = round(computers * 1/3) updates2 = round((computers - updates1) * 0.25) updates_left = computers - (updates1 + updates2) result = updates_left return result
A jar contains 120 marbles. If 30% of the marbles are red, how many red marbles are there?
def solve() -> int: total_marbles = 120 red_marbles = total_marbles * 0.30 result = red_marbles return result
A cake recipe calls for 2 cups of flour, 1 cup of sugar, and 1/2 cup of butter. If Mary wants to make 3 cakes, how much of each ingredient does she need?
def solve() -> int: cups_flour = 2 cups_sugar = 1 cups_butter = 0.5 num_cakes = 3 total_flour = cups_flour * num_cakes total_sugar = cups_sugar * num_cakes total_butter = cups_butter * num_cakes result = (total_flour, total_sugar, total_butter) return result
A movie theater sells 300 tickets for a screening. If adult tickets cost $10 and children's tickets cost $6, and the theater sells twice as many adult tickets as children's tickets, how much money will they make in total?
def solve() -> int: adult_price = 10 child_price = 6 num_childrens_tickets = 300 / 3 num_adult_tickets = 2 * num_childrens_tickets total_money = num_childrens_tickets * child_price + num_adult_tickets * adult_price result = total_money return result
Emma makes a quilt with 48 squares. She uses 6 pink squares and 2 times as many blue squares as pink squares. Then she uses twice as many purple squares as the blue and pink squares combined. If the rest of the squares she uses are white, how many white squares does she use?
def solve() -> int: blue = 6 * 2 purple = (6 + blue) * 2 not_white = 6 + blue + purple white = 48 - not_white result = white return result
Ava wants to buy a wedding dress that costs $1,000 and a pair of bridal shoes that cost $200. She found a deal where she can get a 20% discount on the dress and buy the shoes at 50% off if she buys both items at the same time. How much money would she save by purchasing the items together?
def solve() -> int: dress_cost = 1000 shoes_cost = 200 dress_discount = dress_cost * 0.2 shoes_discount = shoes_cost * 0.5 total_savings = dress_discount + shoes_discount result = total_savings return result
If a girl collected 17 candy wrappers and 5 candy wrappers makes 1 bookmark, how many bookmarks can she make?
def solve() -> int: num_wrappers = 17 wrappers_per_bookmark = 5 num_bookmarks = num_wrappers / wrappers_per_bookmark result = num_bookmarks return result
Student: In a classroom of 32 students, 20 are female and 12 are male. What is the ratio of female to male?
def solve() -> int: num_female = 20 num_male = 12 ratio = num_female / num_male result = ratio return result
A chocolate factory produces 500 chocolate bars per day. If they have to package them in boxes of 12, how many boxes will they need in a week (7 days)?
def solve() -> int: choco_bars_per_day = 500 boxes_per_pack = 12 days_per_week = 7 total_choco_bars = choco_bars_per_day * days_per_week total_packs = total_choco_bars // boxes_per_pack + (total_choco_bars % boxes_per_pack > 0) result = total_packs return result
In a math test, Amy scored half as much as the lowest scorer in the class. If there were 18 students and the average score was 75, what was Amy's score?
def solve() -> int: number_of_students = 18 average_score = 75 lowest_score = average_score * 2 / number_of_students amy_score = int(lowest_score / 2) result = amy_score return result
Martina cannot sleep well at night, so she drinks a cup of chamomile tea every day. Each box of tea consists of 8 tea bags, and each tea bag can make a cup of tea. If she drinks 8 cups a day, how many boxes of chamomile tea will she use in a month?
def solve() -> int: tea_bags_box = 8 cups_day = 8 days_month = 30 boxes = (cups_day * days_month) / tea_bags_box result = boxes return result
A train is traveling at a speed of 80 km/h for two hours. It then increases its speed to 100 km/h and travels for another hour. How far has the train traveled in total?
def solve() -> int: distance1 = 80 * 2 distance2 = 100 * 1 total_distance = distance1 + distance2 result = total_distance return result
Thomas is collecting marbles for a game. He has gathered 8 jars of 10 marbles each and has sorted them by color. He plans to collect the rest of the marbles and sort them as well, with each jar holding 12 marbles. If he needs to have a total of 100 marbles for the game, how many more jars should he fill?
def solve() -> int: jars_already_filled = 8 marbles_per_jar = 10 additional_marbles_per_jar = 12 total_marbles_needed = 100 total_marbles_already_filled = jars_already_filled * marbles_per_jar additional_marbles_needed = total_marbles_needed - total_marbles_already_filled additional_jar...
Student: In a jar, there are 94 marbles. It has 18 fewer than four times the marbles that Leo has. How many marbles does Leo have?
def solve() -> int: jar = 94 leo = None leo = (jar + 18) / 4 result = leo return result
In a chemistry class, 60% of the students are women and 90 are men. How many women are there?
def solve() -> int: x = 90 / 0.4 women = 0.6 * x result = round(women) return result
A household's electricity bill increased from 120 dollars to 150 dollars per month. What percentage increase is this?
def solve() -> int: old_bill = 120 new_bill = 150 percentage_increase = (new_bill - old_bill)/old_bill * 100 result = percentage_increase return result
Kevin has a rectangular garden that is 12 meters long and 8 meters wide. He wants to fence it with a wire that costs €5 per meter. How much does he need to pay for the wire?
def solve() -> int: length = 12 width = 8 cost = 5 perimeter = 2 * (length + width) total = cost * perimeter result = total return result
A company sells 3 types of shirts, each with a different price. Type 1 costs $10, type 2 costs $15, and type 3 costs $20. If the company sold 10 Type 1 shirts, 5 Type 2 shirts, and 7 Type 3 shirts, how much money did they make in total?
def solve() -> int: type1_cost = 10 type2_cost = 15 type3_cost = 20 num_type1 = 10 num_type2 = 5 num_type3 = 7 total_cost = (type1_cost*num_type1) + (type2_cost*num_type2) + (type3_cost*num_type3) result = total_cost return result
David has 70 baseball cards. He buys 10 more baseball cards and decides to split them equally with his friend Henry, who has two thirds of the total number of baseball cards that David has. How many baseball cards do they each end up with?
def solve() -> int: davids_cards = 70 henrys_cards = (2/3) * davids_cards total_cards = davids_cards + 10 cards_each = total_cards / 2 davids_cards += 10 davids_cards /= 2 henrys_cards += 5 henrys_cards /= 2 result = cards_each return result
A toy store sells a pack of 12 crayons for $1.50. If a customer buys 3 packs, how much will they spend in total?
def solve() -> int: pack_price = 1.5 crayons_per_pack = 12 packs_bought = 3 total_price = pack_price * crayons_per_pack * packs_bought result = total_price return result
Possible new questions and programs are: Kate is making lemonade for a party. She has 24 lemons and wants to make 8 cups of lemonade. Each lemon produces 0.25 cups of juice and she needs 0.75 cups of juice for each cup of lemonade. How many lemons will she have left after making lemonade?
def solve() -> int: juice = 24 * 0.25 lemonade = juice // 0.75 used = lemonade * 0.75 used_lemons = used / 0.25 left_lemons = 24 - used_lemons result = left_lemons return result
A pizza has 8 slices, while a large pizza has 12 slices. What is the percentage difference in the number of slices between a large pizza and a regular pizza?
def solve() -> int: regular = 8 large = 12 difference = large - regular percent_difference = (difference / large) * 100 result = percent_difference return result
On Monday, 9 teachers were present in the school. On Tuesday, three times the number on Monday arrived. On Wednesday, one-third of the teachers left. How many teachers are in the school by Wednesday?
def solve() -> int: teachers_monday = 9 teachers_monday_triple = teachers_monday*3 teachers_wednesday_third = teachers_monday_triple/3 result = teachers_monday_triple - teachers_wednesday_third return result
If Sarah has 8 boxes of pencils, and each box has 24 pencils, and each pencil costs $. 25, how much does Sarah spend in total?
def solve() -> int: boxes_of_pencils = 8 pencils_per_box = 24 cost_per_pencil =.25 total_pencils = boxes_of_pencils * pencils_per_box total_cost = total_pencils * cost_per_pencil result = total_cost return result
Felicia, Greg, and Hailey are saving money for a trip. Felicia has 1.5 times more money than Greg. Hailey has 10 dollars less than Felicia. If Greg has 40 dollars, how much money do the three have together?
def solve() -> int: felicia = 0 greg = 0 hailey = 0 greg = 40 felicia = 1.5 * greg hailey = felicia - 10 total = felicia + greg + hailey result = total return result
Student: A football team lost 5 yards on one play and then gained 8 yards on the next. What was their net gain or loss for the two plays?
def solve() -> int: yards_lost = 5 yards_gained = 8 net_gain_or_loss = yards_gained - yards_lost result = net_gain_or_loss return result
A tank holds 500 liters of water. If 40 liters of water are used each day, how many days will it take to empty the tank?
def solve() -> int: tank_size = 500 water_used_per_day = 40 days_to_empty_tank = tank_size // water_used_per_day result = days_to_empty_tank return result
A laptop is being sold at a lower price due to a 10% discount. If the original price of the laptop is $600, how much money will be saved through the discount?
def solve() -> int: price = 600 discount = 0.1 discounted_price = price - price * discount result = discounted_price return result
A pizza parlor has sold 200 pizzas in a week. 25% of the pizzas contained pepperoni. How many pepperoni pizzas were sold?
def solve() -> int: total_pizzas = 200 percent_with_pepperoni = 25 pepperoni_pizzas = (percent_with_pepperoni/100) * total_pizzas result = pepperoni_pizzas return result
A plumber charges $80 for a call-out fee and $60 per hour of work. If the plumber took 4 hours to complete the job, what is the total cost?
def solve() -> int: call_out_fee = 80 hourly_rate = 60 hours = 4 total_cost = call_out_fee + hourly_rate*hours result = total_cost return result
Emily went to the library and borrowed seven books. On the first day, she read two books and then read one book for the next four days. On the last day, she read the remaining book and returned all the books to the library. How many books did she read in total?
def solve() -> int: books_borrowed = 7 books_read_first_day = 2 books_read_per_day = 1 days_reading = 4 books_read_last_day = 1 books_returned = books_borrowed books_read = books_read_first_day + books_read_last_day + (books_read_per_day * days_reading) result = books_read ...
5. Bob has a total of 10 token after shopping. He gives 2 to his friend and receives 3 in return, how many tokens does Bob have now?
def solve() -> int: Bob_token = 10 Given_tokens = 2 Received_tokens = 3 Remaining_tokens = Bob_token-(Given_tokens-Received_tokens) result = Remaining_tokens return result
If a tortilla has a diameter of 15 cm and a thickness of 0.5 cm, what is the area of the tortilla?
def solve() -> int: diameter = 15 thickness = 0.5 radius = diameter/2 area = (radius**2)*3.14*thickness result = area return result
Student: Sonya and her family went on a road trip and drove 24 miles in the first hour and 16 miles in the second hour. What was their average speed in miles per hour?
def solve() -> int: distance_1 = 24 distance_2 = 16 time_1 = 1 time_2 = 1 total_distance = distance_1 + distance_2 total_time = time_1 + time_2 average_speed = total_distance / total_time result = average_speed return result
san had 80 pieces of candy. She gave away 12 of them. How many pieces of candy does she have now?
def solve() -> int: candy_initial = 80 candy_given_away = 12 candy_left = candy_initial - candy_given_away result = candy_left return result
Student: David has 360 marble pieces and wants to evenly divide them among 9 containers. How many marbles will he put in each container?
def solve() -> int: marbles = 360 containers = 9 marbles_per_container = marbles / containers result = marbles_per_container return result
Student: Jeff has $90. He plans to buy 4 bags of apples, each bag costing $5. How much money does he have after buying the apples?
def solve() -> int: money = 90 bag_cost = 5 bags = 4 total_cost = bag_cost * bags remaining_money = money - total_cost result = remaining_money return result
Tom has been hospitalized for smoking-related illnesses many times. For every instance of hospitalization, he has to stay for a month. If he has spent a total of 2 years in the hospital, how many instances of smoking-related illnesses is he responsible for?
def solve() -> int: months_in_a_year = 12 total_months_in_hospital = 2 * months_in_a_year months_per_hospitalization = 1 instances_of_illness = total_months_in_hospital / months_per_hospitalization result = instances_of_illness return result
Mark and Kaitlyn are playing a game where they earn 10 points if they win any round. If they played eleven matches and Kaitlyn won 8/9 of the matches, what is the total number of points that Mark earned?
def solve() -> int: rounds_played = 11 number_of_wins_by_kaitlyn = 8 points_for_winning_round = 10 total_points_earned_by_mark = rounds_played * points_for_winning_round - number_of_wins_by_kaitlyn*points_for_winning_round result = total_points_earned_by_mark return result
Each floor has 9 rooms, each of which has 2 beds and can accommodate 4 people in total. If the hotel has 80% of its full occupancy, how many people can the hotel accommodate?
def solve() -> int: max_occupancy = 8 * 9 * 4 occupancy = max_occupancy * 0.8 result = int(occupancy) return result
Adam is building a treehouse. He needs to hammer nails for 4 hours, but first, he needs to cut the wood. The whole process will take 7 hours. Cutting the wood takes 2/7 as much time as hammering the nails. How long does it take Adam to cut the wood?
def solve() -> int: hours_hammering = 4 total_hours = 7 cutting_ratio = 2/7 hours_cutting = total_hours - hours_hammering hours_hammering_to_cutting_ratio = hours_hammering / hours_cutting hours_cutting = hours_hammering_to_cutting_ratio * cutting_ratio * hours_hammering resul...
John has twice as many apples as Mary. If Mary has 10 apples, how many apples does John have?
def solve() -> int: mary_apples = 10 john_apples = 2 * mary_apples result = john_apples return result
Abraham is twice as old as his cousin Nadia. If Nadia is 16 years old, how old is Abraham?
def solve() -> int: Nadia_age = 16 Abraham_age = Nadia_age * 2 result = Abraham_age return result
Student: Peter has 7 toy cars and his friend Alex has half as many. Alex gives Peter 2 cars. How many toy cars do they have altogether now?
def solve() -> int: peter = 7 alex = peter // 2 peter = peter + 2 alex = alex - 2 total = peter + alex result = total return result
In a bond investment, an investor buys a bond with a face value of $10,000 and a coupon rate of 5% for 3 years. The investor receives interest every 6 month. What is the total interest earned by the investor in 3 years?
def solve() -> int: coupon_rate = 0.05/2 face_value = 10000 time_in_years = 3 compound_periods = 2*time_in_years future_value = face_value*(1 + coupon_rate)**compound_periods total_interest = future_value - face_value result = total_interest return result
Debra is 28 years old. When she was born her elder sister Denise was 5 years old. David is their elder brother and is 10 years older than Denise. How old will David be after 7 years?
def solve() -> int: debra_age = 28 denise_age = debra_age - 5 david_age = denise_age + 10 david_age_in_7_years = david_age + 7 result = david_age_in_7_years return result
A sack contains 56 chickens, 46 rabbits, and 76 ducks. 9 chickens, 15 rabbits, and 17 ducks escape the sack. How many animals are left in the sack?
def solve() -> int: sack_of_animals = [56, 46, 76] no_of_escaped_animals = [9, 15, 17] result = sack_of_animals[0] - no_of_escaped_animals[0] + sack_of_animals[1] - no_of_escaped_animals[1] + sack_of_animals[2] - no_of_escaped_animals[2] return result
A fruit vendor had 320 oranges in stock. On Monday, she sold 56 oranges and restocked with 120 new oranges. On Tuesday, she sold 89 oranges and restocked with 78 new oranges. How many oranges did the vendor have in stock on Tuesday evening?
def solve() -> int: oranges_in_stock = 320 oranges_sold_monday = 56 new_oranges_monday = 120 oranges_sold_tuesday = 89 new_oranges_tuesday = 78 oranges_in_stock = (oranges_in_stock - oranges_sold_monday) + new_oranges_monday oranges_in_stock = (oranges_in_stock - oranges_sold_tuesday) + new_...
Kevin had to run a marathon that was 26.2 miles long. If he ran for 4 hours and took 8 five-minute breaks during the race, what was his average pace in miles per hour?
def solve() -> int: total_distance = 26.2 total_time = 4 * 60 total_break_time = 8 * 5 actual_running_time = total_time - total_break_time average_pace = total_distance / actual_running_time average_pace = average_pace * 60 result = round(average_pace, 2) retur...
Possible questions and programs: Daniel is building a fence around his rectangular garden. The garden is 15 feet long and 10 feet wide. He needs to leave a 3-foot wide gate on one of the shorter sides of the garden. How much fencing material does he need to buy?
def solve() -> int: perimeter = 2 * 15 + 2 * 10 gate = 3 fencing = perimeter - gate result = fencing return result
Sarah has $200 in her bank account. She spent $25 on movie tickets. She then spent half of the remainder of the money on a dress. Afterwards, she transferred one-tenth of her remaining money to her savings account. How much cash was Sarah left with?
def solve() -> int: bank_account = 200 movie_tickets = 25 remainder = bank_account - movie_tickets dress = remainder / 2 remaining_money = remainder - dress savings_account = remaining_money / 10 cash_left = remaining_money - savings_account result = cash_left return result
ienna Elementary School is having a Pizza Party outside. If each pizzas has 8 slices, and there will be 42 students attending the party, how many pizzas will they need to buy?
def solve() -> int: number_of_slices = 8 number_of_students = 42 result = number_of_students // number_of_slices return result
Lisa is practicing her piano skills and notices that for every hour she practices, her fingers press the keys 500 times. She wants to practice for at least 3 hours. Her fingers have already pressed the keys 1000 times, how many more times do they need to press the keys to reach her goal? Ben plans to combine his leftov...
def solve() -> int: hours_practiced = 3 keys_per_hour = 500 keys_already_pressed = 1000 total_keys_to_press = (hours_practiced * keys_per_hour) - keys_already_pressed num_1L_cans = 10 paint_left_percent = 0.25 total_paint_left = num_1L_cans * paint_left_percent num_500ml_c...
A circle has a circumference of 24π cm. What is the radius of the circle?
def solve() -> int: circumference = 24 * 3.14159 radius = circumference / (2 * 3.14159) result = radius return result
Mia buys 3 bottles of lemonade for $3 each, 2 cartons of juice for $5 each, and a dozen donuts for $12. How much money does she need to pay the cashier?
def solve() -> int: price_lemonade = 3 price_juice = 5 price_donuts = 12 num_lemonade = 3 num_juice = 2 total_cost = (price_lemonade*num_lemonade) + (price_juice*num_juice) + price_donuts result = total_cost return result
Lucy is shopping for groceries. She buys 4 $2 cans of beans, 5 $3 packages of noodles, 2 $4 boxes of cereal, and 6 $1 containers of yogurt. How many $10 bills does she need to use to pay?
def solve() -> int: cans_of_beans = 4 * 2 packages_of_noodles = 5 * 3 boxes_of_cereal = 2 * 4 containers_of_yogurt = 6 * 1 total_cost = cans_of_beans + packages_of_noodles + boxes_of_cereal + containers_of_yogurt num_ten_bills_needed = total_cost // 10 result = num_ten_bills_needed retu...
Jack needs to purchase train tickets for a group of eight people. Tickets are $34 each and he will be charged a $15 service fee. What is the total cost?
def solve() -> int: num_of_people = 8 ticket_price = 34 service_fee = 15 total_cost = num_of_people * ticket_price + service_fee result = total_cost return result
A box contains 200 black balls and 100 white balls. If a ball is randomly selected from the box, what is the probability that it will be a black ball?
def solve() -> int: num_black_balls = 200 num_white_balls = 100 total_balls = num_black_balls + num_white_balls probability = num_black_balls / total_balls result = probability return result
A bag of toys contains 3 red, 4 blue, and 5 yellow toys. What percentage of the toys is red?
def solve() -> int: total_toys = 3 + 4 + 5 red_toys = 3 red_percentage = (red_toys/total_toys) * 100 result = red_percentage return result
Max has a piggy bank. He put in 5 coins every day for a week. On the first day, he put in quarters, on the second day- nickels, on the third day- dimes, and on the rest of the days, he put in pennies. How much money did Max collect in total?
def solve() -> int: quarters = 5 nickels = 5 dimes = 5 pennies = 5*4 total = (quarters*0.25) + (nickels*0.05) + (dimes*0.1) + (pennies*0.01) result = round(total, 2) return result
A car travels 60 miles in 1 hour. How long does it take the car to travel 180 miles?
def solve() -> int: distance = 180 speed = 60 time = distance/speed result = time return result
A recipe calls for 2/3 cups of sugar and yields 12 cookies. How much sugar will be needed to make 24 cookies?
def solve() -> int: cups_of_sugar_per_dozen = 2/3 dozen = 12 cookies = 24 cups_of_sugar_required = (cups_of_sugar_per_dozen / dozen) * cookies result = f'{cups_of_sugar_required} cups' result = cups_of_sugar_required return result
A car travels a distance of 400 km in 5 hours. What is its speed in m/s?
def solve() -> int: dist = 400000 time = 5 * 3600 speed = dist / time result = f'<<<{speed}>>>' result = speed return result
Kate books a hotel room for $120 a night. She stays 5 nights and pays in advance. She gets a 10% discount on her total bill. What is the total amount Kate has to pay?
def solve() -> int: total_cost = 5*120 discount = 0.1*total_cost total_cost = total_cost - discount result = total_cost return result
Ethan had some toys and gave eight of them to Mia. Now, Ethan has 3 times more toys than Mia. If Mia had 4 toys at first, how many toys did Ethan have at first?
def solve() -> int: mia_toys = 4 ethan_toys = mia_toys * 3 + 8 result = ethan_toys return result
am wants to buy a piece of artwork for his mother's birthday that costs $150. If the store offers a 20% discount for orders over $100 and he also has a 10% coupon to use, how much will he pay?
def solve() -> int: initial_cost = 150 store_discount = 0.0 if initial_cost >= 100: store_discount = 0.2 coupon_discount = 0.1 final_cost = initial_cost * (1 - store_discount - coupon_discount) result = final_cost return result
How many cups of ingredients are needed to make 24 cookies, if each cookie uses 1/4 cup of dough?
def solve() -> int: total_dough = 2 + 3/4 + 3/4 + 1 + 2/4 + 1/4 + 1/4 + 1/2 + 2 dough_per_cookie = 1/4 cookies_per_batch = total_dough / dough_per_cookie cookies_desired = 24 batches_needed = cookies_desired / cookies_per_batch ingredients_needed = total_dough * batches_needed result =...
In 14 years, Jacob will be 5 times the age that Zoe is currently. If Zoe is currently 6 years old, how old is Jacob now?
def solve() -> int: zoe_age = 6 jacob_age_in_14_years = 5 * zoe_age jacob_age_now = jacob_age_in_14_years - 14 result = jacob_age_now return result
Noah is tracking his carb intake per day. He eats 1 slice of bread in the morning, 2 servings of pasta in the afternoon, and 1 serving of rice in the evening. If a slice of bread has 10 grams of carbs, a serving of pasta has 30 grams of carbs, and a serving of rice has 20 grams of carbs, how many grams of carbs does No...
def solve() -> int: bread_per_day = 1 pasta_per_day = 2 rice_per_day = 1 carbs_per_bread = 10 carbs_per_pasta = 30 carbs_per_rice = 20 carbs_per_day = (bread_per_day * carbs_per_bread) + (pasta_per_day * carbs_per_pasta) + (rice_per_day * carbs_per_rice) carbs_per_week = carbs_per_d...
Julie's bike tire circumference is 80cm. How far does the bike wheel travel in one full turn?
def solve() -> int: tire_circumference = 80 result = tire_circumference * 3.14 return result
Lily is experiencing joint pains and takes Aleve to relieve them. She takes 660mg every 8 hours for 2 weeks. If the Aleve pills come in 220 mg each, how many pills does she take every time she takes medication?
def solve() -> int: aleve_dose = 660 duration = 2 * 7 * 24 total_aleve = (duration // 8) * aleve_dose pill_dose = aleve_dose // 220 total_pills = total_aleve // 220 result = total_pills return result
Below are some possible questions and programs. James bought a dozen of eggs for $3. He used 4 eggs to make a cake and sold the cake for $15. He then bought more eggs at the same price per egg as before. If he spent all his money on eggs, how many eggs did he have in total?
def solve() -> int: cost_per_egg = 3 / 12 profit = 15 - 4 * cost_per_egg number_of_eggs = profit / cost_per_egg total_eggs = number_of_eggs + 12 - 4 result = total_eggs return result
In a class of 273 students, if 40% of the students take dance and the rest take art, how many students take art?
def solve() -> int: n_total = 273 p_dance = 40 n_dance = (n_total * p_dance) / 100 n_art = n_total - n_dance result = n_art return result
A car travels 250 miles using 10 gallons of gas. How far can the car travel using 20 gallons of gas?
def solve() -> int: distance1 = 250 gas1 = 10 gas2 = 20 distance2 = (distance1/gas1) * gas2 result = distance2 return result
A rectangle has a length of 12 m and a perimeter of 42 m. What is the width of the rectangle?
def solve() -> int: length = 12 perimeter = 42 width = (perimeter - 2 * length) / 2 result = width return result
Joshua bought 5 pizzas for $15 each. He is going to tip his delivery person $20. How much money did Joshua spend in total?
def solve() -> int: pizza_price = 15 pizzas_num = 5 tip = 20 pizzas_cost = pizza_price * pizzas_num total_cost = pizzas_cost + tip result = total_cost return result
At the coffee shop, there are 5 times as many lattes as cappuccinos, and 3 times as many frappes as lattes. All the drinks cost $4 each. If the total cost of the drinks is $480, how many frappes does the store have?
def solve() -> int: cappuccinos = 0 lattes = 0 frappes = 0 cappuccinos = 480 // 4 lattes = 5 * cappuccinos frappes = 3 * lattes result = frappes return result
am wants to get the top score in the computer science test. He discovers that one student scored 88% on the test. Another student answered 4 questions incorrectly out of 25 questions. How many questions does Sam have to get right to achieve the highest score?
def solve() -> int: total_questions = 25 student1_score = 0.88 student1_correct = int(student1_score * total_questions) student2_wrong = 4 student2_correct = total_questions - student2_wrong highest_correct = max(student1_correct, student2_correct) + 1 result = highest_correct ...
Oliver swam for 40 minutes every day for four weeks. Emma swam for 22 minutes on each of seven days. How many hours did Oliver and Emma swim in total? In a shopping mall, there are 200 stores. 75% of them sell clothes, while 50% of the stores sell shoes. How many stores sell both clothes and shoes?
def solve() -> int: oliver_time = 40 * 7 * 4 emma_time = 22 * 7 total_time = oliver_time + emma_time total_hours = total_time / 60 clothes_stores = 200 * 0.75 shoes_stores = 200 * 0.5 both_stores = clothes_stores * 0.5 result = total_hours, both_stores ...
Alice and Bob are collecting cans for recycling. Each can is worth 5 cents. Alice collects 12 cans per day and Bob collects 8 cans per day. They want to buy a $15 gift card for their friend. How many days will it take them to collect enough money?
def solve() -> int: total_money = 0 days = 0 while total_money < 15: total_money = total_money + (12 + 8) * 0.05 days = days + 1 result = days return result
A basket of apples is on sale for $6.99. If the regular price is $9.99, what percentage discount is being offered?
def solve() -> int: regular_price = 9.99 sale_price = 6.99 percentage_discount = ((regular_price - sale_price) / regular_price) * 100 result = percentage_discount return result
A triangle has a base of 6 cm and an area of 12 cm². What is its height?
def solve() -> int: height = (2*12)/6 result = height return result
A car travels at a speed of 50 miles per hour for 3 hours. How far did it travel?
def solve() -> int: distance = 50 * 3 result = distance return result
-Note: You should not use the same names, numbers, and units as the original question. Try to vary them as much as possible. Some possible math questions are: If Anna reads 20 pages of a book every day, how many books can she finish in a year, if each book has 240 pages?
def solve() -> int: pages_per_year = 20 * 365 books_per_year = pages_per_year / 240 result = books_per_year return result
In 1978, James was born and he is currently half as old as his father. If his father's current age is 62, in what year was his father born?
def solve() -> int: james_age = 2021 - 1978 father_age = 62 james_age = father_age / 2 father_birth_year = 2021 - father_age father_age_james_born = father_age - james_age father_birth_year = 2021 - father_age_james_born result = father_birth_year retur...
A class of 36 students went on a field trip to a museum. The museum charged $5 for each student and $10 for each adult. The class was accompanied by 4 teachers and 2 parents. The school paid $200 for the bus rental. How much did the school spend in total for the field trip?
def solve() -> int: students = 36 teachers = 4 parents = 2 student_ticket = 5 teacher_ticket = 10 parent_ticket = 10 museum_cost = (students * student_ticket) + (teachers * teacher_ticket) + (parents * parent_ticket) bus_fee = 200 total_cost = museum_cost + bus_fee result = total...
At a birthday party, there are 20 kids who split a cake evenly. After each kid takes 1/6 of the cake, there is still a quarter of the original amount left. How big was the original cake?
def solve() -> int: kids = 20 cake_per_kid = 1/6 remaining_cake = 1/4 total_cake = (1 - remaining_cake) / (kids * cake_per_kid) result = total_cake return result
A family had 4 extra pieces of pizza after their dinner that night. If pizza is usually cut into 8 equal slices, how many people were eating pizza that night?
def solve() -> int: total_slices = 8 + 4 num_people = total_slices/8 result = num_people return result
A car rental company offers two plans: Plan A costs $50 per day with an additional charge of $0.50 per mile driven. Plan B costs $90 per day with unlimited mileage. What is the minimum number of miles that must be driven per day to make plan A cheaper than plan B?
def solve() -> int: plan_a_daily_cost = 50 plan_b_daily_cost = 90 miles_driven = 0 while plan_a_daily_cost + 0.5 * miles_driven >= plan_b_daily_cost: miles_driven += 1 result = miles_driven return result