1
0
Files
pythonCrashCourse/chap3/motorcycles.py

28 lines
652 B
Python
Raw Permalink Normal View History

2025-05-09 10:12:44 -04:00
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!")