python3练习100题——030

这周开始,要重新振作一点吧!

如果每天都想着消费升级,而不是想着如何投入时间精力让自己进步,未来根本就看不到希望。

我想要更认真的活着

live wild

 

原题链接:http://www.runoob.com/python/python-exercise-example30.html

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

我的代码:

def fun():
    num=input("please enter a number:")
    if num==num[::-1]:              #利用str的[::-1]
        print("it is a palindromic number")

 

posted @ 2018-06-18 10:08  Drifter_y  阅读(503)  评论(0编辑  收藏  举报