1. 程式人生 > >python成長之旅7

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