Discuss / Python / 交作业

交作业

Topic source

叫小小兽

#1 Created at ... [Delete] [Delete and Lock User]
def is_tm(x):
    if x<10:
        return False
    s=str(x)
    l,i=len(s)//2,1
    for n in s[:l]:
        if n!=s[-i]:
            return False
        i+=1
    return True

tm=filter(is_tm,list(range(1000)))
print(list(tm))

  • 1

Reply