Skip to content

Commit f584039

Browse files
SUCCESSFULLY RESOLVED ISSUE NO - 15633
1 parent 6e03a48 commit f584039

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎other/password.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ def password_generator(length: int = 8) -> str:
2626
# chars_incl= characters that must be in password
2727
# i= how many letters or characters the password length will be
2828
def alternative_password_generator(chars_incl: str, i: int) -> str:
29+
"""
30+
Generate a password of length ``i`` containing all characters in ``chars_incl``.
31+
32+
>>> len(alternative_password_generator("ab", 8))
33+
8
34+
>>> alternative_password_generator("abcd", 3)
35+
Traceback (most recent call last):
36+
...
37+
ValueError: requested length is shorter than the required characters
38+
"""
39+
if i < len(chars_incl):
40+
raise ValueError("requested length is shorter than the required characters")
41+
2942
# Password Generator = full boot with random_number, random_letters, and
3043
# random_character FUNCTIONS
3144
# Put your code here...

0 commit comments

Comments
 (0)