Lesson 11: Coding Exercise

Do the following:

  1. Create a class based around your friends. Call this class: Friend.
  2. Create an __init__ function and make the first argument self. Next, add three arguments: name, age, home_state.
  3. Create three friend objects that you pass through the class.
  4. Print off each friend as a dictionary using both vars and __dict__ methods.
  5. Print off one friend’s name and age on a single line. Hint, you may need to change age to a string.

If you get stuck, check out Lesson 11: Cheat Sheet.