初次学习python,一头雾水,写了个简单的登录验证,做做笔记
username = 'cc' #用户名 userpassword = '123' #密码 count = 0 #计数器 while count<3: #如果计数小于3,即0,1,2共三次,则执行以下代码 _username = input("USER:") _userpassword = input("PW:") if _username == username and _userpassword == userpassword: #判断用户输入的用户名和密码是否一致 print("wlcome",username,"back.~~v-v".format(username=username)) break #一致则跳出循环 elif count<2: print("not this user or password,try again") count +=1 else: print("lock!!!",username.format(username=username))
代码很简单,希望一年后可以写出实用点的代码
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦