def digit_sum(n): n = str(n) sumup = 0 for x in n: x = int(x) sumup += x return sumup