Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #CaesarCipher.py
- #Python 2.7
- #By Chris Clarke
- #11.06.2015
- def main():
- message = raw_input ("Please enter message to encode: ").lower()
- offset = int (input ("Enter offset: "))
- result = ""
- for ch in message:
- x = ord(ch) + offset
- if ch.isalpha() and x > ord('z'): # wrap around
- x -= 26
- result += chr(x)
- print result
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement