From 62ec1d30f0ba0a94f5115e3d5006aa991b566330 Mon Sep 17 00:00:00 2001 From: Jaci Date: Sat, 19 Apr 2025 18:39:57 +0000 Subject: [PATCH] Closes: #1 Fix validations.py function, only names starting only with letter --- Course3/Lab4/validations.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Course3/Lab4/validations.py b/Course3/Lab4/validations.py index b18de65a2e..d077d2a3e8 100644 --- a/Course3/Lab4/validations.py +++ b/Course3/Lab4/validations.py @@ -18,7 +18,15 @@ def validate_user(username, minlen): # Usernames can't begin with a number if username[0].isnumeric(): return False + #Username can#t begin with dot and underline + 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