Exercise

Methods

There will be times when you need to add values into a list, or update values in a dictionary. Here we will see some of the object-oriented nature of Python, which is different from R.

Everything in Python is an object (e.g., list object, dictionary object, etc). Objects can all perform certain tasks (e.g., add values to a list, update values in a dictionary). Instead of calling functions on the object you want to manipulate, you use dot notation to have the object perform an action on itself by calling a method.

Instructions 1/2

undefined XP
    1
    2
  • Append 2018 to the list person_list.
  • Extract the last element from person_list.