Question: Python add an outside the loop to avoid the division by zero and tell the user that you can t compute an average without data.
Python
add an outside the loop to avoid the division by zero and tell the user that you cant compute an average without data.
def main:
total
count
moreItems True
while moreItems:
price floatinputEnter price of item when done:
if price :
count count
total total price
printSubtotal: $ total
else:
moreItems False
average total count
printTotal items: count
printTotal $ total
printAverage price per item: $ average
main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
