Is there a Python function for checking the length of an array?

49 Views Asked by At

I need to count the number of items in an array. Is there a function to do it? I can do it with a for loop but if there was a function it would be 100 times easier.

arr1 = [10, 12, 87, 36, 11, 9, 73]
for each in arr1:
    x += 1
 print x
1

There are 1 best solutions below

0
On BEST ANSWER

You can try using the length function:

len(arr1)