전역 변수는 대문자, 국부 변수는 소문자로

2431 단어

NAME=['cat','dog'] def change_name(): global NAME name='parrow' print('my name is ',name) change_name() print(NAME)
       
1 NAME ='cloud' def huangwei(): 3 name='rain' 4 print(name) def liuhai(): 6 name ="black" 7 print(name) def muuli(): 10 name='white' 11 print(name) 8 print(name) 9 muuli() 5 liuhai() 12 print(name) 2 huangwei()

 
전재 대상:https://www.cnblogs.com/wfl9310/p/8946825.html

좋은 웹페이지 즐겨찾기