Answer to Question #298793 in Python for tgt

Question #298793

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.


1
Expert's answer
2022-02-16T18:38:56-0500
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))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS