def is_palindrome(n): f=str(n) print("前%s后%s"%(f[0],f[-1])) if len(f)==1: return True return f[0]!=f[-1] output = filter(is_palindrome, range(1, 999)) print(list(output)) 另外问句我代码 len(f)==1?f[0]!=f[-1]:True 哪里错了?
Sign in to make a reply
冲天魔王
def is_palindrome(n): f=str(n) print("前%s后%s"%(f[0],f[-1])) if len(f)==1: return True return f[0]!=f[-1] output = filter(is_palindrome, range(1, 999)) print(list(output)) 另外问句我代码 len(f)==1?f[0]!=f[-1]:True 哪里错了?