0

I am making a very simple password strength checker I have all the systems working I believe but when I run it the final process is not completed this seems to be because ver(verifier) is not updating, I'm almost positive I am going to be face palming once I get it to work I know it is very simple but for some reason I cant figure it out, thank you.

import time
ver1, ver2, ver3 = 0, 0, 0
y = 0
ver = 0
def check():
  if len(p) >= 8 :
    ver1 = 1
  else:
     print("password must be more that 8 characters and contain a combination of numbers and letters")
  if p.islower():
    print("please add some capital letters")
  elif p.isupper():
    print("please add some lower case letters")
  else:
    ver2 = 1
  for i in p:
    if i.isdigit():
      ver3 = 1
      break
  else:
    print("password must be more that 8 characters and contain a combination of numbers and letters")
    

 
while y == 0:
  time.sleep(0.5)
  print("\nwelcome to the number bank")
  time.sleep(0.5)
  p = input("please enter a password")
  check() 
  ver = (ver1 + ver2 + ver3)
  if ver == 3:
    print("password accepted")
    y = 1
  else:
    time.sleep(0.5)
    print("\nwelcome to the number bank")
    time.sleep(0.5)
    p = input("please enter a password")
    check()
    print(ver1, ver2, ver3)
  • For starters, you could make it less annoying by taking out the `time.sleep()`s. – tripleee Oct 09 '22 at 16:00
  • You have not marked these variables as `global` so the ones inside the function are unrelated to the ones outside. – tripleee Oct 09 '22 at 16:03
  • yeah but its not just purely functional I'm trying to make an actual "system" and I think an actual user might find two different lines of "dialogue" showing up simultaneously a bit fast inverted commas because it's a homework project so no actual users or systems – NeotericNomad Oct 09 '22 at 16:03
  • you should use `return ver1, ver2, ver3` and later `ver1, ver2, ver3 = check()` – furas Oct 09 '22 at 19:10

0 Answers0