Python list pop example

lp.py
books=['Algebra','Geometry','Physics','Chemistry']

print("List of books")
print(books)

books.append('Biology')
books.append('English')

print("\nList of books after adding two more books")
print(books)

print("\nRemove last book from list")
books.pop()

print("\nList of books after removing last book")
print(books)

print("\nRemove last book from list")

books.pop()

print("\nList of books after removing last book")

print(books)

Output
lp

 

 

 

 

Published by Python programming examples for beginners

Abhay Gadkari is an IT professional having around experience of 20+ years in IT industry. He worked on web technologies and databases with Insurance and ERP projects.