-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlistmethod.py
More file actions
46 lines (35 loc) · 852 Bytes
/
listmethod.py
File metadata and controls
46 lines (35 loc) · 852 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
#day 23
#------------------------list methods--------------------------------------
l=[1,45,1,3,4,5,9]
# print(l)
# #-----------------append method---at element at last of list-----------
# l.append(7)
# print(l)
# -----------------sort method---------
# l.sort()
# l.sort(reverse=True)#PRINT IN REVERSE ORDER
# print(l)
#---------INDEX METHOD-----------------
print(l.index(1))
print(l.index(9))
#-------------count method*************
print(l.count(1))
#*******************copy element**********
m=l.copy()
m[0]=0
print(l)
#*********insert method**********
l.insert(1,83)
print(l)
#********extend method************
m=[100,200,300]
l.extend(m)
print(l)
#*********concating two list********
k=l+m
print(l)
# *********clear method******
# l.clear()
#******pop method**********
l.pop(0)
print(l)