Skip to content

Instantly share code, notes, and snippets.

@srahuliitb
Created September 6, 2017 12:45
Show Gist options
  • Select an option

  • Save srahuliitb/7bad06e7b9daa4ada112fdd77d4871a4 to your computer and use it in GitHub Desktop.

Select an option

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.)
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