question
stringlengths
11
2.89k
code
stringlengths
20
7.24k
John has $120 and wants to give 1/3 of it to his friend and then 1/2 of what he has left to his sister. How much money will his sister receive?
def solve() -> int: money_total = 120 friend_share = money_total / 3 money_left = money_total - friend_share sister_share = money_left / 2 result = sister_share return result
Jack went to the grocery store and bought 3 bags of rice, 2 bottles of juice and 1 pack of chicken. Each bag of rice cost $7, each bottle of juice cost $2.50 and the pack of chicken cost $12. How much did Jack spend in total?
def solve() -> int: num_rice_bags = 3 rice_bag_price = 7 num_juice_bottles = 2 juice_bottle_price = 2.5 chicken_pack_price = 12 total_price = (num_rice_bags * rice_bag_price) + (num_juice_bottles * juice_bottle_price) + chicken_pack_price result = total_price return result
Sarah is baking a rectangular cake that is 12 inches long, 8 inches wide, and 2 inches tall. She needs to cover the cake with frosting. Each container of frosting can cover 100 square inches. How many containers of frosting will she need?
def solve() -> int: length = 12 width = 8 height = 2 surface_area = 2 * (length * width + length * height + width * height) containers_needed = surface_area / 100 result = containers_needed return result
Three years ago, Lila was three times as old as Nia. If Nia will be 18 in four years, how old is Lila now?
def solve() -> int: nia = 18 + 4 lila_3 = (nia - 3) / 3 lila = lila_3 + 3 result = lila return result
Jack came back from his trip to Vietnam with 1.5 million Dong. Normally, 23,000 Dong is equal to 1 dollar, but the money exchange in the airport will only give Jack 3/5ths of the official exchange rate. How many dollars does Jack get?
def solve() -> int: dong = 1500000 exchange_rate = 23000 official_rate = exchange_rate * (3/5) dollars = dong / official_rate result = dollars return result
Some possible new questions and their corresponding programs are: Tina bought some toys from a store. She paid with one $100 bill, two $20 bills, and six $1 coins. She got back $8 in change. If each toy costs the same amount, and she bought less than 10 toys, how many toys did she buy?
def solve() -> int: total_paid = 100 + 2 * 20 + 6 amount_before_change = total_paid - 8 for n in range(1, 10): price_per_toy = amount_before_change / n if price_per_toy.is_integer(): result = n return result
There are 60 children in a summer camp. The number of boys is 15 more than twice as many girls. How many boys and girls are in the summer camp?
def solve() -> int: total_children = 60 girls = (total_children - 15) / 3 boys = 2*girls + 15 result = girls result = boys return result
Student: If Mark drives 60 miles at 45 miles per hour and then 40 miles at 60 miles per hour, what is his average speed for the entire trip?
def solve() -> int: d1 = 60 d2 = 40 s1 = 45 s2 = 60 t1 = d1 / s1 t2 = d2 / s2 d_total = d1 + d2 t_total = t1 + t2 s_average = d_total / t_total result = s_average return result
A bicycle wheel has a radius of 16 inches. How far does the bike travel if the wheel makes four complete revolutions?
def solve() -> int: radius = 16 circumference = 2*3.14*radius distance = circumference * 4 result = distance return result
Tom's Bluetooth speaker was at 5% battery life before being charged for 25 minutes, reaching a 70% charge. How much longer does the speaker need to charge to reach full battery life?
def solve() -> int: battery_life = 100 initial_charge = 5 current_charge = 70 charge_time = 25 charge_increase = current_charge - initial_charge charge_rate = charge_increase / charge_time remaining_charge = battery_life - current_charge time_needed = remaining_charge...
A 6-month movie streaming subscription is normally $60. The streaming service is currently offering a promotion for 20% off when subscribing to the 6-month plan. How many dollars cheaper is the promotional subscription than the normal one?
def solve() -> int: normal_price = 60 discount = 0.2 discounted_price = normal_price * (1 - discount) difference = normal_price - discounted_price result = difference return result
Student: John has a rope that is 25 ft long. He wants to divide it into 5 equal parts. How long is each part?
def solve() -> int: rope_length = 25 part_length = rope_length / 5 result = part_length return result
Melanie caught 15 fish during her fishing trip, but could only keep 3 of them. The following day, she caught 5 more fish. If she caught a total of 30 fish, how many did she release?
def solve() -> int: caught_fish = 15 kept_fish = 3 caught_fish_next_day = 5 total_fish = 30 released_fish = total_fish - (caught_fish - kept_fish) - caught_fish_next_day result = released_fish return result
John has 35 jelly beans and wants to put them equally into 7 jars. How many jelly beans can each jar hold?
def solve() -> int: num_of_jelly_beans = 35 num_of_jars = 7 jelly_beans_per_jar = num_of_jelly_beans / num_of_jars result = jelly_beans_per_jar return result
Lily is painting a mural with red, blue, and green paint. She needs twice as much red paint as blue paint, and half as much green paint as blue paint. If she uses 8 liters of blue paint, how many liters of paint does she use altogether?
def solve() -> int: red = 0 blue = 0 green = 0 blue = 8 red = 2 * blue green = blue / 2 total = red + blue + green result = total return result
A coffee shop sells coffee at $3 a cup. The shop charges an additional $1 for every mug size increase. If Alex wants to keep a profit of $5, how much would a drink in his largest mug cost?
def solve() -> int: coffee_price = 3 mug_increase = 1 profit = 5 largest_mug_cost = coffee_price + (mug_increase * 4) total_cost = largest_mug_cost + profit result = total_cost return result
A carpenter needs 6 pieces of wood each measuring 20 feet. How many feet of wood does the carpenter need in total?
def solve() -> int: num_pieces = 6 piece_length = 20 total_length = num_pieces * piece_length result = total_length return result
A company makes soap bars. The company makes 1500 soap bars, with each bar costing $5 to make. The company sells each bar for $10. What is the company's profit?
def solve() -> int: num_soap_bars = 1500 cost_per_bar = 5 selling_price_per_bar = 10 total_cost = num_soap_bars * cost_per_bar total_revenue = num_soap_bars * selling_price_per_bar profit = total_revenue - total_cost result = profit return result
An elevator can carry 10 people every minute. If it operates from 7:00 am until midnight, how many people can it transport during that time?
def solve() -> int: minutes = 17 * 60 capacity = 10 total_people = minutes * capacity result = total_people return result
A store is selling a sweater for $40. If the store markup is 30%, what was the original price of the sweater?
def solve() -> int: sale_price = 40 markup_percent = 30 original_price = sale_price / (1 + (markup_percent/100)) result = original_price return result
A construction team needs 358 bricks to build a wall. If each brick weighs 1.2 kg, how much does the wall weigh in kilograms?
def solve() -> int: number_of_bricks = 358 weight_of_each_brick = 1.2 total_weight_of_wall = number_of_bricks * weight_of_each_brick result = total_weight_of_wall return result
A train travels 200 km in 3 hours at a constant speed. How long will it take a train traveling at the same speed to travel 180 kilometers?
def solve() -> int: d1 = 200 t1 = 3 d2 = 180 v1 = d1/t1 t2 = d2/v1 result = t2 return result
A car travels at a speed of 60 km per hour. How long will it take to travel a distance of 200 km?
def solve() -> int: distance = 200 speed = 60 time = distance/speed result = time return result
A band performs at a local festival for 4 days. On the first day, they play 10 songs. On the second day, they play twice the number of songs from the first day. On the third day, they play 5 more than the second. On the fourth day, they play three times the total number of songs from the first three days. How many song...
def solve() -> int: day1 = 10 day2 = 2 * day1 day3 = day2 + 5 day4 = 3 * (day1 + day2 + day3) total_songs = day1 + day2 + day3 + day4 result = total_songs return result
Student: If Larry has 4 apples, all of the same weight how much would 6 apples of the same weight weigh?
def solve() -> int: num_apples_larry = 4 num_apples_total = 6 weight_6_apples = num_apples_total * num_apples_larry result = weight_6_apples return result
A giant ship is discovered. It weighs 10 times the previous largest ship, which weighed 5000 tons. Each of its engines has a cross-sectional area of 20 square meters. How much pressure in tons per square meter does each engine undergo?
def solve() -> int: previous_largest_ship_weight = 5000 giant_ship_weight = 10 * previous_largest_ship_weight cross_sectional_area = 20 pressure = giant_ship_weight / (cross_sectional_area * 1000) result = pressure return result
The area of a square is 81 square meters. What is the length of each side of the square?
def solve() -> int: area = 81 side_length = (area)**(0.5) result = side_length return result
amantha is baking an apple pie. She buys 5 apples which cost $2 each. She needs 5 tablespoons of sugar, which costs $1 each. A pie crust costs $3. How much does everything cost?
def solve() -> int: cost_apples = 5 * 2 cost_sugar = 5 * 1 cost_pie_crust = 3 result = cost_apples + cost_sugar + cost_pie_crust return result
A factory can produce 400 widgets per hour. How many widgets can the factory produce in a 10-hour shift?
def solve() -> int: widgets_per_hour = 400 num_hours = 10 widgets_produced = widgets_per_hour * num_hours result = widgets_produced return result
If the perimeter of a rectangle is 50cm and its width is 10cm, what is the length?
def solve() -> int: perimeter = 50 width = 10 length = (perimeter/2) - width result = length return result
Student: Amanda wants to buy a new computer that costs $1200. She saves $50 each week. How many weeks will it take her to save enough money?
def solve() -> int: cost = 1200 savings = 50 num_weeks = cost // savings result = num_weeks return result
A bag contains 5 red marbles, 3 blue marbles, and 2 green marbles. If one marble is picked randomly, what is the probability that it is blue?
def solve() -> int: total_marbles = 10 num_blue_marbles = 3 probability_of_blue = num_blue_marbles / total_marbles result = probability_of_blue return result
A store has 150 pencils. If each pack has 12 pencils, how many packs are there?
def solve() -> int: num_pencils = 150 pencils_per_pack = 12 num_packs = num_pencils // pencils_per_pack result = num_packs return result
A rectangular field has a perimeter of 48 meters. If the length of the field is 3 times its width, what are the length and width of the field?
def solve() -> int: width = 6 length = 3 * width result = (length, width) return result
Julia is training for a marathon. She ran 5 miles on Monday and 7 miles on Wednesday. If the marathon is 26.2 miles, how many more miles does she need to run to complete her training?
def solve() -> int: miles_run = 5 + 7 marathon_distance = 26.2 miles_left = marathon_distance - miles_run result = miles_left return result
A bag of candy has 120 pieces. If 1/4 of the candy is cherry flavored, how many pieces of candy are cherry flavored?
def solve() -> int: total_candy = 120 cherry_percent = 0.25 cherry_candy = total_candy * cherry_percent result = cherry_candy return result
Jennifer bought 309 markers and shared them equally among 11 of her friends. How many markers were left?
def solve() -> int: Markers_total = 309 Number_friends = 11 Markers_each = Markers_total // Number_friends Markers_left = Markers_total - (Markers_each * Number_friends) result = Markers_left return result
A recipe for 6 servings of muffins requires 2 cups of flour. How many cups of flour will you need to make 24 servings?
def solve() -> int: servings_needed = 24 cups_per_serving = 2 / 6 cups_needed = servings_needed * cups_per_serving result = cups_needed return result
For every additional 50 meters that a ship travels, the amount of fuel consumed doubles. If a ship travels 200 meters on 30 liters of fuel, how much fuel is needed for 400 meters?
def solve() -> int: distance_1 = 200 fuel_1 = 30 distance_2 = 400 ratio = distance_2 / distance_1 fuel_2 = fuel_1 * (2 ** (ratio / 50)) result = fuel_2 return result
Jamie wants to buy a bicycle that costs 300 dollars. She saves 20 dollars a week for 15 weeks. How much more money does she need?
def solve() -> int: total_savings = 20*15 money_left = 300-total_savings result = money_left return result
A company has to complete a project in 30 days. If they have already completed 15% of the work in 5 days, how much work is left to be done?
def solve() -> int: total_days_to_complete_project = 30 days_already_worked = 5 percent_work_completed = 15 percent_work_left = 100 - percent_work_completed work_left_to_do = percent_work_left / 100 * total_days_to_complete_project / days_already_worked result = work_left_to_do return result...
Matthew has to drive 60 miles south to reach his workplace, and then 40 miles north to meet his friend. If he covers both distances on the same day, how many gallons of fuel would he need if his car runs 18 miles to a gallon?
def solve() -> int: south_distance = 60 north_distance = 40 total_distance = south_distance + north_distance miles_per_gallon = 18 gallons_needed = total_distance / miles_per_gallon result = gallons_needed return result
Christina has 20% fewer crayons than Paul. If Paul has 100 crayons, how many crayons does Christina have?
def solve() -> int: paul_crayons = 100 christina_crayons = paul_crayons - (paul_crayons * 0.2) result = christina_crayons return result
Tammy buys a package of 24 hot dogs for a barbecue. If she eats 3 hot dogs herself, what is the cost per hot dog of the remaining hot dogs after she paid $10 for all 24 hot dogs?
def solve() -> int: num_hotdogs = 24 price = 1000 hotdogs_eaten = 3 cost_of_remaining = price/num_hotdogs * (num_hotdogs - hotdogs_eaten) cost_per_hotdog = cost_of_remaining/(num_hotdogs - hotdogs_eaten) result = cost_per_hotdog return result
In a store, a shirt is priced at $20. If the customer earns a 25% discount, how much will the shirt costs?
def solve() -> int: price = 20 discount_percentage = 25 discount = price * discount_percentage / 100 final_price = price - discount result = final_price return result
Student: John paid $30 for 4 T-shirts and 2 pairs of pants. If each pair of pants costs $12, how much does each shirt cost?
def solve() -> int: shirts = 4 pants = 2 price_pants = 12 price_total = 30 price_shirts = price_total - (pants * price_pants) price_each_shirt = price_shirts / shirts result = price_each_shirt return result
Jacob has a rectangular garden that is 15 meters long and 10 meters wide. He wants to fence the garden with wires that cost $3 per meter. How much money does he need to spend on the wires?
def solve() -> int: length = 15 width = 10 cost = 3 perimeter = 2 * (length + width) total_cost = cost * perimeter result = total_cost return result
Jasmine started with $70 and then spent $12 on games. She received $4 from her brother and then earned another $20 from babysitting. How much money does Jasmine have now?
def solve() -> int: money = 70 spent_money = 12 received_money = 4 earned_money = 20 money_left = money - spent_money + received_money + earned_money result = money_left return result
Student: Grace bought a laptop at a 10% discount. If she paid $900, how much was the original price?
def solve() -> int: discount = 0.1 paid = 900 original_price = paid / (1 - discount) result = original_price return result
There are 20 candy bars in a box. If a store wants to order 150 candy bars, how many boxes should they order?
def solve() -> int: num_candy_bars = 150 num_bars_per_box = 20 num_boxes = num_candy_bars // num_bars_per_box result = num_boxes return result
A bag contains 18 marbles. 1/3 of the marbles are red and the rest are blue. How many blue marbles are there?
def solve() -> int: total_marbles = 18 red_marbles = total_marbles/3 blue_marbles = total_marbles - red_marbles result = blue_marbles return result
A bag contains 100 marbles, of which 40% are red and the rest are green. How many green marbles are there?
def solve() -> int: marbles = 100 red_percent = 0.4 red_marbles = marbles * red_percent green_marbles = marbles - red_marbles result = green_marbles return result
Student: James has 20 chocolates. He wants to give a third of them to his friends and then split the other two thirds equally with his family. If James has 4 family members, how many chocolates will each of them get?
def solve() -> int: chocolates = 20 friends = chocolates // 3 family = (chocolates - friends) // 4 result = family return result
Alex takes one hour to run around a park and half an hour to bike around the park. Alex runs around the park 5 times in a week and bikes around the park 3 times a week. How long does Alex take to get to and from the park by running and biking in a week?
def solve() -> int: run_time = 1 bike_time = 0.5 run_frequency = 5 bike_frequency = 3 total_run_time = run_time * run_frequency total_bike_time = bike_time * bike_frequency total_time = total_run_time + total_bike_time result = total_time return result
ve travels 12 miles one-way to attend his friend's birthday party, then he travels 10 miles back home. How many total miles did Steve travel?
def solve() -> int: x = 12 y = 10 result = x + y return result
A shirt is sold for $25, which is 25% more than its cost price. What is the cost price of the shirt?
def solve() -> int: selling_price = 25 markup_percent = 25 cost_price = selling_price / (1 + markup_percent/100) result = cost_price return result
John purchased 9 items that cost $6 each. He also bought 4 items that cost $8 each. How much money in dollars did John spend?
def solve() -> int: item_1_cost = 6 item_2_cost = 8 items_1 = 9 items_2 = 4 total_spent = (item_1_cost * items_1) + (item_2_cost * items_2) result = total_spent return result
A factory produces 8000 chocolate bars per shift. If there are 3 shifts in a day, how many chocolate bars would the factory produce in a day?
def solve() -> int: bars_per_shift = 8000 num_shifts = 3 total_bars = bars_per_shift * num_shifts result = total_bars return result
The clothing store sells t-shirts by the dozen. They charge $72 for 6 dozen. Eric buys 8 dozen, Adam buys 3 dozen, and Kevin buys 72 t-shirts. How many t-shirts do they purchase in total, assuming 12 t-shirts are 1 dozen?
def solve() -> int: t_shirts_per_dozen = 12 price_per_six_dozen = 72 t_shirts_per_six_dozen = t_shirts_per_dozen * 6 price_per_t_shirt = price_per_six_dozen / t_shirts_per_six_dozen eric_t_shirts = 8 * t_shirts_per_six_dozen adam_t_shirts = 3 * t_shirts_per_six_dozen kevin_t_shirts = 72...
A circular swimming pool is surrounded by a walkway of uniform width. If the inner diameter of the pool is 20 m and the width of the walkway is 2 m, find the area of the walkway.
def solve() -> int: inner_diameter = 20 walkway_width = 2 outer_diameter = inner_diameter + 2*walkway_width inner_radius = inner_diameter / 2 outer_radius = outer_diameter / 2 area_walkway = (outer_radius**2 - inner_radius**2) * 3.14 result = area_walkway return result
Student: A pizza parlor has 12 slices per large pizza. How many slices total are needed for 5 pizzas?
def solve() -> int: slices_per_pizza = 12 num_pizzas = 5 total_slices = slices_per_pizza * num_pizzas result = total_slices return result
Cathy has 15 times as many stamps as Danny. Danny has one-fourteenth as many stamps as Eric does. If Eric has 140 stamps, how many does Cathy have?
def solve() -> int: eric = 140 danny = eric / 14 cathy = danny * 15 result = cathy return result
David is making smoothies. One of the ingredients in the recipe is bananas. For one smoothie, the recipe calls for 1 banana. In a bunch of bananas, there are 6 bananas. How many bunches of bananas should David buy to make 20 smoothies?
def solve() -> int: smoothies_per_bunch = 6 // 1 smoothies_needed = 20 bunches_needed = smoothies_needed // smoothies_per_bunch result = bunches_needed return result
A car needs 6 liters of gas to travel 100 kilometers. If a gas station is 17 kilometers away, how many liters of gas does the car need to get there and back?
def solve() -> int: distance = 17*2 gas_per_distance = 6/100 total_gas = distance * gas_per_distance result = total_gas return result
Alpha School has 700 more than four times as many students as Beta School. Beta School has 100 less than three times as many students as Gamma School. If Gamma School has 200 students, how many students are in Alpha School?
def solve() -> int: gamma_school = 200 beta_school = 3 * gamma_school - 100 alpha_school = 4 * beta_school + 700 result = alpha_school return result
A shipping company charges $5 per package for the first 10 packages and $4 per package for any additional packages. If John ships 15 packages, how much will he pay?
def solve() -> int: total_cost = (10 * 5) + ((15 - 10) * 4) result = total_cost return result
When Thor, the eight-legged god walks across the desert, it leaves 10 footprints every 8 meters. But Loki, the four-legged mischief makerGrace is making a quilt and each row needs 24 squares. If there are 60 rows in total, how many squares does Grace need to make the whole quilt?
def solve() -> int: num_footprints_per_distance = 10 distance_per_footprint = 8 num_legs = 4 num_squares_per_row = 24 num_rows = 60 total_distance = num_footprints_per_distance * distance_per_footprint num_footprints_per_row = total_distance / num_legs num_squares_per_footprint...
Sarah bought 5 t-shirts and 3 pairs of jeans for a total of $120. If a t-shirt costs $18 and a pair of jeans costs $30, how much does one t-shirt cost?
def solve() -> int: t_shirts = 5 jeans = 3 total_cost = 120 t_shirt_cost = total_cost - (jeans * 30) t_shirt_cost = t_shirt_cost / t_shirts result = t_shirt_cost return result
A person invests $10,000 in a savings account that pays 6% interest per annum. How long will it take the interest earned to equal the initial investment?
def solve() -> int: principal = 10000 rate = 0.06 time = 0 interest = 0 while interest < principal: interest += principal * rate time += 1 result = time return result
A recipe calls for 1/3 cup of flour for every 2 eggs. If you need to make the recipe using 12 eggs, how much flour is needed?
def solve() -> int: eggs_needed = 12 flour_per_eggs = 1/3 flour_needed = eggs_needed * flour_per_eggs * 6 result = flour_needed return result
Student: Isla has a ring and a pair of earrings. She bought the ring for one-ninth the price of the earrings. The earrings cost her $27. How much did Isla pay for both the ring and the earrings?
def solve() -> int: earrings_cost = 27 ring_cost = earrings_cost / 9 total_cost = earrings_cost + ring_cost result = total_cost return result
Jake saved $3.50 each week for 20 weeks. How much money did he save?
def solve() -> int: saved_per_week = 3.50 total_weeks = 20 total_saved = saved_per_week * total_weeks result = total_saved return result
A recipe for sugar cookies calls for 2 cups of sugar, 1.5 cups of flour, and 0.5 cups of butter. If the recipe makes 24 cookies, how much of each ingredient will you need to make 48 cookies?
def solve() -> int: sugar_per_cookie = 2/24 flour_per_cookie = 1.5/24 butter_per_cookie = 0.5/24 num_cookies = 48 sugar_needed = sugar_per_cookie * num_cookies flour_needed = flour_per_cookie * num_cookies butter_needed = butter_per_cookie * num_cookies result = (sugar_needed, flour_need...
A car goes 80 miles per hour. How many miles will it travel in 6 hours?
def solve() -> int: speed = 80 time = 6 distance_traveled = speed * time result = distance_traveled return result
John and Emily are sharing a house with 3 other couples. If there are 12 pillows on the bed, how many people are sharing the house?
def solve() -> int: pillows_on_bed = 12 total_people = (3 + 1) * 2 * 2 result = total_people return result
Emma and Olivia agreed to split a sum of money so that Emma takes 20% and Olivia takes the rest. If Olivia's share is $2,500, what is the total amount they shared?
def solve() -> int: olivia_share = 2500 emma_share = olivia_share / 0.8 total_amount = olivia_share + emma_share result = total_amount return result
``` Alex has $1000 in his savings account. He deposits $50 every month. How much money will he have after 2 years?
def solve() -> int: savings = 1000 months_saved = 24 money_saved_per_month = 50 money_saved = money_saved_per_month * months_saved savings += money_saved result = savings return result
A family has a budget of $2500 for their vacation. If they spend $500 on airfare, $1000 on hotel, and $300 on transportation, what amount of money do they have left to spend on activities and food?
def solve() -> int: total_budget = 2500 airfare_cost = 500 hotel_cost = 1000 transportation_cost = 300 total_expenses = airfare_cost + hotel_cost + transportation_cost remaining_budget = total_budget - total_expenses result = remaining_budget return result
Find the square root of the sum of the first 15 even numbers.
def solve() -> int: sum = 0 for i in range(1,31,2): sum += i result = sum**0.5 return result
Student: Milo collects stamps. He has 120 stamps from different countries. He sells 15% of his stamps to a friend for $30. He buys 20 new stamps from a shop for $25. He also trades 10 of his stamps with another collector for 12 stamps from Brazil. How many stamps does he have now and how much money did he spend or earn...
def solve() -> int: stamps = 120 sold = 0.15 * stamps price_sold = 30 bought = 20 price_bought = 25 traded_out = 10 traded_in = 12 stamps_after_selling = stamps - sold stamps_after_buying = stamps_after_selling + bought stamps_after_trading = stamps_after_buying - traded_o...
If it takes 3.5 days for newly hatched tarantulas to become adults, and there are 1250 newly hatched tarantulas, how much time will it take for them to become adults?
def solve() -> int: new_hatches = 1250 days_to_mature = 3.5 mature_time = new_hatches * days_to_mature result = mature_time return result
Rachel's bag of sugar weighs 1,000 grams. If she uses 100 grams of sugar every week and the bag lasts her for 13 weeks, how much sugar is remaining if she used a total of 700 grams by the end? A bag can hold 120 marbles. Mia has already placed 65 marbles in the bag, but she needs to fill 3 more bags. How many marbles d...
def solve() -> int: bag_weight = 1000 weekly_use = 100 total_weeks = 13 used_sugar = 700 remaining_sugar = bag_weight - (weekly_use * total_weeks) + used_sugar result = remaining_sugar bag_capacity = 120 marbles_placed = 65 num_bags = 3 marbles_needed = (bag_capaci...
Some possible questions and programs are: Maria bought three shirts for $25 each and two pairs of jeans for $40 each at a clothing store. If the store offered a 10% discount on the total purchase and charged 5% sales tax, how much did Maria pay?
def solve() -> int: subtotal = 3 * 25 + 2 * 40 discount = subtotal * 0.1 final = (subtotal - discount) * 1.05 final = round(final, 2) result = final return result
A restaurant has a daily footfall of 150 customers and an average bill amount of $25. How much does it earn in a week?
def solve() -> int: footfall = 150 avg_bill = 25 daily_earnings = footfall * avg_bill weekly_earnings = daily_earnings * 7 result = weekly_earnings return result
A recipe for lemonade calls for 6 lemons, 1 cup of sugar, and 4 liters of water. How much sugar is needed to make 10 liters of lemonade with the same ratio of ingredients?
def solve() -> int: ratio = 1 / 4 sugar = ratio * 10 result = sugar return result
In a certain school, 20% of all students are from overseas and there are 480 students in the school. How many students from overseas are there in this school?
def solve() -> int: total_students = 480 perc_students_from_overseas = 20 num_students_from_overseas = (total_students * perc_students_from_overseas)/100 result = num_students_from_overseas return result
Janine has two cats, each of which eats 1/3 cup of food per day. How many 10-lb bags of cat food should she buy if each bag lasts 30 days?
def solve() -> int: num_cats = 2 cups_of_food_per_day = 1/3 lbs_of_food_per_cup = 0.5 days_per_bag = 30 lbs_per_bag = 10 total_cups_of_food_needed = num_cats * cups_of_food_per_day * days_per_bag total_lbs_of_food_needed = total_cups_of_food_needed * lbs_of_food_per_cup num_bags_needed =...
A recipe calls for 2 cups of flour, 1 cup of sugar, and 3 eggs. If you want to make half the recipe, how much of each ingredient do you need?
def solve() -> int: flour = 2 sugar = 1 eggs = 3 recipe_scale = 0.5 half_flour = flour * recipe_scale half_sugar = sugar * recipe_scale half_eggs = eggs * recipe_scale result = (half_flour, half_sugar, half_eggs) return result
A car rental company charges a flat fee of 50 dollars per day plus 20 cents per mile for renting a car. A customer rented a car for 5 days and drove 300 miles. He also paid an extra 15 dollars for insurance. How much did he pay in total for the car rental?
def solve() -> int: flat_fee = 50 mileage_rate = 0.2 days = 5 miles = 300 insurance_fee = 15 total_cost = flat_fee * days + mileage_rate * miles + insurance_fee result = total_cost return result
John's height is 5ft 9in. What is his height in centimeters (1 ft = 30.48 cm, 1 in = 2.54 cm)?
def solve() -> int: john_height_ft = 5 john_height_inc = 9 john_height_cm = john_height_ft * 30.48 + john_height_inc * 2.54 result = john_height_cm return result
Jack makes smoothies with fruit and vegetables. He uses 3 cups of fruit for every 2 cups of vegetables. If he uses 12 cups of vegetables, how many cups of fruit and vegetables does he use in total?
def solve() -> int: vegetables = 12 fruit = (3/2) * vegetables total = fruit + vegetables result = total return result
A car travels a total of 240 miles in 6 hours at a constant speed. What is the average speed of the car in miles per hour?
def solve() -> int: distance = 240 time = 6 speed = distance / time result = speed return result
There were 420 robots in total. Some of the robots were yellow. The yellow robots were three times as many as the green robots. How many of the robots were yellow?
def solve() -> int: number_of_yellow = 0 number_of_green = 0 total_robots = 420 number_of_green = total_robots / (3 + 1) number_of_yellow = number_of_green * 3 result = number_of_yellow return result
A store buys an item for $50 and sells it for $75. What is the percentage profit?
def solve() -> int: cost_price = 50 selling_price = 75 profit = selling_price - cost_price profit_percent = profit/cost_price * 100 result = profit_percent return result
Student: There are 6 train cars. The first 2 train cars are twice as long as the second 2 train cars. The last 2 train cars are combined. What is the total length of all 6 train cars?
def solve() -> int: first_2_cars = 2 second_2_cars = 1 last_2_cars = 1 total_length = first_2_cars * 2 + second_2_cars * 2 + last_2_cars * 2 result = total_length return result
To make a fruit salad, Jane needs 3 apples, 2 oranges, and 4 pears. How many pieces of fruit does Jane need in total?
def solve() -> int: apples_needed = 3 oranges_needed = 2 pears_needed = 4 total_fruit_needed = apples_needed + oranges_needed + pears_needed result = total_fruit_needed return result
Student: Billy buys 6 pens every 7 days. In total, Jimmy buys 9 pens. How many days has it been since Billy started buying pens?
def solve() -> int: pens_per_day = 6 / 7 total_pens = 9 days = total_pens / pens_per_day days = round(days) result = days return result
An artist sells paintings at a local market. Each painting costs her $50 to make and she sells them for $120 each. She can make up to 4 paintings per week, but she only sells them on Saturdays. On average, she sells 75% of the paintings she brings to the market. How much profit does she make per month (after deducting ...
def solve() -> int: cost_per_painting = 50 sell_price = 120 paintings_per_week = 4 sell_ratio = 0.75 weeks_per_month = 4 paintings_sold_per_week = paintings_per_week * sell_ratio revenue_per_week = paintings_sold_per_week * sell_price cost_per_week = paintings_per_week * c...
A person rented a car for a week. They paid a fixed fee of $250 and an additional $0.30 per mile over 1200 miles. If they drove 1600 miles in the week, what was their total cost?
def solve() -> int: fixed_fee = 250 extra_mileage_rate = 0.30 extra_mileage = 1600 - 1200 extra_cost = extra_mileage * extra_mileage_rate total_cost = fixed_fee + extra_cost result = total_cost return result
The sum of two numbers is 56. If one number is 20 less than the other, what are the two numbers?
def solve() -> int: total = 56 second_number = (total/2) + 20 first_number = total - second_number result = (first_number, second_number) return result