Q:

Python: Remove elements from a string based on a tuple

There's a lot out there on  similar  topics, but nothing I've found (on this website or elsewhere) seems to answer my question. That's because I want to do this with a for loop; not by importing modules like string, or using regexes, etc. 
I have a tuple consisting of some characters I don't like. 
A string is then checked against this tuple, the idea being that if these forbidden characters are elements in the string, they'll be removed.
get_rid_of_us = ('.', '"', '?', ' ')

def fix_me(text):
    text = ''.join(text.split()) # removing whitespace
    text = text.lower() # making it lowercase
    for i in get_rid_of_us:
        if i in text:
            text = text.replace(i, '')
            return text
        else:
            return text

where text is user input from elsewhere in the script, and goes on to be used afterwards. Something is wrong with my for statement - what am I missing? Thanks :)

A:

I don't program in python, so I won't write the exact code, but I can explain what is wrong here.  You don't need the else statement, and you should remove the return statements from inside the for loop. That way you can process all members of get_rid_of_us before returning the processed text.  The return statement should come after the loop has completed. Let me know if any of this is not clear.

