From f649baf66ed6849059f98130bc8bc86a52e86114 Mon Sep 17 00:00:00 2001 From: D Bhoopesh sakthi sudhan Date: Sat, 14 Nov 2026 01:21:09 +0530 Subject: [PATCH 1/3] Fix password generator length validation Add validation for minimum password length requirement. --- other/password.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/other/password.py b/other/password.py index 6b64bdb4d81a..ac3dfe772c53 100644 --- a/other/password.py +++ b/other/password.py @@ -29,6 +29,10 @@ def alternative_password_generator(chars_incl: str, i: int) -> str: # Password Generator = full boot with random_number, random_letters, and # random_character FUNCTIONS # Put your code here... + if i < len(chars_incl): + raise ValueError( + "Password length must be at least the number of required characters" + ) i -= len(chars_incl) quotient = i // 3 remainder = i % 3 From f8c38a98edb5c0b03e11c2b88179fa622a56fbf0 Mon Sep 17 00:00:00 2001 From: D Bhoopesh sakthi sudhan Date: Sun, 22 Nov 2026 00:56:11 +0530 Subject: [PATCH 2/3] Update other/password.py Co-authored-by: Mohit-Gaur75 --- other/password.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/other/password.py b/other/password.py index ac3dfe772c53..0a2262e0a8f1 100644 --- a/other/password.py +++ b/other/password.py @@ -30,9 +30,9 @@ def alternative_password_generator(chars_incl: str, i: int) -> str: # random_character FUNCTIONS # Put your code here... if i < len(chars_incl): - raise ValueError( - "Password length must be at least the number of required characters" - ) + raise ValueError( + "Password length must be at least the number of required characters" + ) i -= len(chars_incl) quotient = i // 3 remainder = i % 3 From 03591ac3e9f2669b03183482204c06022e94c516 Mon Sep 17 00:00:00 2001 From: D Bhoopesh sakthi sudhan Date: Sun, 22 Nov 2026 01:03:27 +0530 Subject: [PATCH 3/3] Add doctest for alternative_password_generator Add docstring to alternative_password_generator function. --- other/password.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/other/password.py b/other/password.py index 0a2262e0a8f1..5a8c0425b490 100644 --- a/other/password.py +++ b/other/password.py @@ -26,6 +26,16 @@ def password_generator(length: int = 8) -> str: # chars_incl= characters that must be in password # i= how many letters or characters the password length will be def alternative_password_generator(chars_incl: str, i: int) -> str: + """ + Generate a password of length `i` containing all characters in `chars_incl`. + + >>> len(alternative_password_generator("abc", 8)) + 8 + >>> alternative_password_generator("abcd", 3) + Traceback (most recent call last): + ... + ValueError: Password length must be at least the number of required characters + """ # Password Generator = full boot with random_number, random_letters, and # random_character FUNCTIONS # Put your code here...