In <d6779e35-32b8-417a-abf9-72454573b...@googlegroups.com> qbai...@ihets.org writes:
> """ crypto.py > Implements a simple substitution cypher > """ > alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" > key = "XPMGTDHLYONZBWEARKJUFSCIQV" > def main(): > keepGoing = True > while keepGoing: > response = menu() > if response == "1": > plain = raw_input("text to be encoded: ") > print encode(plain) > elif response == "2": > coded = raw_input("code to be decyphered: ") > print decode(coded) > elif response == "0": > print "Thanks for doing secret spy stuff with me." > keepGoing = False > else: > print "I don't know what you want to do..." > i really need help on how to encrypt it im not sure how to go about doing > that please help. def encode(plain): '''Return a substituted version of the plain text.''' encoded = '' for ch in plain: encoded += key[alpha.index(ch)] return encoded -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies" -- http://mail.python.org/mailman/listinfo/python-list