列表方法 (2)
本练习是课程的一部分
Python 入门
练习说明
- 调用
.append()两次,依次加入泳池小屋和车库的面积:分别是24.5和15.45。注意,务必要按上面的顺序添加。 - 打印
areas。 - 使用
.reverse()方法将areas中元素的顺序反转。 - 再次打印
areas。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Create list areas
areas = [11.25, 18.0, 20.0, 10.75, 9.50]
# Use append twice to add poolhouse and garage size
# Print out areas
# Reverse the orders of the elements in areas
# Print out areas