What does the len() function return for a string?

0152

The len() function returns the number of characters in a string. For example:

string = "Hello, World!"
length = len(string)
print(length)  # Output: 13

In this example, the length of the string "Hello, World!" is 13, including spaces and punctuation.

0 Comments

no data
Be the first to share your comment!