Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions other/password.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ 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("ab", 8))
8
>>> alternative_password_generator("abcd", 3)
Traceback (most recent call last):
...
ValueError: requested length is shorter than the required characters
"""
if i < len(chars_incl):
raise ValueError("requested length is shorter than the required characters")

# Password Generator = full boot with random_number, random_letters, and
# random_character FUNCTIONS
# Put your code here...
Expand Down
Loading