TalTech_crypt/hw0/script.py

15 lines
318 B
Python

f = open("pt", "r")
cipher = f.read()
text = ''
for c in cipher:
#tmp = chr( (ord(c) - ord('A') + 13) % 26 + ord('A') )
#text += tmp
#print( c, "->", tmp)
shifted = ord(c)+13
if(shifted >= 65+26):
text += chr(shifted-26)
else:
text += chr(shifted)
print(ord(c))
print(text)