码迷,mamicode.com
首页 > 其他好文 > 详细

login_while

时间:2020-07-27 15:35:26      阅读:67      评论:0      收藏:0      [点我收藏+]

标签:counter   else   utf-8   密码   name   com   keep   pre   input   

# -*- coding: utf-8 -*-
# @Time    : 2020/7/25 22:45
# @Author  : Breeze
# @FileName: login_while.py
user_name = "Breeze"
password = "123456789"

counter = 0
while counter < 3:
    get_username = input("请输入用户名:")
    get_password = input("请输入密码:")
    if get_username == user_name and get_password == password:
        print("Welcom %s login...." % user_name)
    else:
        print("Invalid username or password!")
    counter += 1

    if counter == 3:
        keep_going_choice = input("还想玩吗?[y/n]")
        if keep_going_choice == "y":
            counter = 0
else:
    print("臭不要脸!")

 

login_while

标签:counter   else   utf-8   密码   name   com   keep   pre   input   

原文地址:https://www.cnblogs.com/wxx123/p/13384832.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!