0
len function
why does print(len(["hi","lo","forth"])) output 3 why does it not start at 0
3 Respuestas
+ 3
Because its not index.
3 inches is three inches, not 2 inches with an invisible inch.
Also a length of 0 is an empty list.
A length of 1 has 1 item in it
+ 1
len mean length
and the length is startling from
first
second
third
...etc
but when we need to access to the value in the array we start count from zero
but this is not change that the array contains 3 values
0
Len just counts the mount of items in the list. (The counting starts at 1 not 0.)