自学python一两个月,感觉太零散了,最初学习目的是爬虫,学着学着数据分析、opencv识别等等,结果感觉什么都没学上。
现在决定重新从基础一步步学习
学习笔记(1)简单登录
#_*_coding:utf-8*_
#Author:Andy
#登录接口
username="abc"
password="123"
count1 = 0
while True:
if count1 ==3:
print("while :连续猜错3次,自动退出。")
break
guess_username= input('username:')
guess_password = input('password:')
if guess_username != username:
print("帐号错误")
elif guess_password != str(password):
print("密码错误")
else:
print("登录成功")
count1 = count1+1
if count1==3:
continue_confirm = input("请确认继续guess:y/n")
if continue_confirm != 'n':
count1=0;
学习笔记(2)多菜单 -验证码登录
count2 = 0
while True:
if count2 ==3:
print("homework:连续猜错3次,自动退出。")
break
guess_username= input('username:')
guess_password = input('password:')
guess_code=input("code:")
if guess_username != username:
print("帐号错误")
elif guess_password != str(password):
print("密码错误")
elif guess_code != code:
print("验证码错误")
else:
print("登录成功")
break
count2 = count2+1
if count2==3:
continue_confirm = input("请确认继续guess:y/n")
if continue_confirm != 'n':
count2=0;