Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Python 102

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.
Avatar for boundsj boundsj
August 01, 2012

Python 102

Meet Python. It won't bite.

Thanks to @fat for slide layout inspiration!

Avatar for boundsj

boundsj

August 01, 2012
Tweet

More Decks by boundsj

Other Decks in Programming

Transcript

  1. Keeping a dictionary of counts # check if dict has

    key # if so then increment value # if not then add key and init # value to 1 def increment(d, k): if k in d: d[k] += 1 else: d[k] = 1 Thursday, August 2, 12
  2. Compare to JavaScript: /* check if dict has key *

    if so then increment value * if not then add key and init * value to 1 */ function increment(d, k) { if (k in d) { d[k] += 1; } else { d[k] = 1; } } Thursday, August 2, 12
  3. (review) # check if dict has key # if so

    then increment value # if not then add key and init # value to 1 def increment(d, k): if k in d: d[k] += 1 else: d[k] = 1 Thursday, August 2, 12
  4. “You mustn’t always believe what I say. Questions tempt you

    to tell lies, particularly when there is no answer.” Pablo Picasso Thursday, August 2, 12
  5. Da Links: [Hitchhiker's guide to Python] http://docs.python-guide.org/en/latest/index.html [Counter rocks!] http://docs.python.org/library/collections.html#collections.Counter

    [Our founder] http://en.wikipedia.org/wiki/Guido_van_Rossum [Make isolated environments for development] http://www.virtualenv.org/en/latest/index.html http://www.doughellmann.com/projects/virtualenvwrapper/ [Learn Python and other things] http://www.codecademy.com Apps and Libraries: [deepdish] http://deepdish.herokuapp.com/ [WindyPie] https://github.com/codeforamerica/windypie Thursday, August 2, 12