Jak zrobić anonimizator w Pythonie?

Pracuję nad programem anonimizera, który wykrywa podane słowa na liście. To jest to, co mam do tej pory. Jestem nowy w Pythonie, więc nie wiem, jak mogę to osiągnąć.

def isAlpha(c):
    if( c >= 'A' and c <='Z' or c >= 'a' and c <='z' or c >= '0' and c <='9'):
        return True
    else:
        return False


def main():
    message = []
    userInput = str(input("Enter The Sentense: "))
    truncatedInput = userInput[:140]

    for i in range(len(truncatedInput)):
        if(truncatedInput[i] == 'DRAT'):
            truncatedInput[i] = 'x'
        print(truncatedInput[i])

to jest wyjście, które otrzymuję

Enter The Sentense: DRAT
D
R
A
T

Chcę, aby słowo zostało zastąpione przez XXXX

questionAnswers(3)

yourAnswerToTheQuestion