or

Sample of a Password Strength Validation Program in Python

H88bi6qsb2s01

The following program is to check the strength of the input password under the given criteria using regular expression written in Python language. For more about regular expression, check https://en.wikipedia.org/wiki/Regular_expression.

The  criteria for a 'strong' password:

  • The password should contain at least 2 digits.
  • The password should contain at least 2 special characters(!@#$%^&*).
  • The password should contain at least 7 characters.


import re
k=str(input())
x=re.sub('[^!@#$%^&*]',"",k)
n=re.sub('[^0-9]',"",k)
if len(x)>=2 and len(n)>=2 and len(k)>=7:
print("strong")
else:
print('weak')

Adhere

Visit www.askmattrab.com for more academic resources.

Discussions

Dctf

Rabin Kalikote • Computer

To convert temperature in Celsius to Fahrenheit scale.

// To convert temperature in Celcius to Fahrenheit scale. #include <stdio.h>#include <conio.h>int main(){    float dc, fer;    printf("...

0 Questions 2 Likes 217 Views