11-28-2009, 12:39 AM
Code:
def rot(a):
e = list(a)
q = len(e)
z = 0
w = []
while z < q:
b = ord(a[z:z+1])
z = z + 1
c = b+13
d = chr(c)
r = chr(b-13)
if c <= 122 and c > 96:
w.append(d)
elif c > 122:
w.append(r)
else: w.append(' ')
print "".join(w)
raw_input("Press Enter To Continue")
menu()
def unrot(a):
e = list(a)
q = len(e)
z = 0
w = []
while z < q:
b = ord(a[z:z+1])
z = z + 1
c = b-13
d = chr(c)
r = chr(b+13)
if c <= 122 and c > 96:
w.append(d)
elif c > 122:
w.append(r)
else: w.append(' ')
print "".join(w)
raw_input("Press Enter To Continue")
menu()
def menu():
print "1) Encrypt"
print "2) Decrypt"
u = (raw_input("What do you want to do?: "))
if u == '1': rot(raw_input("What do you want to encrypt?: "))
elif u == '2': unrot(raw_input("What do you want to encrypt?: "))
else:
print "Invalid"
raw_input("Press Enter To Continue")
menu()
menu()