Question Detail
Question
What would be the output of
len("Hello, Python!")?
Correct Answer
Option B is the correct answer.
Detailed Explanation
Counting each character: H(1), e(2), l(3), l(4), o(5), ,(6), (space)(7), P(8), y(9), t(10), h(11), o(12), n(13), !(14). There are 14 characters in total, including the comma, space, and exclamation mark.
Hint
Remember that
len() counts *all* characters in the string, including punctuation and spaces.