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("输入的为非数字")
文章标签 list倒置 python python 文章分类 Python 后端开发
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("输入的为非数字")
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M