passwd = 'test'                         创建一个变量

logout_flag = False                   如果登录等于假,继续输入密码

for i in range(4):                        循环4次

        user_input = raw_input("please input your passwd:").strip()    赋值用户输入passwd次数

        if len(user_input) == 0:continue       从0开始计入次数,continue 持续的意思                  

        if user_input == passwd:                 判断用户输入密码

                while True:                               如果为真则登录  选择如下选项

                        print "welcome login!"

                        user_choice = raw_input('''

                                1. run a cmd

                                2. send a file

                                3. exit this level

                                4. exit the whole system

                                ''').strip()

                        user_choice = int(user_choice)

                        if user_choice == 1:                             直到循环到4次之后推出

                                print "going to run cmd"

                        if user_choice == 2:

                                print "going to sed a file"

                        if user_choice == 3:

                                print "going to exit this level"

                                break

                        if user_choice == 4:

                                logout_flag = Ture

                                break                                                       break代表退出while True:循环

        if logout_flag:

                                print "going to logout"

                                break                                                            break代表退出for循环

        print "---going to do something else...."