From 86ca63defaa4659ecbe11e9a0ba21aa0928bf255 Mon Sep 17 00:00:00 2001 From: dible Date: Wed, 1 Oct 2025 14:41:21 +0000 Subject: [PATCH] Closes: #1 updated validations.py python script Fixed the behavior of validate_user function in validation.py --- Course3/Lab4/validations.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Course3/Lab4/validations.py b/Course3/Lab4/validations.py index b18de65a2e..8eaf1ce72f 100644 --- a/Course3/Lab4/validations.py +++ b/Course3/Lab4/validations.py @@ -18,7 +18,13 @@ def validate_user(username, minlen): # Usernames can't begin with a number if username[0].isnumeric(): return False + if username[0] in ['.', '_']: + 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