Why is this code underlined?

Hello there, I am learning to code python. I am using visual studio code, and when I type this piece of code for example, as you can see it is underlined as if it’s incorrect, however there is no errors in the code. Why is this being underlined? Thank you :smiley:
image

That looks like you probably have some form of Python linting activated which is probably expecting you to add documentation for the increment function or perhaps complaining that the default value of by (1) is unused. If you hover over the underlined text, it should give you a tooltip describing exactly what the lint “error” is. In any case, you can probably ignore it (or disable the linting, perhaps the linter has some configuration for deciding which rules to enable or disable).

I am not such a big fan of pylint with vscode these days - try using only pylance for you python linting and debugging and you might find it a little more friendly.

1 Like