Question: This is PYTHON!!!!!!! the following code uses an infinite loop and a break statement that immediately causes control to exit the loop. This program can

This is PYTHON!!!!!!!

the following code uses an infinite loop and a break statement that immediately causes control to exit the loop. This program can be found in the file PartC_average_with_while.py

total = 0

counter = 0

while True: # an infinite loop

score = input("Enter a score (or -99 to exit): ") if score < 0:

break total += score counter += 1

print "Average is", float(total)/counter

Rewrite the above sentinel-controlled while loop without using a break statement.

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 Databases Questions!