Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save demian711/f72b9fac4f94a8a610b2d16750603cbf to your computer and use it in GitHub Desktop.
Save demian711/f72b9fac4f94a8a610b2d16750603cbf 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.
string = str(raw_input("Give me a string: "))
def reverse_string(to_be_reversed):
return to_be_reversed[::-1]
reversed = reverse_string(string)
if reversed == string:
print "%s is palindrome!!!" % string
else:
print "%s is not palindrome" % string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment