validate_username(username) enforcing all of these rules without the re module: length between 5 and 15 characters inclusive; must start with a letter; may only contain letters, digits, and underscores; and must not contain two consecutive underscores. Return True only if every rule passes.username = 'rahul_99'
True
Starts with a letter, valid characters only, length 8, no double underscore.
username = '9rahul'
False
Starts with a digit.
username = 'ab'
False
Shorter than the 5-character minimum.
username = 'ra__hul'
False
Contains a consecutive double underscore.
Check length first with a simple bound test.
Check `username[0].isalpha()`.
Loop the rest checking `.isalnum() or ch == '_'`.
Finally check `'__' not in username`.