Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def alien(number,source,target): return __alien(_alien(number,source,len(number)),target)
- def _alien(num,b1,l,mod=0):
- out = b1.index(num[l-1])*len(b1)**mod
- return out if l == 1 else out + _alien(num,b1,l-1,mod+1)
- def __alien(num,b2):
- charset = b2
- l = len(b2)
- y = num%l
- out = charset[y]
- return out if num == y else __alien((num-y)/l,b2) + out
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement