0
test=[]
words_reverse=[]
bad_char=[' ','“','”']
words=[]
def is_words(alist):
    words=['Madam','A tack for tooth','hi im john']
    test.append(words[0][::-1].lower())
    test.append(words[1][::-1].lower())
    test.append(words[2][::-1].lower())
    print(test)
    for q in test:
        for w in q:
            if(w in bad_char):
                q.replace(w,'')
is_words(words)
print(test)

for the area where it states for q in test: ...

I do not under why the spacing ' ' is not being replace by the empty string '' in test and still printing the spacing.

sshashank124
  • 31,495
  • 9
  • 67
  • 76

0 Answers0