def censor(text, word):
return " ".join([w if != word else "*" * len(w) for w in text.split(" ")])
can aynone tell what is wrong with this? I am getting a syntax error.
def censor(text, word):
return " ".join([w if != word else "*" * len(w) for w in text.split(" ")])
can aynone tell what is wrong with this? I am getting a syntax error.
if != word
can you be a bit more explicit? I see that I have that in my code. I don;t know what is wrong with it.
To compare two values you will need to specify the two values to be compared
!=
is an operator, it isn’t part of a generator expression, there’s no special syntax going on there.
That operator takes two arguments.
now I see, thank you.