python 输入一个字符,是小写转换为大写,大写转换为小写,其他字符原样输出

 s = input('请输入一个字符:')
 if 'a' <= s <= 'z':
     print(chr(ord(s) - 32))
 elif 'A' <= s <= 'Z':
     print(chr(ord(s) + 32))
 else:
   print('s')

猜你喜欢

转载自www.cnblogs.com/chengxubo/p/9902311.html
今日推荐