Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "What happens when Path("notes.txt").write_text("new") targets an existing file?" on CodeWiki (https://codewiki.com/practice/mcq/python/checkpoint-4/checkpoint-4-write-boundary/).
Context (verbatim from the page):
"""
What happens when Path("notes.txt").write_text("new") targets an existing file?
It replaces the file contents with "new"
It appends "new" to the existing contents
It refuses to write unless overwrite=True is passed
"""
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.