Es schien gut zu funktionieren, bis ich das Bit "is this in this string" gestartet habe.Warum funktioniert meine Passwortprüfung nicht?
#This is the introduction to the code
import time
MinPass = 6
MaxPass = 12
Uppercase = ["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"]
Lowercase = ["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"]
Symbols = ["!", "£", "$", "%", "^", "&", "*", "(", ")", "_", "-", "+", "=", ":", ";", "@", "'", "#", "~", "<", ">", "?", "/", "|", "¬", "`"]
print ("Hello, user, welcome to the SSPC program, or the Safe and Secure Password Creater.")
print ("Please type your name")
NAME = input()
print ("Great. For a secure password, do not use your name,", NAME, "!")
time.sleep(2)
print ("Now, lets try with a password. Please enter one here")
EnteredPassword = input("Password: ")
while len(EnteredPassword) < MinPass:
print ("That password is too small. Please try again")
EnteredPassword = input("Password: ")
while len(EnteredPassword) > MaxPass:
print ("That password is too long, please try again")
EnteredPassword = input("Password: ")
print ("Ok, that password is great!")
if EnteredPassword not in Uppercase:
continue
if EnteredPassword not in Symbols:
print ("Your password is weak")
continue
elif EnteredPassword in Uppercase:
continue
if EnteredPassword in Lowercase:
continue
elif EnteredPassword not in Lowercase:
continue
if EnteredPassword in Symbols:
print ("Your password is medium")
elif EnteredPassword not in Symbols:
print ("Your password is weak")
elif EnteredPassword in Lowercase:
continue
if EnteredPassword in Uppercase:
continue
if EnteredPassword in Symbols:
print ("Your password is strong")
elif EnteredPassword not in Lowercase:
continue
if EnteredPassword in Symbols:
print ("Your password is medium")
elif EnteredPassword not in Symbols:
print ("Your password is weak")
Die Fehlermeldung, die angezeigt wird: in Schleife nicht richtig weiter. Was ist los? Es formuliert gut, bis die Teile ‚Weiter‘ und ich weiß nicht, was los ist ... ich Hilfe schätzen würde bitte ...
In Python ist die Einrückung Teil der Sprachsyntax. Ist Einrückung in Frage 100% wie in Ihrem Code? –
Sie sollten versuchen, ein [mcve] anstelle des gesamten Programms einzuschließen. Dies wird Ihnen helfen, das Problem selbst zu isolieren, und wenn Sie nicht können, sparen Sie die Zeit der anderen, weil sie nicht das ganze Ding lesen müssen. – Arc676
'continue' ist eine Anweisung, die sofort eine Schleifenanweisung (' for', 'while') veranlasst, zur nächsten Iteration zu gehen. Sie verwenden 'continue' innerhalb einer' if' Anweisung ohne Schleife. Möglicherweise möchten Sie auch Ihren Code erneut überprüfen. Ich bin mir ziemlich sicher, z.B. 'EnteredPassword nicht in Großbuchstabe' tut nicht, was Sie es erwarteten. – dhke