Time: 0:00
This is a mutation and copying bugs bug
Assignment does not copy, a shallow copy still shares its contents, and mutating methods return None.
list.append() changes the list in place and returns None. Writing tags = tags.append(...) does add the tag, then immediately replaces your list with that None. The same trap exists for sort(), reverse(), extend(), insert() and remove(): every list method that modifies the list returns None, as a deliberate signal that it worked in place. If a method changes the object, call it on its own line; only assign the result of functions that build something new, like sorted() or a slice.
The pattern behind it: mutation and copying bugs.
Paste this into any web page or blog post. Visitors fix the bug right there, in their browser.
<iframe src="https://trybughunt.com/embed/791eac62-4ab4-4e5e-8807-f98eb95729a0" title="Debugging challenge: Tag list vanishes after adding a tag" width="100%" height="580" loading="lazy" style="border:1px solid #d4d4d8;border-radius:12px;max-width:760px"></iframe>
<p style="font-size:14px">Debugging challenge from <a href="https://trybughunt.com/challenges/791eac62-4ab4-4e5e-8807-f98eb95729a0">BugHunt</a></p>