Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def caesar(plainText, shift):
- cipherText = ""
- for ch in plainText:
- if ch.isalpha():
- stayInAlphabet = ord(ch) + shift
- if stayInAlphabet > ord('z'):
- stayInAlphabet -= 26
- finalLetter = chr(stayInAlphabet)
- cipherText += finalLetter
- print "Your ciphertext is: ", cipherText
- return cipherText
Advertisement
Add Comment
Please, Sign In to add comment