if I am leaving space in b/w " " the problem arises with "Yo go fro yo go" and it shows space b/w each alphabet but when I am leaving no space b/w " " then the problem arises with "hey hey hey" as it shows no space b/w them.

Replace this line with your code. 
def censor(text, word):
    text = text.split()
    constant = "*" * len(word)
    n = []
    for i in text:
        if i == word:
            n += i
    return "".join(n)


the biggest problem is here:

n += i

why do you not use append() here?


Thank you so much.
The append() method worked after putting a space b/w "".
but why didn't



because += behaves weird when adding to list, that is why we have append()


OK, thank you so much.