Python 3 quest command, IndentationError: unindent does not match any outer indentation level

Python 3 quest command, IndentationError: unindent does not match any outer indentation level

    def register():
    print("Register")
login = input("Enter login")
passwd = input("Enter password")
passwdacc = input("Accept password")
if passwdacc = passwd:
    print("You have registered, now please sign up")
else:
    print("Try again, passwords dont matches")
login2 = input("Enter login")
password = input("Enter password")
if password = passwd and login2 = login
    print("Accepted")
else:
    print("Try again")

sign_up()

错误,警告:

文件 "source_file.py",第 3 行 登录=输入("Enter login") ^ IndentationError: unindent 不匹配任何外部缩进级别

    def register():
        print("Register")
        login = input("Enter login")
        passwd = input("Enter password")
        passwdacc = input("Accept password")
        if passwdacc = passwd:
            print("You have registered, now please sign up")
        else:
            print("Try again, passwords dont matches")
        login2 = input("Enter login")
        password = input("Enter password")
        if password = passwd and login2 = login
            print("Accepted")
        else:
            print("Try again")

除了错误的缩进,在条件语句中你需要用比较运算符替换赋值运算符。此外,if statement 中缺少 :

def register():
    print("Register")
    login = input("Enter login")
    passwd = input("Enter password")
    passwdacc = input("Accept password")

    if passwdacc == passwd:
        print("You have registered, now please sign up")
    else:
        print("Try again, passwords don't match")

    login2 = input("Enter login")
    password = input("Enter password")

    if password == passwd and login2 == login:
        print("Accepted")
    else:
        print("Try again")