1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Python

Connected

Exercise

List Methods (2)

Most list methods will change the list they're called on. Examples are:

  • .append(), that adds an element to the list it is called on,
  • .remove(), that removes the first element of a list that matches the input, and
  • .reverse(), that reverses the order of the elements in the list it is called on.

You'll be working on the list with the area of different parts of the house: areas.

Instructions

100 XP
  • Use .append() twice to add the size of the poolhouse and the garage again: 24.5 and 15.45, respectively. Make sure to add them in this order.
  • Print out areas
  • Use the .reverse() method to reverse the order of the elements in areas.
  • Print out areas once more.