Python Dynamic Array ( Vectors or ArrayList or List ) implementation

Author: Al-mamun Sarkar Date: 2020-03-28 13:45:26

Python Dynamic Array  ( Vectors or ArrayList or List ) implementation. We can implement a dynamic array using the python build-in data type list. 

Code:

py_list = ['Mathematics', 'English', 1987, 2010]
my_list = [1, 2, 3, 4, 5, 6, 7]
print("py_list[0]: {}".format(py_list[0]))
print("my_list[1:5]: {}".format(my_list[1:5]))

del py_list[2]
print(py_list)

 

Output:

py_list[0]: Mathematics
my_list[1:5]: [2, 3, 4, 5]
['Mathematics', 'English', 2010]