Last active
November 17, 2015 05:55
-
-
Save akayj/c8071a9d2a8236d4fe67 to your computer and use it in GitHub Desktop.
Palindrome_2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
def palindrome(s): | |
a = 0 | |
b = len(s) - 1 | |
while a < b: | |
if s[a] != s[b]: | |
return False | |
a, b = a+1, b-1 | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Detect a string or unicode string is a palindrome.