An AI assistant drafted the username validator below. It runs, but the acceptance checks fail.
Your job is the one an engineer actually does with AI-written code: work out what it got wrong, and fix it.
Two behaviours are wrong:
- A valid 3-character username (the minimum allowed) is being rejected.
- Usernames with spaces in them are being accepted, but spaces should not be allowed.
The rules are: valid usernames are 3 to 15 characters, letters, digits, or underscores only. Press Run to see the checks fail, then fix is_valid_username so all of them pass. Keep the function signature unchanged.
You have an AI assistant available. Use it however you normally would - how you direct it and whether you check its answers is part of what we look at.