Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from string import ascii_uppercase, ascii_lowercase
- def strongpass(n, password): # n -> length of 'password'; password ==> string containing the password
- no_to_add = 0
- upper, lower, no, spl = (False,)*4
- for i in password:
- if i in ascii_uppercase:
- upper = True
- elif i in ascii_lowercase:
- lower = True
- elif i in "1234567890":
- no = True
- elif i in "!@#$%^&*()-+":
- spl = True
- L1 = [upper, lower, no, spl]
- no_to_add += L1.count(False)
- if (n + no_to_add) >= 6 :
- return no_to_add
- else:
- return no_to_add + (6 - (n + no_to_add))
- val = strongpass(1, "9")
- print(val)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement