You are viewing a single comment's thread. Return to all comments →
def modu (n): return sum(int(i) for i in str(n))
def superDigit(n): if n < 10: print (n) else: superDigit(modu(n))
n,k = input().split() superDigit(modu(int(n)) * int(k))
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Recursive Digit Sum
You are viewing a single comment's thread. Return to all comments →
def modu (n): return sum(int(i) for i in str(n))
def superDigit(n): if n < 10: print (n) else: superDigit(modu(n))
n,k = input().split() superDigit(modu(int(n)) * int(k))