print ("This is a simple login")
while True:
enter = input("Enter the password for this computer: ")
if enter == "Reagan":
time.sleep(1)
print ("Your Login is successful")
else:
print ("Password didn't match! ")
更新
这是从终端运行时程序的输出:
C:\Python27\python.exe "C:/Python Programming/Practice/for loops.py"
This is a simple login Enter
the password for this computer: Reagan
Traceback (most recent call last): File "C:/Python Programming/Practice/for loops.py",
line 3, in <module> enter = input("Enter the password for this computer: ") File "<string>",
line 1, in <module> NameError: name 'Reagan' is not defined Process finished with exit code 1
你需要
raw_input()
相关问题 更多 >
编程相关推荐