try: a = input("请输入一个数:") if int(a) > 0: b = a[::-1] print(b) else: b = "-"+ a[-1:-len(a):-1] print(b) except Exception as e: print("输入的为非数字")
try: a = input("请输入一个数:") if int(a) > 0: b = a[::-1] print(b) else: b = "-"+ a[-1:-len(a):-1] print(b) except Exception as e: print("输入的为非数字")