Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.
One possible program:
total = 0.0
count = 0
while True:
mark = float(input("Mark (-1 to finish): "))
if mark == -1:
print("Done")
break
if 0 <= mark <= 100:
count += 1
total += mark
print("Running average:", total / count)
else:
print("Ignored - mark must be 0..100")