Last active
November 19, 2016 11:51
-
-
Save MuddyBootsCode/ce0795745c58e9296741e2fcf026fd82 to your computer and use it in GitHub Desktop.
Identify a Palindrome
This file contains 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
userWord = (input('Let\'s see if you know what a Palindrome is. Please give me a word you think is a Palindrome.\n')) | |
anna = [item for item in userWord] | |
while anna != anna[::-1]: | |
print(userWord + ' is not a Palindrome.') | |
userWord = input() | |
anna = [item for item in userWord] | |
print(userWord + ' is a Palindrome!') | |
''' | |
could also use | |
anna = anna.find(anna[::-1]) which will return a 0 if word matches and a -1 if it does not | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment