Question Detail
Question
Which of the following characters are counted by the
len() function when determining the length of a string?
Correct Answer
Option C is the correct answer.
Detailed Explanation
The 'The len() Function' section (page 8) explicitly states: 'Crucial: It counts spaces and punctuation marks too!' The example
print(len("Hello World!")) which yields 12 (10 letters + 1 space + 1 exclamation mark) further proves this.
Hint
Look for the 'Crucial' note under the
len() function explanation.