initial file upload
This commit is contained in:
28
chap3/motorcycles.py
Normal file
28
chap3/motorcycles.py
Normal file
@@ -0,0 +1,28 @@
|
||||
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!")
|
||||
Reference in New Issue
Block a user