the-honk/school/gcse/year 9/encryption/Caesar Cipher Decrypter.py

18 lines
394 B
Python
Raw Normal View History

2024-10-09 17:02:27 +00:00
counter = 26
ciphertext = input('Please input some ciphertext to decrypt.')
ciphertext = ciphertext.upper()
while counter >= 0:
outputWord = ''
for i in ciphertext:
asc = ord(i)
shiftChr = asc + counter
if shiftChr >= 90:
shiftChr = (shiftChr-90)+64
outputWord = outputWord + chr(shiftChr)
print(outputWord)
counter = counter - 1