zoukankan      html  css  js  c++  java
  • 登录操作(方法一:设置flag标志位)

    登录操作(方法一:设置flag标志位)

    user_name="star"
    passwoed='123'
    passed_authentication=False
    count=0
    for i in range(3):
    u_username=input("please input your username:")
    u_password=input("please input your password:")

    if u_username==user_name and u_password==passwoed:
    print("welcome to %s"%u_username)
    passed_authentication=True
    break
    else:
    count+=1
    print("your username or password is Error")
    if not passed_authentication:
    count==3
    print("you have try more times,would you want to try again? please input yes or no,please choose")
    answer=input("your choose:")
    if answer=='yes':
    print("go away,hahahah")

    Input:正确操作

    please input your username:qwe
    please input your password:222
    your username or password is Error
    please input your username:star
    please input your password:123
    welcome to star

    进程已结束,退出代码0

    Output:错误操作

    please input your username:aa
    please input your password:aa
    your username or password is Error
    please input your username:aa
    please input your password:aa
    your username or password is Error
    please input your username:aa
    please input your password:aa
    your username or password is Error
    you have try more times,would you want to try again? please input yes or no,please choose
    your choose:yes
    go away,hahahah

    进程已结束,退出代码0

  • 相关阅读:
    Linux查看磁盘空间大小
    Qt常见错误
    顺序查找和二分查找代码
    字典树——动态&&静态
    Linux本机和远程服务器之间文件的上传和下载 rz sz
    牛顿迭代法——C语言
    MFC之ListControl选中行删除
    MFC之登录框的问题处理
    MFC之创建多级动态菜单
    c++动态内存知识总结与疑问
  • 原文地址:https://www.cnblogs.com/startl/p/11732178.html
Copyright © 2011-2022 走看看