how to check if a string contains letters o number in python code example
Example 1: python how to check if string contains only numbers
print("012345".isdecimal())
OUTPUT
True
print("a12345".isdecimal())
OUTPUT
False
Example 2: check how many letters in a string python
#use the built in function len()
len("hello")
#or you can count the characters in a string variable
a = "word"
len(a)