第二周作业__三次锁定

html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video { margin: 0; padding: 0; border: 0 }
body { font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 14px; line-height: 1.6; color: #333; background-color: #fff; padding: 20px; max-width: 960px; margin: 0 auto }
body>*:first-child { margin-top: 0 !important }
body>*:last-child { margin-bottom: 0 !important }
p,blockquote,ul,ol,dl,table,pre { margin: 15px 0 }
h1,h2,h3,h4,h5,h6 { margin: 20px 0 10px; padding: 0; font-weight: bold }
h1 tt,h1 code,h2 tt,h2 code,h3 tt,h3 code,h4 tt,h4 code,h5 tt,h5 code,h6 tt,h6 code { font-size: inherit }
h1 { font-size: 28px; color: #000 }
h2 { font-size: 24px; border-bottom: 1px solid #ccc; color: #000 }
h3 { font-size: 18px }
h4 { font-size: 16px }
h5 { font-size: 14px }
h6 { color: #777; font-size: 14px }
body>h2:first-child,body>h1:first-child,body>h1:first-child+h2,body>h3:first-child,body>h4:first-child,body>h5:first-child,body>h6:first-child { margin-top: 0; padding-top: 0 }
a:first-child h1,a:first-child h2,a:first-child h3,a:first-child h4,a:first-child h5,a:first-child h6 { margin-top: 0; padding-top: 0 }
h1+p,h2+p,h3+p,h4+p,h5+p,h6+p { margin-top: 10px }
a { color: #4183C4; text-decoration: none }
a:hover { text-decoration: underline }
ul,ol { padding-left: 30px }
ul li>:first-child,ol li>:first-child,ul li ul:first-of-type,ol li ol:first-of-type,ul li ol:first-of-type,ol li ul:first-of-type { margin-top: 0px }
ul ul,ul ol,ol ol,ol ul { margin-bottom: 0 }
dl { padding: 0 }
dl dt { font-size: 14px; font-weight: bold; font-style: italic; padding: 0; margin: 15px 0 5px }
dl dt:first-child { padding: 0 }
dl dt>:first-child { margin-top: 0px }
dl dt>:last-child { margin-bottom: 0px }
dl dd { margin: 0 0 15px; padding: 0 15px }
dl dd>:first-child { margin-top: 0px }
dl dd>:last-child { margin-bottom: 0px }
pre,code,tt { font-size: 12px; font-family: Consolas, "Liberation Mono", Courier, monospace }
code,tt { margin: 0 0px; padding: 0px 0px; white-space: nowrap; border: 1px solid #eaeaea; background-color: #f8f8f8 }
pre>code { margin: 0; padding: 0; white-space: pre; border: none; background: transparent }
pre { background-color: #f8f8f8; border: 1px solid #ccc; font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px }
pre code,pre tt { background-color: transparent; border: none }
kbd { background-color: #DDDDDD; background-image: linear-gradient(#F1F1F1, #DDDDDD); background-repeat: repeat-x; border-color: #DDDDDD #CCCCCC #CCCCCC #DDDDDD; border-style: solid; border-width: 1px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; line-height: 10px; padding: 1px 4px }
blockquote { border-left: 4px solid #DDD; padding: 0 15px; color: #777 }
blockquote>:first-child { margin-top: 0px }
blockquote>:last-child { margin-bottom: 0px }
hr { clear: both; margin: 15px 0; height: 0px; overflow: hidden; border: none; background: transparent; border-bottom: 4px solid #ddd; padding: 0 }
table th { font-weight: bold }
table th,table td { border: 1px solid #ccc; padding: 6px 13px }
table tr { border-top: 1px solid #ccc; background-color: #fff }
table tr:nth-child(2n) { background-color: #f8f8f8 }
img { max-width: 100% }

三次锁定

lock={}
flag = True
with open("username.txt",encoding="utf8") as f_user,open("locked.txt",mode="a+",encoding="utf8") as f_lock :
    while flag:
        user_name = input("请输入你的帐号:")
        passwd = input("请输入你的密码:")
        f_lock.seek(0)
        f_user.seek(0)
        for user_lock in f_lock:
            if user_lock.strip() == user_name :
                print ("此帐号已被锁定!")
                break
        for user in f_user:
            user_f,passwd_f = user.strip().split("----")
            if user_f == user_name :
                if passwd_f == passwd:
                    print("欢迎回来,"+user_name)
                    flag = False
                    break
                else:
                    if user_name in lock:
                        lock[user_name] +=1
                    else:
                        lock[user_name]=1
                        print("帐号或密码错误!")
                        break
            if user_name in lock and lock[user_name] >= 3:
                print("帐号锁定!")
                f_lock.write(user_name+‘\n‘)
                lock.pop(user_name)
                flag = False
                break
print("----继续----")
时间: 2025-01-02 01:35:18

第二周作业__三次锁定的相关文章

第二周作业__增删改查

html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption

第二周作业第三题_张东明

描述:完成小组的“四则运算”项目的需求文档(使用Markdown写文档),尝试同组成员在各自PC上修改同一文档后,如何使用Git命令完成GitHub上的文档的更新,而不产生冲突.并验证GitHub上的文档确实是最新的文档. 1.将远程库中的文件clone到本地. 2.修改“需求分析.md”,在文件最后面加入“张”,然后上传到远程库. 3.在远程库打开,并验证结果.

魏昊卿——《Linux内核分析》第二周作业:了解操作系统是怎样工作的

魏昊卿——<Linux内核分析>第二周作业:了解操作系统是怎样工作的 一.实验部分 使用实验楼的虚拟机打开shell cd LinuxKernel/linux-3.9.4 qemu -kernel arch/x86/boot/bzImage 然后cd mykernel 您可以看到qemu窗口输出的内容的代码mymain.c和myinterrupt.c 使用自己的Linux系统环境搭建过程参见mykernel,其中也可以找到一个简单的时间片轮转多道程序内核代码 mymain.c myinterr

软件质量与测试第二周作业 WordCount

第二周作业 WordCount 一.Github 地址 https://github.com/llag9810/Software-Quality-and-Testing-Wordcount 二.PSP2.1 表格 PSP2.1 PSP阶段 预估耗时 (分钟) 实际耗时 (分钟) Planning 计划 60 25 · Estimate · 估计这个任务需要多少时间 30 15 Development 开发 600 810 · Analysis · 需求分析 (包括学习新技术) 60 60 · D

解题报告——2018级2016第二学期第二周作业

解题报告——2018级2016第二学期第二周作业 D:迷宫问题 题目描述: 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, }; 它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线. 输入 一个5 × 5的二维数组,表示一个迷宫.数据保证有唯一解. 输出 左上角到右

马哥linux 培训第二周作业

注意:第二周作业,请将以下题目整理在51cto博客当中,完成后请将对应的博文链接地址提交在答案栏中,提交格式如下:学号+姓名+博文链接地址eg:1+张三+http://mageedu.blog.51cto.com/4265610/1794420 本周作业内容:1.Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示. 文件管理的命令有cp.mv.rm 复制命令:cp 用法: cp [-adfilprsu] 来源文件(source) 目标文件(destination) cp [o

第二周作业补交(请老师看一下)

#include<stdio.h> #include<math.h> int main(void) { int money,year; double rate,sum; printf("Enter money:"); scanf("%d",&money); printf("Enter year:"); scanf("%d",&year); printf("Enter rate:

学习linux第二周作业

第二周作业: 本周作业内容: 1.Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示. touch,rm,mv,cp,file,ls,chmod,chown,ln,rename, touch 修改文件atime,如果文件不存在,那么创建该文件. rm:删除文件. -r:循环删除,包含文件和目录 -f:强制删除,布询问. -i:询问是否删除. 默认情况下,系统自带别名,rm=rm -i mv:移动文件,可以在移动的过程中重命名文件或文件夹. 例如:移动重命名mytest1目录为

软件测试第二周作业 wordcount

软件测试第二周作业 wordcount Github地址 https://github.com/mxz96102/word_count PSP2.1表格 PSP2.1 PSP 阶段 预估耗时 (分钟) 实际耗时 (分钟) Planning 计划 25 30 · Estimate · 估计这个任务需要多少时间 150 252 Development 开发     · Analysis · 需求分析 (包括学习新技术) 20 20 · Design Spec · 生成设计文档 0 0 · Desig