I am communicating with ChatGPT in Czech language. In Czech language the English preposition “in” equalls “v”. After requesting the Python source code the ChatGPT gives a code, where the reserved word “in” is replaced as “v”, so for example I have got a line “for col v range(2, 19)” in place or correct “for col in range(2, 19)”. So it does not obey the Python reserved code words.
It seems like ChatGPT is translating Python reserved words, like “in,” into Czech when you’re chatting in that language, which is causing some issues in the code. That’s definitely frustrating!
One way to handle this is to ask for the Python code specifically and mention that the reserved words should stay in English. You could say something like, “Can you give me the Python code but keep the keywords in English?”
If you’re okay with it, you could switch to English just for the code parts to avoid any weird translations. And of course, just double-check the code after it’s generated to make sure everything looks right.
It is interesting, that it concerns only the “in” preposition, only sometimes, and I had a feeling, when I pointed, that the GPT has made this mistake in code, that the GPT has denied, that it was his mistake. So there is some weird model behavior. On the other hand, the ChatGPT generated code works with less error iterations than the other models.