Discuss / Python / [::-1]才是这Python精神吧

[::-1]才是这Python精神吧

Topic source

Rainsho

#1 Created at ... [Delete] [Delete and Lock User]

看到大神给出的str(n)==str(n)[::-1] 觉得其他写法都太小儿科了,这才是Python的理念吧 牛逼!

小白的答案如下,这完全可以那其他语言来写。。。 def rev(n): n=str(n) i=-1 t=True for x in n: t=t & (x==n[i]) i=i-1 return t


  • 1

Reply