-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path38)Pop_Method_List_Program.py
More file actions
42 lines (25 loc) · 942 Bytes
/
38)Pop_Method_List_Program.py
File metadata and controls
42 lines (25 loc) · 942 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
#Remove specified index.
#The pop() method removes the specified index
#Example
#Remove the second item.
thislist = ["apple","banana","cherry"]
thislist.pop(1)
print(thislist)
#########################################################################################
#if we do not specify the index , the pop() method removes the last item.
#Example.
#Removes the last item.
names = ["nikita","chaku","prachi"]
names.pop()
print(names)
#####################################################################################33
#The del keyword also removes the specified index.
#Example
thislist = ["apple","banana","cherry"]
del thislist[0]
print(thislist)
#################################################################################
#The del keyword can also delete the list completely.
thislist = ["apple","banana","cherry"]
del thislist
###############################################################################