小练习2

这里写图片描述

#encoding=utf-8
users=['mengke','songzhao']
passwd=['hello','hello']
administrationinfo={}
time=3
for i in range(len(users)):
    administrationinfo[users[i]]=passwd[i]
notice='''\
usage
(C)reate
(L)login
'''
print notice
while(True):
    choice=raw_input("please chose a mode")
    if choice=='C':
        newuser=raw_input("please input the new name")
        for new in users:
            if new==newuser:
                print "the name is already existed"
                break
            else:
                users.append(newuser)
                newpasswd=raw_input("please input the new passwd")
                passwd.append(newpasswd)
                administrationinfo[newuser]=newpasswd
                print "success"
                break
    elif choice=='L':
        loginuser=raw_input("please input your name")
        while loginuser not in users:
            print "wrong"
            time-=1
            loginuser=raw_input("please try again")
            if time <= 0:
                print "you have already tried three times please try in 10min"
                break
        loginpasswd=raw_input("please input your passwd")
        for i in range(3):
            if administrationinfo[loginuser]==loginpasswd:
                print  "welcome"
                break
            else:
                time-=1
                loginpasswd=raw_input("try again")
                time-=1
            if time <= 0:
                    print "you have already tried three times please try in 10min"
                    break
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值