MOAR Dictionaries Notes

by Elliott Hauser

05 Apr 2016

Dictionaries Part Deux

Things to remember:

  • You’re looping through each row. If a state exists, do one set of things. If not, do another set of things. That’s the pattern for both 1 and 3.
  • ('\t').join(["some", "LIST", "of", "things"]) is an idiom! Live it, love it, use it. You can also join around spaces, commas, whatever you need.
  • Got a header in your list of lists? Slice it off
  • Got bad data? Manually clean it. Or automatically clean it. Or try/except.

Dictionary exercises today

We’ll spend the whole class working individually on your homework. I’m here. Use me. It’s due 11:59pm Weds.

Elliott Hauser is a PhD Student in information science at UNC Chapel Hill. He's hacking education as one of the cofounders of Trinket.io. Find Elliott Hauser on Twitter, Github, and on the web.