-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmotorcycles.py
More file actions
39 lines (30 loc) · 964 Bytes
/
motorcycles.py
File metadata and controls
39 lines (30 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
motorcycles=['honda','yamaha', 'suzuki']
print(motorcycles)
# motorcycles[0]='ducati'
motorcycles.append('ducati')
print(motorcycles)
motorcycles_1=[]
motorcycles_1.append('mit1')
motorcycles_1.append('mit2')
motorcycles_1.append('mit3')
print(motorcycles_1)
# Inserting element into a list
motorcycles.insert(0,'mit')
print(motorcycles)
del motorcycles[1]
print(motorcycles)
popped_motorcycle=motorcycles.pop()
print(motorcycles)
print(popped_motorcycle)
last_owned=motorcycles.pop()
print(f"The last motorcycles I owned was a {last_owned.title()}")
first_owned=motorcycles.pop(0)
print(f"The first motorcycle I owned was a {first_owned.title()}")
motorcycles.remove('yamaha')
print(motorcycles)
motorcycles_2 =['honda', 'yamaha', 'suzuki', 'ducati']
print(motorcycles_2)
too_expensive='ducati'
motorcycles_2.remove(too_expensive)
print(motorcycles_2)
print(f"\nA {too_expensive.title()} is too expensive for me.")