From 7812fb370fad433030a7b38e2b8536d4e6655e0e Mon Sep 17 00:00:00 2001 From: Astamur Date: Sun, 24 Nov 2024 10:17:11 +0000 Subject: [PATCH] Closes: #36055 Updated validations.py python script --- Course3/Lab4/validations.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Course3/Lab4/validations.py b/Course3/Lab4/validations.py index b18de65a2e..b905125e08 100644 --- a/Course3/Lab4/validations.py +++ b/Course3/Lab4/validations.py @@ -16,9 +16,12 @@ def validate_user(username, minlen): if not re.match('^[a-z0-9._]*$', username): return False # Usernames can't begin with a number - if username[0].isnumeric(): + if not re.match('[a-zA-Z]', 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