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

用户登录

时间:2018-06-01 00:59:52      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:int   输入密码   style   用户名   IV   while   count   lex   pre   

#用户登录(三次机会重试)
count = 0
while count < 3:
    print(请输入用户名)
    user = input(>>>)
    print(请输入密码)
    pwd = input(>>>)
    if user == alex and pwd == 123:
        print(欢迎登陆)
        print(.........)
        break
    else:
        print(用户名或者密码错误)
    count = count + 1

注意:

  1、缩进和代码块

  2、input取的是字符串

  3、break终止所有循环

 

用户登录

标签:int   输入密码   style   用户名   IV   while   count   lex   pre   

原文地址:https://www.cnblogs.com/silveryhair/p/9119803.html

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