Advertisement
LorenKPetrov

A very simple Palindrome checker

Nov 18th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. print "What is the word you would like to check?" # Asks the user what word they would like to check.
  2. x = raw_input("> ") # User inputs the word.
  3. y = x[::-1] # reverses the string.
  4. if x.lower() == y.lower(): # checks if the strings match, this way it handles case sensitivity.
  5.     print x,"is a palindrome!" # prints it is a palindrome
  6. else: # and if it's not a palindrome
  7.     print x,"is not a palindrome!" # it will print it is not a palindrome!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement