patricksmile123 / UNI-Work

Uni work
0 stars 0 forks source link

Caesar Encrypt #1

Open patricksmile123 opened 1 year ago

patricksmile123 commented 1 year ago

plainText = open("encrypted.txt", 'r') distance = int(input("Please input the distance of the Caesar Cypher ")) code = " " ordvalue = " " for ch in plainText: len(ch) == 1 ordvalue = ord(ch) cipherValue = ordvalue + distance if cipherValue > ord('z'): cipherValue = ord('a') + distance - (ord)('z') - ordvalue+1 code += chr(cipherValue) print(code) file = open("encrypted.txt", 'w') file.write(code) file.close()