Help me to understand why my first solution threw errors but the second - OK (sorry for my English)

First solution - fail (but in my computer it worked)

```
#!/usr/bin/env python3
import sys
def digit_sum(n):
try:
int_n = int(n)
except:
print ("Error")
sys.exit()
if int_n <= 0:
print ("n must be greater than 0")
else:
list_n = list(str(n))
summa = 0
for i in list_n:
summa += int(i)
return summa
n = input()
print (digit_sum(n))
```

Second solution - pass

```
#!/usr/bin/env python3
def digit_sum(n):
list_n = list(str(n))
summa = 0
for i in list_n:
summa += int(i)
return summa
n = input()
print (digit_sum(n))
```

Thank you.