Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def pal(n):
- digits = int(math.log10(n)) + 1
- if digits == 1 or n == 0:
- return True
- last = n % 10
- first = n // (10 ** (digits - 1))
- if first != last:
- return False
- return pal((n // (10 ** (digits - 1))) % 10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement