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
397 B

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