Easy Python Palindrome Programming Help

Easy Python Palindrome Programming Help
0.0 0


So basically the question:
Write a program that determines whether phrases are palindromes or not.

gnu dung
O Geronimo, no major ego.
Ten animals we slam in a net.
Harpo: not on Oprah?

Should produce this:
Yes "rotor"
Yes "gnu dung"
No "O Geronimo, no major ego."
No "Ten animals we slam in a net."
Yes “Harpo: not on Oprah?”

My code is this:

f=f in range (0,lp,1)
b=b in range (lp,0,-1)
if p[f]==p[b]:
print(“No” ,p)

I get this error when I enter “tacocat” as test data.

Traceback (most recent call last):
File “python”, line 1, in
File “”, line 1, in
NameError: name ‘tacocat’ is not defined

I’m not sure why. Help?


There’s a reference to “tacocat” in your first line (outside of what you pasted here). You have to define(create the variable or function) it before using it.


I don’t get it? I inputted tacocat as test data.


Use raw_input() instead of input.

More information: https://stackoverflow.com/questions/21122540/input-error-nameerror-name-is-not-defined