コード例 #1
0
def main():
    # Tell the user what the password parameters are
    print("Password must be 8 characters long")
    print("Password must contain at least one letter and at least two numbers")
    print("Password cannot have any special characters")

    # Create a loop until the user enters a password that satisfies the parameters
    loop = True
    while loop:
        # ask the user for the desired password
        userPassword = input("Enter the desired password: "******"":
            loop = False
    print("Password meets parameters")
コード例 #2
0
def main():
    again = True
    while again:
        password = Password()
        password.setPassword(
            input(
                "Enter a password (minimum of eight characters and needs two numbers): "
            ))
        if password.isValid():
            print("Valid Password.")
        else:
            print(password.getErrorMessage())

        playAgain = input("Do you want to play again?(Y/N): ").upper()
        if playAgain == "Y":
            pass
        else:
            again = False
            print("Thanks for playing!")