美文网首页
python_while_if_break

python_while_if_break

作者: david_6522 | 来源:发表于2018-04-24 16:00 被阅读0次

    要求:输入用户名和密码,超过三次不正确退出

    #!/usr/bin/env python

    # -*- coding: utf-8 -*-

    name ='david'

    passwd ='haodf666'

    count =0

    while count <3:

        n =input("please input your name: ")

        p =input("please input your password: ")

        if name == nand passwd == p:

            print("welcome to U")

            break

        else:

            print("__your name or passwd is wrong__")

            count +=1

    else:

            print("###### you tried too many times .good bye ######")

    相关文章

      网友评论

          本文标题:python_while_if_break

          本文链接:https://www.haomeiwen.com/subject/ifujlftx.html