My base text is asking to be defined but I can't work out why.
I've tried changing it from list to string.
My code is:
text_str = input("What is your text: ")
text_list = list(text)
text_list_reversed = text_list.reverse()
text_str_reversed = str(text_list_reversed)
if text_str_reversed == text_str:
print("Your word is a palindrome")
else:
print("Your original was",text_str)
print("Your word reversed is",text_str_reversed)
Error code:
What is your text: owo
Traceback (most recent call last):
File "C:/Users/sambi.LAPTOP-UU5B18TJ/OneDrive/Documents/Python/My Code/School Stuff/Palindrome checker.py", line 1, in <module>
text_str = input("What is your text: ")
File "<string>", line 1, in <module>
NameError: name 'owo' is not defined
My excepted result would be for it to tell me it's a palindrome but instead it's spitting out a message saying that "owo" needs to be defined.