python小白周记 第一周4.25 10.36

xiaoxiao2021-02-28  36

作业:编写登录 1:输入用户名密码 2:认证成功后显示欢迎信息 3:输入三次后跳出

count=0 

while count<3:

 username=input('username:') password=input('password:') if username=='hanbinlong' and password=='han123': print('Welcome to the program and authentication is successful') break else: print('Big brother is going the wrong way') if count==2: break count=count+1

注意:要认识图中所有的单词,还有句式的格式 包括语法的使用 我的流程图: 第一步:先input一个 username,password 第二步:然后采用if语句  输入的是 用户名‘hanbinlong’,密码‘han123’输出‘欢迎来到程序,并且验证成功’然后跳出。 如果不是正确的输入 输出“大兄弟你走错了” 第三部:循环  利用while语句  先让count=0 错误循环三次跳出 因此最后跳出  count==2
转载请注明原文地址: https://www.6miu.com/read-2622271.html

最新回复(0)