Question: PYTHON HW HELP!! print the following: The count, name, and cost of each item on a line, the grand total due, the amount tendered, and
PYTHON HW HELP!!
print the following:
The count, name, and cost of each item on a line,
the grand total due,
the amount tendered, and
the change due back to the customer,
The average cost per item to 3 decimal places.
What is the item being purchased? Cookie
How many? 3
What is the price of each item? .13
What is the next item being purchased? Lemonade
How many? 2
What is the price of each item? 1.10
3 Cookie(s) cost $ 0.39
2 Lemonade(s) cost $ 2.20
The total due is $ 2.59
How much money did customer give you? 3.00
You gave me $ 3.00
The amount of change is $ 0.41
The average cost was $ 0.518
This is my code below, I am having trouble with the total_due line.
item_1 = print(input('What is the item being purchased? ')) how_many1 = int(input('How many? ')) price_1 = float(input('What is the price of each item? ')) item_2 = print(input('What is the next item being purchased? ')) how_many2 = int(input('How many? ')) price_2 = float(input('What is the price of each item? ')) cookies = print(how_many1, 'Cookie(s) cost $',(how_many1*price_1)) lemonade = print(how_many2, 'Lemonade(s) cost $',(how_many2*price_2)) total_due = print('The total due is $',(float(cookies + lemonade)))
cash_recieved = print('How much money did the customer give to you? $') change = print('The amount of change is $',cash_recieved - total_due)
avg_cost = print('The average cost of each item was $',[(price_1+price_2)/(how_many1+how_many2)])
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
