How do i get my while statement to stop when the user inserts "nee" & exits the program. At the moment when the users inserts nee it keeps on running the program and asking ("Wilt u dit programme gebruiken ? ja/nee: ") for 3 times. After it has asked me for 3 times the program abruptly stops.
I want the program to run when the users inserts ja and to stop when the user inserts nee.
import time
import sys
print ("Check of uw wachtwoord veilig genoeg is in dit programma.")
time.sleep(1)
print ("Uw wachtwoord moet tussen minimaal 6 en maximaal 12 karakters
bestaan")
print ("U kunt gebruik maken van hoofdletters,getallen en symbolen
(@,#,$,%)")
klein = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
groot = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
nummers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']
symbolen= [' ', '!', '#', '$', '%', '&', '"', '(', ')', '*', '+', ',', '-',
'.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`',
'{', '|', '}', '~',"'"]
def ok(passwd,l):
return any(k in passwd for k in l) # checkt of een letter in de lijst
in het wachtwoord zit.
while input("Wilt u dit programma gebruiken? ja/nee: ") == "ja" or input("Wilt u dit programma gebruiken? ja/nee: ") == "JA" or input("Wilt u dit programma gebruiken? ja/nee: ") == "Ja":
ww = input("Voer uw wachtwoord in: ")
if len(ww) < 6:
print ("uw wachtwoord is te kort, uw wachtwoord moet uit minimaal 6 en maximaal 12 karakters bestaan!")
elif len(ww) > 12:
print ("uw wachtwoord is te lang, uw wachtwoord moet uit minimaal 6 en maximaal 12 karakters bestaan!")
elif len(ww) >= 6 and len(ww)<= 12:
sww = set(ww) # set is een onorganiseerde verzameling dat betekent dat het niet op order is bijv. SaUj%2F3 = Oonorganiseerd
if all(ok(sww,l) for l in [klein,groot,nummers,symbolen]):
print ("uw wachtwoord is Zeer sterk")
elif all(ok(sww,l) for l in [klein,groot,nummers]):
print ("uw wachtwoord is Sterk")
elif all(ok(sww,l) for l in [klein,groot,symbolen]):
print ("uw wachtwoord is Sterk")
elif all(ok(sww,l) for l in [groot,nummers,symbolen]):
print ("uw wachtwoord is Sterk")
elif all(ok(sww,l) for l in [nummers,symbolen,klein]):
print ("uw wachtwoord is Sterk")
elif all(ok(sww,l) for l in [nummers,symbolen]):
print ("uw wachtwoord is Medium")
elif all(ok(sww,l) for l in [groot,nummers]):
print ("uw wachtwoord is Medium")
elif all(ok(sww,l) for l in [groot,symbolen]):
print ("uw wachtwoord is Medium")
elif all(ok(sww,l) for l in [klein,groot]):
print ("uw wachtwoord is Medium")
elif all(ok(sww,l) for l in [klein,nummers]):
print ("uw wachtwoord is Medium")
elif all(ok(sww,l) for l in [klein,symbolen]):
print ("uw wachtwoord is Medium")
elif all(ok(sww,l) for l in [klein]):
print ("uw wachtwoord is Zwak")
elif all(ok(sww,l) for l in [symbolen]):
print ("uw wachtwoord is Zwak")
elif all(ok(sww,l) for l in [nummers]):
print ("uw wachtwoord is Zwak")
elif all(ok(sww,l) for l in [groot]):
print ("uw wachtwoord is Zwak")