Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.
One possible program:
marks = []
while True:
mark = float(input("Mark (-1 to finish): "))
if mark == -1:
break
marks.append(mark)
if len(marks) == 0:
print("No marks entered.")
else:
print("Count:", len(marks))
print("Average:", sum(marks) / len(marks))