#!/usr/bin/env python

# coding:utf-8

__author__ = "lvah"

 

'''

@author:linwei

@file:linwei.py

@contact:xc_123456789@qq.com

@time:6/26/179:33 AM

@desc

'''

i = 0

for i in range(0, 3):

    username = raw_input("user:")

    password = raw_input("password:")

    if (username == 'root') and (password == 'redhat'):

        print ("                             ")

        print ("welcome to user manage system")

        break

    elif (username != 'root') or (password != 'redhat'):

        print ("密码错误,请重新输入")

        i = i + 1

else:

    print ("                             ")

    print ("你已经登陆过三次请10分钟后再登陆")

 

测试

wKioL1lSYxehkzPDAABPEGPqgws452.png-wh_50

wKiom1lSYxixbwl3AACYNa-Sd8k177.png-wh_50