repl.it
@KisituSamuel/

Password Checker

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#1
import re 
#2
while True:
  #3
  user_input = input("Enter a password : ")
  is_valid = False 
  if (len(user_input)<6 or len(user_input)>12):
    #4
    print("Not valid ! Total characters should be between 6 and 12")
    continue
  elif not re.search("[A-Z]",user_input):
    #5
    print("Not valid ! It should contain one letter between [A-Z]")
    continue
  elif not re.search("[a-z]",user_input):
    #6
    print("Not valid ! It should contain one letter between [a-z]")
    continue
  elif not re.search("[1-9]",user_input):
    #7
    print("Not valid ! It should contain one letter between [0-9]")
    continue
  elif not re.search("[$#@]",user_input):
    #8
    print("Not valid ! It should contain at least one letter in [$#@")
    continue
  elif re.search("[\s]",user_input):
    #9
    print("Not valid ! It should not contain any space")
    continue
  else:
    #10
    is_valid = True
    break
#11
if(is_valid):
  print("Password is valid")
?