company = "ibm" # 全局变量
country = "china"
def change_name(name):
global country # 这样的话 虽然是函数内部 但是country全局生效 但是永远不要使用这个 程序复杂之后 无法定位和调试
country = "usa"
company = "hp"
print("before change", name, company)
name = "Aone" # 局部变量只在函数内部生效
print("after change", name)
name = "coca"
change_name(name)
print(name)
print(company)
print(country)