Discuss / Python / 作业

作业

Topic source

goodspb

#1 Created at ... [Delete] [Delete and Lock User]
def is_palindrome(n):
   str_n = str(n)
   len_n = len(str_n)
   count = 0
   while count < len_n :
      if str_n[count:count+1] != str_n[len_n-count-1:len_n-count] : 
         return False
      count = count + 1
   return True;

感觉有点繁琐。


  • 1

Reply