local and global variables
# coding:utf-8
local and global variables
ahead = 'HelloWorld' # global variable
showList = [] # global variable
def printAhead():
print(ahead)
def printOther():
city = 'beijing' #city is a local variable
print(city + ahead)
def printList():
global showList #global means to refer to global variables, no way, if you don't write it, showList will become a local variable
showList.append(1)
showList.append(2)
print(showList)
printAhead()
printOther()
printList()