Computer Science

What will be the output of the following code?

str1= "I love Python."
strlen = len(str1)
print(strlen)
  1. 9
  2. 29
  3. 14
  4. 3

Python String Manipulation

3 Likes

Answer

14

Reason — The len() function returns the length of the string, which includes all characters, spaces, and punctuation. For the string "I love Python.", the length is 14 characters. Thus, len(str1) returns 14.

Answered By

3 Likes


Related Questions