text = "Python Programming"
length = len(text)
print(length)
#source code --> clcoding.com
Explanation:
Define the Variable:
text = "Python Programming" stores the string "Python Programming" in the variable text.
Find the Length:
len(text) calculates the total number of characters in the string, including spaces.
"Python Programming" has 18 characters (including the space between words).
Print the Length:
print(length) outputs the length of the string.
Output:
18
0 Comments:
Post a Comment