Python Programming

List Data Structure

Python programming example for list data structure

8/8/2021
0 views
list-data-structure.pyPython
#!/usr/bin/evn python

listData = ['Lion', 'Eagle', 'Penguin', 2017, 2018];

print ("Values in the list", listData)

listData.insert(3, 'Parrot')

print ("After insering value at 4th posting in the list", listData)

listData.append( 'Pigeon')

print ("After append value in the list", listData)

listData[3] = 'Tiger';

print ("After value update of 4th position in the list", listData)

del listData[0]

print ("After deleting value in the list", listData)


# ***** Output *****
# Values in the list ['Lion', 'Eagle', 'Penguin', 2017, 2018]
# After insering value at 4th posting in the list ['Lion', 'Eagle', 'Penguin', 'Parrot', 2017, 2018]
# After append value in the list ['Lion', 'Eagle', 'Penguin', 'Parrot', 2017, 2018, 'Pigeon']
# After value update of 4th position in the list ['Lion', 'Eagle', 'Penguin', 'Tiger', 2017, 2018, 'Pigeon']
# After deleting value in the list ['Eagle', 'Penguin', 'Tiger', 2017, 2018, 'Pigeon']
pythonpython programminglist data structure

Related Examples