+ 1

Help me!!

movie = "Avatar" print(len(movie)) Could u plz explain it to me why the output is 6??

6th Aug 2024, 5:11 PM
Rouza TN
Rouza TN - avatar
8 Respuestas
+ 6
How many letters are in Avatar Rouza A = 1 v = 2 a = 3 t = 4 a = 5 r = 6 So Avatar has 6 letters
6th Aug 2024, 5:14 PM
BroFar
BroFar - avatar
+ 3
BroFar that's mean length starts from 1??
7th Aug 2024, 4:37 PM
Rouza TN
Rouza TN - avatar
+ 2
Rouza TN as far as len function yes it starts at 1 and let's say x = "its funny" the len will include whitespaces when counting so len(x) == 9 however in a for or while loop the first character or number in x is x[0]
7th Aug 2024, 5:56 PM
BroFar
BroFar - avatar
+ 2
Rouza TN that is the difference between indexing and counting. Indexes start at 0. Counting (e.g., length) starts from 1.
7th Aug 2024, 8:26 PM
Brian
Brian - avatar
+ 1
🤪The length of the movie "Avatar" is 162 minutes. If you divide it into attention span segments of 27 minutes (162/27) then you get 6.
7th Aug 2024, 12:47 PM
Brian
Brian - avatar
+ 1
Precious Ayano cz i started it from 0😅
7th Aug 2024, 4:38 PM
Rouza TN
Rouza TN - avatar
+ 1
Olá pessoal
7th Aug 2024, 7:38 PM
Wimbo News
Wimbo News - avatar
0
I don’t understand were you expecting a different number
6th Aug 2024, 8:41 PM
Precious Ayano
Precious Ayano - avatar