Skip to content

Instantly share code, notes, and snippets.

@maq796113
Created September 15, 2023 11:03
Show Gist options
  • Save maq796113/62ffff552a370bd2284750c622be9857 to your computer and use it in GitHub Desktop.
Save maq796113/62ffff552a370bd2284750c622be9857 to your computer and use it in GitHub Desktop.
def int_palindrome(num: int):
_list = []
i = 1
int_length = int(math.log10(num)) + 1
size_zeroes = 10**int_length
for j in range(size_zeroes):
if i >= size_zeroes:
break
digit = (num%(10*i))//i
_list.append(digit)
i *= 10
return _list[:] == _list[::-1]
#driver code
if __name__ == "__main__":
print(int_palindrome(12345))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment