+ 1

In python when we calculate the length of char count from zero or one !?

Are the length of char different between nums in python when we calculate them

20th Jun 2019, 7:20 AM
Esraa Mohammed
Esraa Mohammed - avatar
2 odpowiedzi
+ 6
Bro when we calculate the length of a char or list , we count from zero For example : List=[0,1,2,3,4,5] len(list) Output 6 str="Hii" len(str) == 3 Str="hello" len(Str)==5 Thanks
20th Jun 2019, 7:41 AM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
0
indexes in ordered iterables are always counted from 0. lengths of any iterables are always counted from 1.
20th Jun 2019, 9:29 AM
Seb TheS
Seb TheS - avatar