Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
670 B
3
Indexable
Never
print('          MATHLETE           ')
print('_____________________________')
print('                             ')

cardinality = 1
sum = 0
mean_value = 0

number = input('> ')

while number == number:
    try:
        int(number)
    except ValueError:
        print('ERROR: invalid number')
        number = input('> ')
        continue

    sum += int(number)
    mean_value = sum / cardinality
    number = input('> ')
    cardinality += 1

    if number == 'exit':
        cardinality -= 1
        print('--------------------------')
        print('Cardinality: ', cardinality)
        print('Sum: ', sum)
        print('Mean value: ', mean_value)
        exit()