So code is just a notation. But one that is executable. In your example, the code is working, it’s just not what you intended. The issue is not the code, the issue is that you don’t know code well enough to “speak” your algorithm.
And that is the main issue with a lot of LLM users. They are translating specs (which they do understand) to code (that they do not understand) and then relying on superficial outputs to see if they got it right. While also telling fluent speakers that they should follow the same workflow. At least with human languages, the other party may detect discrepancy and the fact that you’re not a native speaker. But a computer will execute things blindly.