forked from thewhitetulip/SamplePythonScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ceaser.py
26 lines (22 loc) · 673 Bytes
/
ceaser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'''
#!/usr/bin/python
#Author: Suraj Patil
#Version: 2.0
#Date: 27th March 2014
this program implement the ceaser cipher shift algorithm, it takes the plain text
and the shift from the user and prints the cipher
usage: python ceaser.py
'''
import string
plaintext=raw_input("enter clear text")
key=raw_input('input key')
letters = string.ascii_letters #abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
dig = string.digits
for i in range(0,len(plaintext)):
if not plaintext[i].isalpha: #dig.find(plaintext[i])!=-1:
print "enter alphabet only"
exit()
for i in range(0,len(plaintext)):
a = letters.find(plaintext[i])
if a!=-1:
print str(letters[(a+key)%26]),