28 lines
652 B
Python
28 lines
652 B
Python
|
|
motorcycles = ['honda', 'yamaha', 'suzuki']
|
||
|
|
print(motorcycles)
|
||
|
|
|
||
|
|
motorcycles.append('honda')
|
||
|
|
|
||
|
|
motorcycles[0] = 'ducati'
|
||
|
|
print(motorcycles)
|
||
|
|
|
||
|
|
motorcycles.insert(0, 'harley')
|
||
|
|
print(motorcycles)
|
||
|
|
|
||
|
|
del motorcycles[0]
|
||
|
|
print(motorcycles)
|
||
|
|
|
||
|
|
popped_motorcycle = motorcycles.pop()
|
||
|
|
print(motorcycles)
|
||
|
|
print(popped_motorcycle)
|
||
|
|
print(f"The last motocycle I owned was a {popped_motorcycle.title()}.")
|
||
|
|
|
||
|
|
first_owned = motorcycles.pop(0)
|
||
|
|
print(f"The first motorcyle I owned was a {first_owned.title()}.")
|
||
|
|
|
||
|
|
motorcycles.remove('suzuki')
|
||
|
|
print(motorcycles)
|
||
|
|
|
||
|
|
too_expensive = 'yamaha'
|
||
|
|
motorcycles.remove(too_expensive)
|
||
|
|
print(f"{too_expensive.title()} is too expensive for me!")
|