Syntax error-python

it’s one string you’re right! thanks.
I’ll go try something else.

I feel so stupid for not noticing that, whatever.

Yes but you should have known that. By looking, or by considering what you sent to the function. You have to stay in perfect control of that.

So, printing, that’s what you’re missing. Or, looking. Same thing.

Something is wrong. Which operation is wrong? Don’t know. Print somewhere in the middle. Still wrong? If yes, then the mistake is even earlier, if no, it’s later.

At some point you’ll find the operation that doesn’t do what you expect. You can print before and after the operation and observe that it behaves badly, you have now isolated the behaviour and can start reconsidering what you wanted to happen there.

There’s also something to be said for reading the code and processing what it says, to understand what is being said.
It’s instructions. You can read instructions and get an understanding of what is done. Code is no different.

However, don’t spend too much effort on that. You should indeed read and get an understanding, but if you still don’t see it then start measuring instead.

This project leaves some of the policy decisions up to the user, and that is an invitation for the user to be creative.

Notice that in proprietary_terms, "her" appears before "herself". So, the user needs to decide whether our policy is to simply censor substrings, regardless of word boundaries, processed in the order that they appear in proprietary_terms. If we choose that route, we will never have an opportunity to replace "herself". We could also anticipate a situation in which two terms to be censored overlap each other, even if word boundaries are recognized.

Before writing any code, decide what you would like the rules to be.

This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.