Created
February 28, 2021 16:10
-
-
Save cristinelpopescu/d839e1164000484f1f56e55d3293d028 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.
A palindrome is a string that reads the same forwards and backwards.
This file contains hidden or 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
phrase=input("Please enter a phrase or word: ") | |
phrase=str(phrase) | |
reverse= phrase[::-1] | |
print(reverse) | |
if phrase == reverse: | |
print("This phrase or word is a palindrome") | |
else: | |
print("This phrase or word is not a palindrome") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment