Am Donnerstag, 4. Juli 2013 19:20:43 UTC+2 schrieb Arturo B:
> ...
> So I want to question:
> How is the 
> 
> if 'h' in consonants else 'h' for 'h' in s
> 
> part evaluated? (step by step please :P )

Although new to python I think I can solve this (if no one contradicts, I can 
guess that I understood it :-) ):

Take every letter from the string, one after the other, (for l in s).
If you can find the letter in the string constants (if l in constants) then 
take it, append an "o" and then the letter again and return it (l + 'o' + l) if 
not, return the letter as it is (else l).

Or in applicable order:
take 'h' append 'o' append 'h' and return this, if you can find 'h' in 
constants, if not return just 'h' (and do this for every letter in string s)

hth,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to