Navigate your way on your awesome working machines (no setup today yay!) to the 2-Python-Challenge directory and type in ipython notebook.
Start a new notebook and we’ll go through the demo placed at this link:
http://nbviewer.ipython.org/urls/raw.github.com/adina/boot-camps/master/grannies.ipynb
Note do these all within one cell in the notebook. Bonus points if you can figure out why.
Exercise 1:
Make a dictionary of the data in the grannies.txt file.
Exercise 2:
For each key in the grade dictionary, print out the corresponding values in the grannies dictionary.
Exercise 3:
Edit the grades dictionary to include the values of the grannies dictionary.
Exercise 4:
I’m going to show you some code, work with your partner to figure out what will print based on that code.
Exercise 5:
Split and assign variables to the new grannies file containing both grades and deaths.
Hint: Dont do this on the giant file.
Exercise 6:
Look at the dict.get method for dictionaries.
I’m going to show you some code, work with your partner to figure out what is going on in this code.
Bonus: Try to automate this code from start to finish.
This file can be edited directly through the Web. Anyone can update and fix errors in this document with few clicks -- no downloads needed.
For an introduction to the documentation format please see the reST primer.