Yes, Copilot and vanilla GPT-3 can both do what I demonstrated with ChatGPT. The key here is externalizing the mutated state with print statements. If you remove the stateful print statements, Copilot (and GPT-3, ChatGPT) give the wrong resu