Объяснение:
def remove_inappropriate(spells):
result = []
for elem in spells:
abc = []
for el in elem:
if el != ' ':
abc.append(el.lower())
rev = list(reversed(abc))
if abc == rev:
result.append(elem)
return result
# наверно, не очень оптимизированно, но всё работает нормально.