From 4d8cc80a0f1dbdc0d988cd04b3e8b016df82c99f Mon Sep 17 00:00:00 2001 From: IceTheDev2 <115871297+IceTheDev2@users.noreply.github.com> Date: Fri, 24 Feb 2023 18:21:28 +0200 Subject: [PATCH] Update password_strength_logic.py --- code/password_strength_logic.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/code/password_strength_logic.py b/code/password_strength_logic.py index 6b40afb..3321247 100644 --- a/code/password_strength_logic.py +++ b/code/password_strength_logic.py @@ -115,11 +115,19 @@ def check_password_complexity() -> None: for missing_feature in missing_security_features_list: if len(missing_security_features_list) == 1: output = str(missing_feature) - elif missing_feature != missing_security_features_list[-1]: - output = output + str(missing_feature) + ', ' + elif len(missing_security_features_list) == 2: + if missing_feature != missing_security_features_list[-1]: + output = output + str(missing_feature) + ' and ' + else: + output = output + str(missing_feature) else: - output = output + 'and ' + str(missing_feature) - + if missing_feature == missing_security_features_list[-2]: + output = output + str(missing_feature) + ', and ' + elif missing_feature == missing_security_features_list[-1]: + output = output + str(missing_feature) + else: + output = output + str(missing_feature) + ', ' + return f'Not complex: Your password is missing {output}.' else: