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

简单的登录程序

时间:2016-08-01 12:22:01      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:

本文主要实现:登录,三次输入错误后自动退出

代码:

#!/usr/bin/env python
# -*- coding:utf-8 -*-
count=0
while count<3:
    user=raw_input(‘please input your username:‘)
    pwd=raw_input(‘please input your password:‘)
    if user==‘lh‘ and pwd==‘123‘:
        print ‘Success!‘
        break
    else:
        count+=1
        if count<3:
            print ‘Please input again!‘  
        if count==3:
            print ‘Too many times!‘

运行结果:

技术分享技术分享

 

简单的登录程序

标签:

原文地址:http://www.cnblogs.com/pythonlh/p/5725204.html

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