summaryrefslogtreecommitdiff
path: root/Chap7PracticePassStrength.py
diff options
context:
space:
mode:
authormlot <petri-rush-curvy@duck.com>2025-06-06 13:40:57 -0400
committermlot <petri-rush-curvy@duck.com>2025-06-06 13:40:57 -0400
commit75a42ec54dbf721caa659ddf02c1f46fc2cb4bef (patch)
tree84be794a2481e356a7784557a6f9fb6fbf29cfdd /Chap7PracticePassStrength.py
initial commit for archivingHEADmain
Diffstat (limited to 'Chap7PracticePassStrength.py')
-rw-r--r--Chap7PracticePassStrength.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/Chap7PracticePassStrength.py b/Chap7PracticePassStrength.py
new file mode 100644
index 0000000..ff944c2
--- /dev/null
+++ b/Chap7PracticePassStrength.py
@@ -0,0 +1,30 @@
+#! /usr/bin/env python3
+
+# Practice Chap. 7
+# Password Strength Tester
+
+import re
+
+def passStrengthTest(passWord):
+ lowerRegex = re.compile(r'[a-z]')
+ upperRegex = re.compile(r'[A-Z]')
+ numRegex = re.compile(r'[0-9]')
+ molower = lowerRegex.search(passWord)
+ moupper = upperRegex.search(passWord)
+ monum = numRegex.search(passWord)
+ if len(passWord) < 8:
+ print('Your password is less than 8 characters which is too short.')
+ elif not molower:
+ print('You need at least one lower case letter.')
+ elif not moupper:
+ print('You need at least one upper case letter.')
+ elif not monum:
+ print('You need at least one number.')
+ else:
+ print('Your password is strong!')
+
+
+print('What is your password?')
+passW = input()
+passStrengthTest(passW)
+