Answer to Question #288042 in Python for rahul

Question #288042

Write a python function that will take any integer and return true or false if the number is palindrome using loop. Call this function in main body of the program and verify your output by printing the value returned.


1
Expert's answer
2022-01-16T17:51:11-0500
def isPalindrome(x):
    arr = []
    while x!= 0:
        arr.append(x % 10)
        x //= 10
    return arr == arr[::-1]

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS