check if a number is a palindrome
def ispalindrome ( x ) : NEW_LINE INDENT ans , temp = 0 , x NEW_LINE while temp > 0 : NEW_LINE INDENT ans = 10 * ans + temp % 10 NEW_LINE temp = temp // 10 NEW_LINE DEDENT return ans == x NEW_LINE DEDENT