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))
Sign in to make a reply
艾米与艾米