Skip to content

Instantly share code, notes, and snippets.

@MuddyBootsCode
Last active November 19, 2016 11:51
Show Gist options
  • Save MuddyBootsCode/ce0795745c58e9296741e2fcf026fd82 to your computer and use it in GitHub Desktop.
Save MuddyBootsCode/ce0795745c58e9296741e2fcf026fd82 to your computer and use it in GitHub Desktop.
Identify a Palindrome
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