Source Code
ch=input("Enter a character: ")
if ch.isalpha():
print(ch, "is an alphabet")
elif ch.isdigit():
print(ch, "is a digit")
elif ch.isalnum():
print(ch, "is alphabet and numeric")
else:
print(ch, "is a special symbol")
OUTPUT
Enter a characterA
A is an alphabet
Enter a character$
$ is a special symbol
Enter a characterGK2
GK2 is alphabet and numeric
Enter a character9
9 is a digit
No comments:
Post a Comment