0

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
Berny
  • 44
  • 4

1 Answers1

1

You can try using the length function:

len(arr1)
Nazim Kerimbekov
  • 4,712
  • 8
  • 34
  • 58
EatSleepCode
  • 452
  • 7
  • 21