You can count the length of the string using function len
. str
can contain all chars and letters. Try the following code:
word = input("Waiting for input: ")
print("Found "+str(len(word))+" letters!")
Testing it:
Waiting for input: hello
Found 5 letters!
Testing it with numbers and other chars:
Waiting for input: hello123!@#
Found 11 letters!
2
solved Analyzing strings in Python [closed]