Discuss / Python / 笨办法 也要搞明白,先前的答安虽然能出结果,但逻辑有问题

笨办法 也要搞明白,先前的答安虽然能出结果,但逻辑有问题

Topic source

报三春晖

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

def palindrome(n): L=list(str(n)) a=0 while a<(len(L))//2: if L[a]!=L[-a-1]: return False a=a+1 return True

output = filter(palindrome, range(1,1000)) print(list(output))


  • 1

Reply