Time: 0:00
This is a logic errors bug
The wrong operator, an inverted condition, a formula the right way round but backwards.
What went wrong: is asks "is this the very same object?". role.lower() makes a new string, so it is never the same object as "admin".
The fix: return role.lower() == "admin"
Remember: use == to compare values. Use is only for None, True and False.
The pattern behind it: logic errors.
Paste this into any web page or blog post. Visitors fix the bug right there, in their browser.
<iframe src="https://trybughunt.com/embed/f839a07c-b287-4914-b956-79cdbea453f6" title="Debugging challenge: Admin check rejects the admin" 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/f839a07c-b287-4914-b956-79cdbea453f6">BugHunt</a></p>