[Tutor] Still the Python Challenge

Joaquim Santos jsantos.lazer at gmail.com
Tue Jan 3 18:44:08 CET 2012


Hi list!

After this past week of no PC and no work, I'm again at the Python
Challenge Cypher problem.
I decided to go with the flow and solve it with maketrans (6 lines of
code against the 40 and going I had already...) and it solved it
quickly and clean!

However, and please be sure I don't want to re-invent any wheel, I
still got some doubts unexplained...

 - How to correctly populate a list using, for instance, a for loop;

 - how to correctly use join to read the said list in a human friendly way...

This was the code I was using.

for letter in cypheredText:

asciiValue = ord(letter)

if asciiValue in range(97, 123):

asciiValue += shiftedCypherNumber

if asciiValue > 122:

asciiValue -= 26

newLetter = chr(asciiValue)

text = list()

text.append(newLetter)

joinedText = ' '.join(text)

return joinedText


Thanks for all your time and patience. Sorry for before not using Plain text!



Joaquim Santos


More information about the Tutor mailing list