List and Tuple
Learn about the list and tuple data structures that are available in Python. Both have different advantages and are used in different scenarios.
Lists
Lists are containers that are used to store multiple data elements. Lists have an order of elements and have a count of elements. These ordered elements can be accessed by the index. The index order starts from 0 and goes the length of the list.
List creation
A list can be created by using brackets, []
or within the list()
function.
Press + to interact
pcodes = ['SC1','SF5','BH3']print(pcodes)print(type(pcodes))
The above code creates a list of three elements. The list’s object class is list
. We can ...