1. 学习
  2. /
  3. 课程
  4. /
  5. Introduction to Python

Connected

练习

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.

说明

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.