Recursive Digit Sum

  • + 0 comments

    python

    def superDigit(n, k):
        # Write your code here
        if len(n)<2:
            return n
        else:
            Sum=k*sum([int(char) for char in n])
            return superDigit(str(Sum), 1)