最近开始断断续续学习python,今天加入博客园,作为新人,和各位老师们讨教了,以后多多照顾!为了大家能看清楚所以就截图了,文末尾附源码,
说不定会有那位老师给我指教一番。
##############################################################
##############################################################
输出结果总是我写的所有提示语,不知道为何。
以下为输出结果:
附源码:
# Author:Zhang Peng
_username="zhangpeng"
_password="123"
count=0
while count<3:
username = input("Username:")
password = input("Password:")
with open('e:\py\course\锁定名单.txt') as f:
contents = f.read()
for username in contents:
if username == contents:
print("You have been locked! Please contact the administrator")
break
else:
continue
while 1>0:
if username == _username and password == _password:
print("Welcome to back!")
break
if username != _username or password != _password:
print("Invalid username or password!")
count +=1
if count == 1:
print("You have only three chances!")
if count == 2:
print("You only have one more chance!!!")
else: