Why is my code printing both the censored version of the text argument and the non-censored version? It should print only the censored input. Sorry if this code is a mess; I am not very good. Thank you for any help.
def censor(text,word):#defines variables as strings and takes input and moves to a list inp=str(text) remo=str(word) transient=inp.split(" ") for i in range(len(transient)):#check each item in transient if transient[i]==remo: transient.append("*"*len(remo)) else: transient.append(transient[i]) return " ".join(transient) print censor("oh look a goldfish","goldfish")