len function | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

len function

why does print(len(["hi","lo","forth"])) output 3 why does it not start at 0

7th Jul 2020, 6:22 PM
Jah Revelo
Jah Revelo - avatar
3 ответов
+ 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
7th Jul 2020, 6:30 PM
Slick
Slick - avatar
+ 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
7th Jul 2020, 6:36 PM
‎Abdel rahman Abdaldeen
‎Abdel rahman Abdaldeen - avatar
0
Len just counts the mount of items in the list. (The counting starts at 1 not 0.)
1st Oct 2020, 7:55 PM
mä vaan
mä vaan - avatar