You want to know your grade in Computer Science, so write a program that continuously takes grades between 0 and 100 to standard input until you input "stop", at which point it should print your average to standard output.
value = input()
numbers = []
while(value.lower() != 'stop'):
if value.isdigit():
value = int(value)
if value > 0 and value <= 100:
numbers.append(int(value))
else:
print("It's not a number")
value = input()
print('average', sum(numbers)/len(numbers))
Comments
Leave a comment