Lesson 07: Coding Exercise

Do the following:

  1. Create a dictionary with a key and a value.
  2. Print off that dictionary
  3. Change the value.
  4. Print off the new dictionary
  5. Advanced: Try to create a dictionary with a key whose value is a list. Now, try to print of the first item in the list. This is a bit tricky. I encourage you not to use the cheat sheet but struggle with the problem. Hint: use the print function to figure out what is and is not working in your code. If you cannot figure this out, do not feel frustrated. It is a difficult problem for those just starting with Python, but it’s one that you will encounter repeatedly in the digital humanities.

If you get stuck, consult Lesson 07: Cheat Sheet.