I'm a beginner in python and needed to do a program that checks if a given word is palindromous. The program would then be:
#encoding: utf-8
palavra = input ('Palavra: ')
if palavra == palavra[::-1]:
print ("%s é palindrome" %palavra)
else:
print ("%s não é palindrome" %palavra)
The problem is that when I try to open the program through the terminal (use ubuntu 16.04), the following error appears:
Traceback (most recent call last):
File "palindrome.py", line 3, in <module>
palavra = input ('Palavra: ')
File "<string>", line 1, in <module>
NameError: name 'ana' is not defined
And I have no idea what that means. This has happened whenever I need to work as string type variables in python, does anyone know why this happens?