Post

Day 35 of 100 Days of Python

Practising Recursion

1
2
3
4
5
6
7
8
# sum of digits

def sod(n):
    if n<10:
        return n
    return n%10 + sod(n//10)
a = sod(25)
print(a)
This post is licensed under CC BY 4.0 by the author.

Trending Tags