Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from functools import reduce
- def persistence(number, cnt = 1):
- num = [int(n) for n in str(number)]
- num = reduce((lambda n, m: n * m), num)
- if len(str(num)) == 1:
- return cnt
- else:
- cnt +=1
- persistence(num, cnt)
Advertisement
Add Comment
Please, Sign In to add comment