Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import sqrt
- def translate(word):
- grains = list(map(ord, word))
- res = []
- for grain in grains:
- if grain%2:
- ou = len(set(str(grain)))
- ou -= True
- print(ou)
- res += 2 * ou * [(grain - sqrt(grain) - 2)] + abs(ou - 1) * ([grain + 3, grain - 3])
- else:
- zeus = 10**2
- grain -= zeus
- if grain%4:
- res += [zeus, int(zeus/3)]
- elif not grain%3:
- zeus += True
- res += [int(zeus+3), zeus]
- elif not grain%(2**3):
- res += [str(int(bool(grain)))*3, grain*2]
- else:
- res += [str(int(bool(grain)))*3]
- res += [int(res[-1]) + 2*grain]
- res[-1], res[-2] = res[-2], res[-1]
- try:
- return "".join(map(chr, map(int, res)))
- except:
- return word
- print(translate("python"))
Advertisement
Add Comment
Please, Sign In to add comment