Lists in Python Like an array, List is a collection of data (of different data types). Lists are specified using square brackets. Lists are very helpful when working with data in Python. Below are some of the features of Lists. Lists can hold data of different data types. Lists can be amended. Data in the list can be accessed by using index. Lists can hold duplicate data. In this post, we will see how to access, append or remove the data in Lists and how to use different list methods. Creating List in Python Before we go on to different methods of lists, Let us see How to create a List in Python ? Like any other variable in python, List is created when the data is assigned with in square brackets. In the above example, 'a_list' is created with the data and 'b_list' is created with no data. Accessing the data in a List How to access the individual elements of Lists? Elements in the Lists can be accessed using index. Index starts with '0' and incremented by
Code with PR - Technical tips on coding and more...