print ("*Default*")
loop = 'true'
while(loop == 'true'):
username = input("Username Please : ")
passsword = input("Password Please : ")
if(username == "Default" and password == "Default2"):
print ('Logged in Successfully as ') + username
loop = 'false'
loop1 = 'true'
while(loop1 == 'true'):
command = input(username + "{} > >")
if(command == "exit" or command == "Exit"):
break
else:
print ("'") + command + "' is not a valid command!"
else:
print ('Invalid Credentials!')
有人可以解释为什么这不起作用吗? 它说
line 6, in <module>
if(username == "Default" and password == "Default2"):
NameError: name 'password' is not defined
答案 0 :(得分:5)
您已将变量定义为passsword
并将其作为password
passsword = input("Password Please : ")
这里
if(username == "Default" and password == "Default2"):
请