|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- print('please enter the password:',end=' ')
- password = 'i love yst'
- time =3
- while time:
- guess = input()
- while '*' in guess:
- print("the'*'is not included in password,please enter it again,and you have"+time+"times: ",end=' ')
- if guess != password:
- guess=input()
- print('the password is wrong,please enter again')
- time-=1
- print('you have '+time+'times')
- else:
- print('you are right,entering.....')
- print("out of chance")
复制代码
为什么就是不行
帮楼主把代码改好了:
- print('please enter the password:', end=' ')
- password = 'i love yst'
- time = 3
- while time:
- guess = input()
- if '*' in guess:
- print("the '*' is not included in password, please enter it again, and you have",
- time, "times: ", end='')
- elif guess != password:
- print('the password is wrong, please enter again, and you have', time, "times: ", end="")
- time -= 1
- else:
- print('you are right, entering.....')
- break
- else:
- print("out of chance")
复制代码
|
|