div id="myTime">

python_day3

from random import randint
num = 0
verify_code = ""
while num < 4:
verify_code += chr(randint(65,90))
num += 1
print(verify_code)
c = 1
while c <= 3:
user_name = input("账号")
password = input("密码")
code = input("验证码")
if code == verify_code:
if user_name == "adm" and password == "123":
print("登陆成功")
break
elif user_name != "adm" and password != "123":
print("你还有%d次机会" % (3-c))
c += 1
continue
else:
print("验证码错误,你还有三次机会")
continue
#要求
  1. 系统调动成4位随机数. 作为登录验证码.
  2. 用户输入用户名和密码还有验证码. 
  3. 用户可以有三次登录的机会. 但是验证码如果输入错误. 不计算在内.
posted @ 2018-10-20 16:42  lowen107  阅读(161)  评论(0编辑  收藏  举报