Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

characters python

#check if a is uppercase,lowercase,other character or digits
a=int(input('enter'))
if chr(a)>'A' and chr(a)<'Z' : #here 'A' is 65 and 'Z' is 91
        print('upper case',a,'and ascii code',chr(a))
elif chr(a)>'a' and chr(a)<'z' : # here 'a' is 97 and 'z' is 122
        print('lower case',a, 'and ascii code is',chr(a))
elif chr(a)>'0' and chr(a)<'9' :# here '0' is 48 and '9' is 57
        print('digits',a,'and ascii code is',chr(a))
else:
        print('other special',a,'andcharacter ascii code ',chr(a))
 
PREVIOUS NEXT
Tagged: #characters #python
ADD COMMENT
Topic
Name
7+2 =