Character Classification based on ASCII value

SingleCharacter = input("Enter a character:",)
Character = ord(SingleCharacter)
# ord --> Convert a string to ASCII value
if Character > 0 and Character <= 31:
    print("ASCII value", Character," is a control character")
elif Character >= 48 and Character <= 57:
    print("ASCII value", Character,"  is a character is a digit")
elif Character >= 65 and Character <= 90:
    print("ASCII value", Character,"  is a uppercase letter")
elif Character >= 97 and Character <= 122:
    print("ASCII value", Character,"  is a lowercase letter")
else:
    print("ASCII value", Character," is a Symbol")

No comments: