The user enters a word. The program must compare the words and inform you whether or not it is a palindrome. Here is what I have so far:
string = list((input("Enter a word: ")))
print (string)
x = string.reverse()
print(x)
if x == string:
print "Your word is a palindrome"
else:
print "Your word is not a palindrome"
From what I have read on stackoverflow, the List.reverse() only reverses the sequence in place and does not return it. Why can I not assign the reversed list to a variable and then print?
This is what it returns when I enter a palindrome:
Enter a word: 'ror'
['r', 'o', 'r']
None
Your word is not a palindrome