def CaesarEncrypt(plainText, shiftAmount): cipherText = '' for ch in plainText: cipherText = cipherText + CaesarEncryptOneCharacter(ch,shiftAmount) return cipherText def CaesarEncryptOneCharacter(ch, shiftAmount): if ch.isalpha(): if ch.islower(): start= ord ('a') else: start= ord ('A') letterInUnicode = ord (ch) letterInAlphabet = letterInUnicode - start shiftedLetterInAlphabet= (letterInAlphabet + shiftAmount)%26 shiftedLetterInUnicode = shiftedLetterInAlphabet + start return chr(shiftedLetterInUnicode) else: return ch