Explain why the output for len() string method exercise is 14


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-python/lessons/strings--console-output/exercises/string-methods?action=lesson_resume

<In what way does your code behave incorrectly? Include ALL error messages.>

I am not getting an error. I would just like an explanation as to why the interpreter prints 14 for this exercise. Does it also count the space as part of the characters?

<What do you expect to happen instead?>

Output = 13

```python

parrot = "Norwegian Blue"
print len(parrot)

Output is 14

<do not remove the three backticks above>

#2

Yes it does. Space is still a character with a length of 1.


#3

It makes sense now. Thank you!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.