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

时间:2018-11-03 22:44:44   收藏:0   阅读:225
 s = input(请输入一个字符:)
 if a <= s <= z:
     print(chr(ord(s) - 32))
 elif A <= s <= Z:
     print(chr(ord(s) + 32))
 else:
   print(‘s‘)

 

原文:https://www.cnblogs.com/chengxubo/p/9902311.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!