From 773f1326f933805043c265e17285f46438a1e794 Mon Sep 17 00:00:00 2001 From: Genius Date: Wed, 6 Sep 2023 18:27:53 +0000 Subject: [PATCH 1/2] Closes: #1 Updated validations.py python script. Fixed the behavior of validate_user function in validations.py. --- Course3/Lab4/validations.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Course3/Lab4/validations.py b/Course3/Lab4/validations.py index b18de65a2e..f5e089b89a 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 + if not re.match('[a-zA-z]', username[0]): + return False + if username[0] == '_': + 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 From 76f5fb47f791ef5478ea4ca678b9893a7fe08c2b Mon Sep 17 00:00:00 2001 From: Genius Date: Wed, 6 Sep 2023 18:36:33 +0000 Subject: [PATCH 2/2] Something --- Course3/Lab4/validations.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Course3/Lab4/validations.py b/Course3/Lab4/validations.py index f5e089b89a..d4623d865c 100644 --- a/Course3/Lab4/validations.py +++ b/Course3/Lab4/validations.py @@ -26,6 +26,7 @@ def validate_user(username, minlen): + 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