This is what I've done till now. And when it goes wrong it doesn't print 'Not Okay'. I'm still not able to figure out how to check special chars.
#!/usr/bin/python
def passw_check():
passin = raw_input("Enter the password")
if len(passin) == 8: # checking total length of password
if sum(map(str.isupper, passin))== 2: #check 2 upper chars
if sum(map(str.islower, passin))== 2: #check 2 lower chars
if sum(map(str.isdigit, passin))== 4: #check 2 digits chars
print 'Passwords Okay'
else:
print 'Not Okay!'
passw_check()
Aucun commentaire:
Enregistrer un commentaire