Question Detail

COS 102 Python strings Objective Question

Question

If you want to determine how many characters are in a string, including spaces and punctuation, which built-in function would you use?
Options
A <code>count()</code>
B <code>size()</code>
C <code>length()</code>
D <code>len()</code>
Correct Answer
Correct Answer

Option D is the correct answer.

Detailed Explanation

The 'The len() Function' section (page 8) states: 'The len() function counts the number of characters in a string.'

Hint

The name of the function is an abbreviation for 'length'.

Question Info