Reusable Validator

The lesson showed two near-duplicate validation functions sharing the same pattern. Complete is_valid(value, kind) as the single, general replacement: check the value is at least 3 characters long, then check its characters match the type for kind ("username" = letters only, "code" = letters and digits).

main.py
Loading editor…

Console

Run your code to see output here.