def digit_sum(n): \'\'\'(int)->number Returns the sum of all the digits in the given integer, n\'\'\' if n<10: return n return n%10 + digit
please try the following code:
def dgtl_rt(n): return n%9 or n and 9 print(dgtl_rt(123))