ChatGPT using the DaVinci model is not an ai designed to give you "correct" answers. It is designed to write text based on predictions of what it's been trained on. The code writing model is a different model.