How can we obtain the length of a list in Python?
In Python, you can use the built-in function len() to get the length of a list. Here is a simple example:
my_list = [1, 2, 3, 4, 5]
length = len(my_list)
print(length)
The code above will output the length of the list my_list, which is the number of elements in the list. The len() function can also be used for other iterable objects such as strings, tuples, etc., with similar usage.