import sys x = str(input()) is_right = True for i in x: if ord(i) >= 97 and ord(i) <= 122: pass else: is_right = False if is_right == True: print(x[::-1]) else: pass
【目的】
小写字母的ASCII码范围为:97~122(97+26-1=122)
ASCII码表:https://www.asciim.cn/
import sys x = str(input()) is_right = True for i in x: if ord(i) >= 97 and ord(i) <= 122: pass else: is_right = False if is_right == True: print(x[::-1]) else: pass
【目的】
小写字母的ASCII码范围为:97~122(97+26-1=122)
ASCII码表:https://www.asciim.cn/