Question: Code Example 5 - 1 1 . count = 1 2 . item _ total = 0 3 . item = 0 4 . while

Code Example 5-1
1. count =1
2. item_total =0
3. item =0
4. while count <4:
5. item = int(input("Enter item cost: "))
6. item_total += item
7. count +=1
8. average_cost = round(item_total / count)
9. print(f"Total cost: {item_total}
Average cost: {average_cost}")
Refer to Code Example 5-1: If the user enters 5,10, and 15 at the prompts, the output is:
Total cost: 30
Average cost: 8
Which line should be changed to fix this logic error?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!