Created
September 6, 2017 12:45
-
-
Save srahuliitb/7bad06e7b9daa4ada112fdd77d4871a4 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
| string = raw_input("Enter a string: ") | |
| reverse_string = string[::-1] | |
| if string == reverse_string: | |
| print "The given string is a palindrome." | |
| else: | |
| print "The given string is NOT a palindrome." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment