009 分支与循环-小甲鱼课后作业

 

temp = input("请输入密码:")
password = "我好喜欢你"
times=3
while times>0:
    if "*" in temp:
        temp=input("密码中不能含有“*”号!您还有3次机会!请重新输入:")
    elif temp == password:
        break
    temp=input("密码错误,您还有"+str(times-1)+"次机会!请重新输入:")
    times = times -1
print("密码正确,进入程序...")

  

posted @ 2018-03-23 15:28  散步去看雨  阅读(126)  评论(0)    收藏  举报