Good spot and thats interesting. ChatGPT is a language model and so predicts the most likely words. No other logic or intelligence. But if you asked it to write Python code to answer your question this it would probably be good code (