编写一个函数接收输入一个字符,判断这个字符是数字,还是大写字母,还是小写字母,还是其它符号(ASCII码)

def my_function(str):

if 48<=ord(str)<=57:

print("%s是数字字符"%str)

elif 65<=ord(str)<=90:

print("%s是大写字母"%str)

elif 97<=ord(str)<=122:

print("%s是小写字母"%str)

else:

print("%s是其他符号"%str)

my_function(“a”)

猜你喜欢

转载自blog.csdn.net/weixin_43290492/article/details/90150147
今日推荐