def reverse(string):
return string[::-1]
def isPalindrome(string):
temp=reverse(string)
if temp==string:
return True
else:
return False
string='tanmay' # input('enter a word')
ans=isPalindrome(string)
if ans==1:
print' Yes palindrome'
else:
print' no its not a palindrome'
if I ask for an input from the user the error what I got was Traceback (most recent call last):
File "C:/Python27/prac06-2.py", line 10, in <module>
string=input('enter a word')
File "<string>", line 1, in <module>
NameError: name 'tanmay' is not defined
but when I enter a string by myself the program is executed successfully