Discuss / Python / 作业,供参考(只用到之前学习的内容)

作业,供参考(只用到之前学习的内容)

Topic source

def fil(n): L = [] t = str(n) for m in t: L.append(m) x, y = 0, -1 while L[x] == L[y]: x, y = x + 1, y - 1 if x < len(L): continue else: x, y = 0, 1 return True return False

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


  • 1

Reply