Tuesday, November 2, 2010

Python Challenge #1

Solved Python challenges 0 and 1.
Like the solution I came up with to #1.
Posted below.

****************************************

encrypted_string = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."

alphabet_list = "abcdefghijklmnopqrstuvwxyzab"
numbers = "123456789"

decrypted_string = ""

for i in encrypted_string:
if i not in alphabet_list:
i = i
decrypted_string += i
else:
first_a_loc = alphabet_list.find(i)
second_a_loc = first_a_loc + 2
decrypted_string += alphabet_list[second_a_loc]

print decrypted_string

No comments:

Post a Comment

Followers