Learn practical skills, build real-world projects, and advance your career

9-palindrome-number

Given an integer x, return true if x is a palindrome, and false otherwise.

!pip install jovian --upgrade --quiet
import jovian

brute force:

  1. loop through each input digit backwards and add each result to a new string.
  2. compare new string to old input integer as string
  3. leading zeros in decimal integer literals shouldn't be an issue since the input is specifically an integer
def isPalindrome(x):
    x2 = str(x)[::-1]
    if x2 == str(x):
        return True
    else:
        return False