Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "What does [f() for f in [lambda: i for i in range(3)]] produce?" on CodeWiki (https://codewiki.com/practice/mcq/python/checkpoint-2/checkpoint-2-late-binding/).
Context (verbatim from the page):
"""
What does [f() for f in [lambda: i for i in range(3)]] produce?
[2, 2, 2]
[0, 1, 2]
It raises NameError because i leaves the comprehension scope
"""
Introduce three subtle bugs into the example above and let me find them. Reveal each answer only after I have guessed.
Answer in English. Keep code examples in Python. Where you are unsure, say so.