In Python, you can find the length of an array (or a list, which is Python’s version of an array) using the len()
function.
Here’s an example:
my_list = [1, 2, 3, 4, 5]
length = len(my_list)
print(length)
This will output:
5
This is because the list my_list
contains 5 elements. The len()
function works for other data types as well, such as strings, tuples, and dictionaries.