if 语句报错
user=input("请您输入银行账号:")if user == "GaoYanLong" :
print("第1组账号正确!")
elif user == "高衍龙" :
print("第2组账号正确!")
elif user == "颛彘" :
print("第3组账号正确!")
else :
print("账号错误!")
break
password=input("请您输入密码:")
if password == "20201214" :
print("您输入正确,可以取款!")
else :
print("您输入的密码错误!"){:7_130:}运行报错了,看看如何修改呀 ?
三组账号都需要判断吗?还是只要账号是任意一个账号就可以呢?
n=3
while n:
user=input("请您输入银行账号:")
if user == "GaoYanLong" :
print("第1组账号正确!")
temp = 3
n=0
elif user == "高衍龙" :
print("第2组账号正确!")
temp = 3
n=0
elif user == "颛彘" :
print("第3组账号正确!")
temp = 3
n=0
else :
n-=1
print("账号错误!您还有%d次重新输入的机会"%n)
temp = 0
while temp:
password=input("请您输入密码:")
if password == "20201214" :
print("您输入正确,可以取款!")
break
else :
temp-=1
print("您输入的密码错误!您还有%d次重新输入的机会"%temp) id,count = {"GaoYanLong":1,"高衍龙":2,"颛彘":3},3
while True:
user = input("请您输入银行账号:")
if user in id:
print("第%d组账号正确!" % id)
break
else :
print("账号错误!")
continue
while count:
password = input("请您输入密码:")
count -= 1
if password == "20201214" :
print("您输入正确,可以取款!")
break
elif count == 0:
print("您输入的密码错误超过3次,账户已锁定!")
else:
print("您输入的密码错误,请重新输入!您还有 %d 次机会!" % count)
continue
页:
[1]