diff --git a/Course3/Lab4/validations.py b/Course3/Lab4/validations.py index b18de65a2e..79372f2c19 100644 --- a/Course3/Lab4/validations.py +++ b/Course3/Lab4/validations.py @@ -3,6 +3,10 @@ import re def validate_user(username, minlen): + + if username[0] in ['_', '.']: + return False + """Checks if the received username matches the required conditions.""" if type(username) != str: raise TypeError("username must be a string") @@ -19,6 +23,11 @@ def validate_user(username, minlen): if username[0].isnumeric(): return False return True + +print(validate_user("blue.kale", 3)) # True +print(validate_user(".blue.kale", 3)) # Currently True, should be False +print(validate_user("red_quinoa", 4)) # True +print(validate_user("_red_quinoa", 4)) # Currently True, should be False