A collection of implementations of common algorithms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

19 lines
387 B

#! /usr/bin/env python2
# check if a word is palindromic without reversing it
def isPalindrome(word):
end = len(word)
start = 0
foo = True
while start < end+1:
left = word[start]
right = word[end-1]
if left != right:
foo = False
break
start += 1
end -= 1
return foo
print isPalindrome("wwaabbaawwz")