Created
September 15, 2023 11:03
-
-
Save maq796113/62ffff552a370bd2284750c622be9857 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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