Here I have been trying to remove the palindromic words from the given string. This is my code:
lis = list(text.split(" "))
newlis=[]
for i in range(len(lis)):
if (lis[i] != lis[i][::-1]):
newlis.append(lis[i])
print(newlis)
If the input is
Nair speaks malayalam
I get the output as
['Nair', 'speaks', 'Malayalam']
Why the palindromic words aren't removed?