python 输入一个字母 如果它是一个小写英文字母 则把它转换为对应的大写字母输出?

如题所述

char1 = input("请输入一个小写英文字母:");
if(ord(char1) >= ord('a') and ord(char1) <= ord('z')):
    print(char1.upper());
else:
    print("不是小写字母!");

温馨提示:答案为网友推荐,仅供参考
第1个回答  2021-11-01
char1 = input()
if(ord(char1) >= ord('a') and ord(char1) <= ord('z')):
print(char1.upper())
else:
print(char1)
第2个回答  2019-04-23
Emm我不是很明白你的意思追问

就是 输入a 计算机要输出A 用python编

追答

好吧,理解能力有限

相似回答