Created
May 9, 2017 20:17
-
-
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.
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
# 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