Skip to content

Instantly share code, notes, and snippets.

@shamikalashawn
Created February 6, 2017 22:56
Show Gist options
  • Save shamikalashawn/67c536aa8302a3955336f6b83920169a to your computer and use it in GitHub Desktop.
Save shamikalashawn/67c536aa8302a3955336f6b83920169a to your computer and use it in GitHub Desktop.
Two words are compared. If one word is the reverse of the other, the function returns "True". Otherwise the function returns "False".
def is_reverse(word1, word2):
if len(word1) != len(word2):
return False
i = 0
j = len(word2)-1
while j > -1:
print (i, j) #print here
if word1[i] != word2[j]:
return False
i += 1
j -= 1
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment