+ 1

# Help me!!

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

8 Antworten

+ 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

+ 3

BroFar that's mean length starts from 1??

+ 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]

+ 2

Rouza TN that is the difference between indexing and counting. Indexes start at 0. Counting (e.g., length) starts from 1.

+ 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.

+ 1

Precious Ayano cz i started it from 0😅

+ 1

Olá pessoal

0

I don’t understand were you expecting a different number