Hello, regarding the Censor exercise:
My code seems to censor correctly when I test it (it replaces the censor word with asterisks), but I get the error message ‘Your function fails on censor(“hey hey hey”,“hey”). It returns “_" when it should return "”.’
To be clear it seems to be saying my function should return an empty space, but it is instead returning three spaces in a row. The auto-formatting changes the exact quote.
I don’t understand; I thought the function would be supposed to return “*** *** ***” in this case rather than an empty space. What am I missing?
Here is my code:
On a side note, even if my code is actually “correct” I feel that it’s very awkward and probably longer than necessary. If anyone has any general advice as to how to make code shorter and more elegant, I would really appreciate it because nearly everything I write ends up looking like this.
Thanks to anyone who replies!