-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlist.py
More file actions
56 lines (47 loc) · 760 Bytes
/
Copy pathlist.py
File metadata and controls
56 lines (47 loc) · 760 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# for list
a=["ankur",56,"vikrant",True, "welcome"]
print(a)
print(len(a))
print(type(a))
print(a[1])
print(a[-1])
print(a[0:2])
print(a[:1])
print(a[2:])
if "ankur" in a:
print("yes")
# for changing an item in list.
a[2]="VIKRANT"
print(a)
a[1:3]=["hello","world"]
print(a)
a[3:4]=["OK","come"]
print(a)
a[0:3]=["SORRY"]
print(a)
# insert new item in list.
a.insert(0,"ANKUR")
print(a)
a.append("yes")
print(a)
# merging 2 list in one
b=[45,64,"3r5"]
print(b)
a.extend(b)
print(a)
# removing items
a.remove("3r5")
print(a)
a.pop(2)
print(a)
a.pop() # for last item in list
print(a)
del a[0]
print(a)
""" for deleting a compleate list
del b
print(b)
"""
# for deletig all items in a still list remain same with out any item in it.
a.clear()
print(a)