Write a program that reads an 8-digit integer. The output of your program should be the result of the sum of all digits of the integer entered. If the number entered does not have 8 digits, the program should write 'NAO SEI' (without accents and quotation marks).
IMPORTANT: You should resolve this issue by using Repetition Layout. Otherwise, the grade will be zero.
Exemplo 1:
Entrada:
123
Saída:
NAO SEI
Exemplo 2:
Entrada:
34576890
Saída:
42
Personally I made the following code but my grade continues 5 out of 10 and I think the problem is in this part of the:
if n<=1:
print("NAO SEI")
Since the program does not have 8 digits, the program should write 'NAO SEI'
n=int(input("valor de n:"))
soma=0
while n>0:
resto=n%10
n=(n-resto)//10
soma=soma+resto
print(soma)
if n<=1:
print("NAO SEI")