Discuss / Python / 笨鸟还是用最麻烦的方式去实现了,慢慢进步吧

笨鸟还是用最麻烦的方式去实现了,慢慢进步吧

Topic source
def strsanme(a):
    L=str(a)
    loc=len(L)/2
    if loc<1:
        return True
    else:
        index=0
        loc =int(loc)
        while index <=loc and L[index]==L[len(L)-1-index]:
            index=index+1
        index=index-1
        if index==loc:
            return True
        else:
            return False
output = filter(strsanme, range(1, 1000))
print('1~1000:', list(output))

  • 1

Reply