17 lines
385 B
Python
17 lines
385 B
Python
temp = input().strip()
|
|
|
|
def main(score: str):
|
|
if not score:
|
|
raise ValueError("Пустой ввод")
|
|
if not score.isdigit():
|
|
raise ValueError("Введены не цифры")
|
|
total: int = 0
|
|
for x in score:
|
|
total += int(x)
|
|
print(f"сумма цифр = {total}")
|
|
|
|
try:
|
|
main(temp)
|
|
except ValueError as e:
|
|
print(f"Ошибка: {e}")
|