Skip to content

Instantly share code, notes, and snippets.

@gooooloo
Created October 26, 2017 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gooooloo/fc7acbf61c38f2b93252909c8d645e42 to your computer and use it in GitHub Desktop.
Save gooooloo/fc7acbf61c38f2b93252909c8d645e42 to your computer and use it in GitHub Desktop.
判断一个整数是不是回文数
def main(a):
a = abs(a)
b = a
c = 0
while b > 0:
c = c * 10 + b % 10
b //= 10
print(c == a)
if __name__ == '__main__':
main(0)
main(3)
main(33)
main(343)
main(3443)
main(35)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment