1. 程式人生 > >Python自學:第三章 使用方法pop()刪除元素

Python自學:第三章 使用方法pop()刪除元素

clas tor tle itl 輸出 color pytho 方法 moto

motorcycle = ["honda", "yamaha", "suzuki"]

last_owned = motorcycle.pop()
print("The last motorcycle I owned was a " + last_owned.title() + ".")

輸出為:

The last motorcycle I owned was a Suzuki.

Python自學:第三章 使用方法pop()刪除元素