Array length in python without Len() function
Here you will get the program code to find array length in python without len() function. This program can be perform by using len() function in python and without len() function in python. Here we will perform this program without len() function.
Example to Find array length in python without Len()
1 2 3 4 5 6 7 8 9 10 11 12 | # sample array my_array = [12, 78, 53, 44, 50, 46, 26] # Initialize a counter length = 0 # Iterate array and count elements for _ in my_array: length += 1 # Print length print("Length of array is :", length) |
Output
Length of array is : 7
Check out our other Python examples