(3程序基本结构)输入一个5位数字,判断这个数字是不是回文数

样例输入

12345

 

样例输出

不是回文数

 

样例输入

12321

 

样例输出

是回文数

样例输入

1321

 

样例输出

输入有误

 

解题代码

str=str(input())
if(len(str)!=5):
  print("输入有误")
else:
  a=0
  if str[0]==str[-1] and str[1]==str[-2]:
   a=1
  if(a==0):
    print("不是回文数")
  else:
    print("是回文数")

 

posted @ 2022-09-21 17:44  淡淡的晓山横雾  阅读(185)  评论(0)    收藏  举报