1The isalpha() method returns True if all the characters are alphabet letters (a-z).
2
1# Valid alphabet
2text1= "HelloWorld"
3print(text1.isalpha())
4
5# contains whitespace
6text2 = "Hello World"
7print(text2.isalpha())
8
9# contains Special Character
10text3 = "HelloWorld!!"
11print(text3.isalpha())
12
13
14# contains Alphanumeric
15text3 = "Hello123"
16print(text3.isalpha())
1username = input("Choose a username:")
2
3if username.isalnum() == True:
4 print("The entered username is ", username)
5else:
6 print("Please enter a valid usernameSrin.")