Skip to content

Instantly share code, notes, and snippets.

@ehedaoo
Created May 9, 2017 20:17
Show Gist options
  • Save ehedaoo/8a6166a3a7b9a1fbcb0642ceb0baa71f to your computer and use it in GitHub Desktop.
Save ehedaoo/8a6166a3a7b9a1fbcb0642ceb0baa71f to your computer and use it in GitHub Desktop.
Ask the user for a string and print out whether this string is a palindrome or not.
# Ask the user for a string and print out whether this string is a palindrome or not.
raw = str(input("Enter a string: "))
raw.replace(" ", "")
set1 = str.lower(raw[::-1])
set2 = str.lower(raw[0::])
if set2 == set1:
print("Palindrome")
else:
print("Not a palindrome")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment