-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCollectionDemo.py
57 lines (35 loc) · 1016 Bytes
/
CollectionDemo.py
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
55
56
57
#WAP to implement Collection
BookList = ["Wings of Fire","The monk who sold his Ferari","Hamlet"]
print(BookList)
def Display():
for book in BookList:
print(book)
#Displaying elements of list
for book in BookList:
print(book)
#Adding more books
BookList.append("You can Win")
BookList.append("White Tiger")
print("---------------before poping Book---------------")
Display()
#implemeting PoP
print(BookList.pop())
print("---------------After poping Book---------------")
Display()
print("Enter 10 books you want in your list")
for i in range(10):
name = input("Enter Book name")
BookList.append(name)
Display()
for book in BookList:
print(book)
#delete a book
BookList.remove("Hamlet")
print("-----------------------------------------")
for book in BookList:
print(book)
print("Book at first location")
print(BookList[0])
print("Counting Elements of List ")
print(BookList.count("White Tiger"))
Display()