Lists are Python’s most flexible ordered collection object type. It can also be referred to as a sequence that is an ordered collection of objects that can host objects of any data type, such as Python Numbers, Python Strings and nested lists as well. Lists are one of the most used and versatile Python Data Types. In this module, we will learn all about lists in order to get started with them.
Now, let’s create a list with different data types:
Now, let’s do some operation on the list we created:
Fetching the first element from the list:
Adding an element while removing the other:
The below line of code will return the length of the list:
This will return the list in reversed order.
Now, we will further look at Python Sets.