Question: 4 . 7 . 5 : Fix this program so that it only stops reading numbers when the user enters Q . This program reads

4.7.5: Fix this program so that it only stops reading numbers when the user enters Q.
This program reads a sequence of floating-point values and computes their average. A value of zero is used as the sentinel. Improve the loop so that the loop is only exited if the user enters the letter Q. Empty print statements are included for output formatting.
This program reads a sequence of floating-point values and computes their average. A value of zero is used as the sentinel.
Improve the loop so that the loop is only exited if the user enters the letter Q. Empty print statements are included for output
formatting.
total =0.0
count =0
TODO: Fix this program so that it only stops reading numbers
when the user enters Q.
value = float(input("Enter a real value or "Q" to quit: "))
print()
while value !=0.0 :
total = total + value
count = count +1
value = float(input("Enter a real value or "Q" to quit: "))
print()
avg = total / count
print(avg)
Only edit line 7-13
4 . 7 . 5 : Fix this program so that it only

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!