第三十题

题目:
一个5位数,判断它是不是回文数。即12321是回文数,个位与万位相同,十位与千位相同。

def huiwen(num):
    l = str(num);
    index = True
    if len(l) % 2 == 0: index = False
    for i in range(0,len(l)//2):
        if l[i] != l[len(l)-1-i]:
            index = False
    return index

c=huiwen(78987)
posted @ 2019-10-07 20:11  Franzqing  阅读(140)  评论(0编辑  收藏  举报