Discuss / Python / 感觉自己写的很麻烦,但是好歹是自己写出来的,供大家喷一波

感觉自己写的很麻烦,但是好歹是自己写出来的,供大家喷一波

Topic source
import math

def int2list(num):
    s = str(num)
    L = []
    for x in s:
        L.append(x)
    return L

def is_palindrome(n):
    L = int2list(n)
    if len(L) == 1:
        return True
    else:
        n = 0
        while n<= math.floor(len(L)/2)-1:
            if L[n] != L[len(L)-1-n]:
                return False
            n = n + 1
        return True

浪过扬帆

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

我先喷为敬,哇哇哇哇哇哇


  • 1

Reply