Skip to content

Instantly share code, notes, and snippets.

@pysoftware
Created March 17, 2019 05:50
Show Gist options
  • Select an option

  • Save pysoftware/4a2bd885242648764b0c4a62c3043b65 to your computer and use it in GitHub Desktop.

Select an option

Save pysoftware/4a2bd885242648764b0c4a62c3043b65 to your computer and use it in GitHub Desktop.
Recursion sum of digit
# Recursion sum of digit
def sumDigit(n):
if n == 0:
return 0
return n % 10 + sumDigit(n//10)
print(sumDigit(123))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment