Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Intuitive solution in Clear category for Integer Palindrome by dig
def int_palindrome(number: int, B: int) -> bool:
# your code here
residus=[]
quo=1000
while quo!=0:
quo= number//B
res= number%B
number=quo
residus.append(res)
a=residus.copy()
a.reverse()
return residus == a
print("Example:")
print(int_palindrome(455, 2))
# These "asserts" are used for self-checking
assert int_palindrome(6, 2) == False
assert int_palindrome(34, 2) == False
assert int_palindrome(455, 2) == True
print("The mission is done! Click 'Check Solution' to earn rewards!")
Feb. 11, 2023
Comments: