Автор - reic661
a = None
while True:
try:
a = input('Enter the number:n> ')
int(a)
break
except ValueError:
continue
while True:
_t = None
while True:
try:
_t = int(input(
'1 - Print length of the numbern2 - Print sum of numerals in numbern3 - Print average of numerals in numbern0 - Exit> '))
break
except ValueError:
continue
if _t == 1:
print(len(a))
elif _t == 2:
print(sum([int(x) for x in a]))
elif _t == 3:
print(float(sum([int(x) for x in a])) / float(len(a)))
elif _t == 0:
break
else:
continue