Main problem of your program (twice):
In the for loop, go through the same list, from which you delete members from it and change it .
It is necessary to go through a copy of the list (which you can simply get by creating a segment with all the elements , that is, adding [:] for its name.)
The second problem is that it is impossible to apply the .reverse() method to a string - you first need to translate it into a list of characters (for example, the list() function).
But the third is that your program still works after entering the wrong number of words, only it gives a message about it. It is then necessary (and again) to ask the question (in the while ) until the word count is correct.
I reworked your program a little bit and used more convenient names for variables, only with lowercase letters - see PEP 8 - a guide to writing Python code - and put spaces somewhere (see there).
while True: text = input("Ведите слова: ") words = text.split() if len(words) > 20: print("Введите меньше слов.") print() continue # прекратить, а снова задать вопрос elif len(words) < 2: print("Введите больше слов.") print() continue break # прекратить весь цикл last_word = words[-1][:-1] # [:-1] для удаления точки words = words[:-1] # последнее слово уже не надо for word in words[:]: # [:] строит копию списка if word == last_word: words.remove(word) for word in words[:]: # [:] строит копию списка letters = list(word) letters.reverse() reversed_word = "".join(letters) if word != reversed_word: words.remove(word) print(words)
Note:
Instead of a pair of teams
last_word = words[-1][:-1] # [:-1] для удаления точки words = words[:-1] # последнее слово уже не надо
can use the command
last_word = words.pop()[:-1]