My code for reversing a string works on other websites but is not working on my ubuntu machine on vim.
wrd=input("Please enter a word ")
wrd=str(wrd)
rvs=wrd[::-1]
print(rvs)
if wrd == rvs:
print("This word is a palindrome")
else:
print("This word is not a palindrome")
It gives the error:
python hannah1.py
Please enter a word hannah
Traceback (most recent call last):
File "hannah1.py", line 1, in <module>
wrd=input("Please enter a word")
File "<string>", line 1, in <module>
NameError: name 'hannah' is not defined