You can download this code by clicking the button below.
This code is now available for download.
Calculate the sum of all digits in an integer.
Technology Stack : Python built-in libraries
Code Type : Function
Code Difficulty :
def sum_of_digits(n):
return sum(int(digit) for digit in str(n))