Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- line = input().split()
- n = line[0]
- k = int(line[1])
- #removed the whole global superdigit construct, now its just a parameter of calc
- def calc(superdigit, k): #added k here
- superlist = list(str(superdigit))
- temp = 0
- for i in range(len(superlist)):
- temp = (temp + int(superlist[i]))
- temp = temp * k #added this
- if (len(str(temp)) > 1):
- calc(temp, 1) #for every recursive step k=1
- else: print (temp)
- return
- calc(n, k) #we take in n and k directly
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement