Skip to content

Instantly share code, notes, and snippets.

@dogac00
Created March 13, 2018 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogac00/1c63f187c62fe32c7a94a1ac3b4aff55 to your computer and use it in GitHub Desktop.
Save dogac00/1c63f187c62fe32c7a94a1ac3b4aff55 to your computer and use it in GitHub Desktop.
Palindrome chain length @codewars
def check_palindrome(a):
return str(a) == str(a)[::-1]
def palindrome_chain_length(n):
steps=0
while(check_palindrome(n)!=True):
n=n+int(str(n)[::-1])
steps+=1
return steps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment