Python program to print the number of elements present in an array

bookmark

#Initialize array     
arr = [1, 2, 3, 4, 5];     
     
#Number of elements present in an array can be found using len()    
print("Number of elements present in given array: " + str(len(arr)));     


Output:

Number of elements present in given array: 5