Week 1 – Python Study Group

by Security Dude

We formed a study group to walk thru “lambda”, “reduce”, list manipulation and “map” concepts.  We broke down each of the lines and expanded out each of the substitutions and walked thru each step.  It was clear everyone was having fun.  Everyone shared their ideas. It was a fun collaborative session. We searched the interweb for brain teasers and used this website http://www.pythonchallenge.com/. We completed a few exercises and demo’d each of our solutions to the teasers. It was eye opening to see different programming solutions to the same problem. Overall a great experience. I can’t wait for next week.

import string
magic = [12,-12,25,-11,-1]
out = [ 1 - reduce(lambda x, y: x+y, magic[1:])]
map (lambda x: out.append(out[-1]+x), magic)
print ''.join(map(lambda x: string.uppercase[x], out))


Advertisements