Skip to content

Instantly share code, notes, and snippets.

@dluciano
Created May 23, 2017 18:34
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 dluciano/e4593d396365298a0cea030916553855 to your computer and use it in GitHub Desktop.
Save dluciano/e4593d396365298a0cea030916553855 to your computer and use it in GitHub Desktop.
Palindrome - Python
def palindrome(text):
M = len(text)
if(M <= 0):
return False
i = 0
text = text.lower()
while(i < M):
if(text[i] != text[M - 1 - i]):
return False
i = i + 1
return True
n = "rotator"
isP = palindrome(n)
print(isP)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment