Advertisement
pexea12

password check

Jun 14th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. print('Insert password')
  2. s = input()
  3.  
  4. if len(s) < 8:
  5.     print('Password length < 8')
  6.     exit(1)
  7.  
  8. count_letter = 0
  9. count_number = 0
  10. count_special = 0
  11.  
  12. for i in range(len(s)):
  13.     if s[i] >= '0' and s[i] <= '9':
  14.         count_number += 1
  15.     if (s[i] >= 'a' and s[i] <= 'z') or (s[i] >= 'A' and s[i] <= 'Z'):
  16.         count_letter += 1
  17.     if s[i] == '@' or s[i] == '%' or s[i] == '#':
  18.         count_special += 1
  19.  
  20. if count_number < 1 or count_special < 1 or count_letter < 1:
  21.     print('Invalid password')
  22.     exit(1)
  23.  
  24. print('Good password!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement