- Lists are the most versatile data structures in Python since they are mutable, and their values can be updated by using the slice and assignment operator.
- Python also provides append() and insert() methods, which can be used to add values to the list.
============================================================================
Program
list = [1, 2, 3, 4, 5, 6]
print(list)
print(" ")
# It will assign value to the value to the second index
list[2] = 10
print(list)
print(" ")
# Adding multiple-element
list[1:3] = [89, 78]
print(list)
print(" ")
# It will add value at the end of the list
list[-1] = 25
print(list)
print(" ")
OUTPUT:
[1, 2, 3, 4, 5, 6]
[1, 2, 10, 4, 5, 6]
[1, 89, 78, 4, 5, 6]
[1, 89, 78, 4, 5, 25]