python成长之旅7

一、tag编程方法

定义一个全局变量,如果全局变量等于False。则退出整个程序。

 

        
*     tag编程方法
    etc:
            tag = True
            while tag:
                    print('levl1')
                    choice = input('levl1>>>>:').strip
                    if choice == 'quit':
                        break
                    while tag:
                        print('levl2')
                        choice = input('levl2>>>>:').strip
                        if choice == 'quit':
                            break
                        while tag:
                            print('levl3')
                            choice = input('levl3>>>:').strip
                            if choice == 'quit'
                                break
                        
                if choice == 'quit_all':
                    tag = False

 

posted @ 2018-11-22 00:38  格子衫的番茄炒蛋  阅读(76)  评论(0编辑  收藏  举报