+ 1
PASSWORD VALIDATION CodeCoach
my code passed all test cases save case 7, why is this so. Pls help me find the bug. Also, pls suggest a better way to write this code and all other suggestions are welcomed https://code.sololearn.com/cTIVL8U6mRxO/?ref=app
2 Answers
+ 2
Shaurya Agarwal
Try this less complicated solution:
# Password Validator
#print("""Note: Your password should contain at least-
Pass = input()
def PasswordCheck (Password):
symbol_list = ['!', '@', '#', '#x27;, '%', '&', '*']
integers = '0123456789'
symbol = 0
number = 0
for char in Password:
if char in symbol_list:
symbol += 1
if char in integers:
number+= 1
return len(Password) >= 7 and symbol >= 2 and number >= 2
if PasswordCheck(Pass):
print("Strong")
else:
print("Weak")
+ 1
A͢J That's a much simplified solution, thanks đ.