Journal Journal: Python Challenge 1
###Puzzle 1#########################################################################################################
from string import maketrans
##Creating the Method##
#First, lets make a string of the alphabet.
FromABC = 'abcdefghijklmnopqrstuvwxyz'
#Because we know that every letter has to go down 2, Make another alphabet string starting with c, and ending with b
ToCDE = 'cdefghijklmnopqrstuvwxyzab'
#And from these 2 strings, we can make a method. maketrans calls both strings like this: (Before, After)
#Basically, The first letter in FromABC will be replaced with the first letter in ToCDE.
#This is the same for the second letter and so on.
DecryptionMethod = maketrans(FromABC, ToCDE)
#Now we need a string with the text that will be translated.
Puzzle1Code = """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."""
#Finally we will create the result. Basically it says the Puzzle1Code will use the function "translate()" that calls
#upon the method known as "DecryptionMethod"
DecodedMessage = Puzzle1Code.translate(DecryptionMethod)
print """
Solution 1:""", DecodedMessage
#Now just take "map" which is in the url, and apply the method: 'map'.translate(DecryptionMethod)
from string import maketrans
##Creating the Method##
#First, lets make a string of the alphabet.
FromABC = 'abcdefghijklmnopqrstuvwxyz'
#Because we know that every letter has to go down 2, Make another alphabet string starting with c, and ending with b
ToCDE = 'cdefghijklmnopqrstuvwxyzab'
#And from these 2 strings, we can make a method. maketrans calls both strings like this: (Before, After)
#Basically, The first letter in FromABC will be replaced with the first letter in ToCDE.
#This is the same for the second letter and so on.
DecryptionMethod = maketrans(FromABC, ToCDE)
#Now we need a string with the text that will be translated.
Puzzle1Code = """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."""
#Finally we will create the result. Basically it says the Puzzle1Code will use the function "translate()" that calls
#upon the method known as "DecryptionMethod"
DecodedMessage = Puzzle1Code.translate(DecryptionMethod)
print """
Solution 1:""", DecodedMessage
#Now just take "map" which is in the url, and apply the method: 'map'.translate(DecryptionMethod)