File: class/Workbook/Examples/Lecture5/scopes1.py

X = 99            # X and func assigned in module
          
def func(Y):      # Y and Z assigned in function
    Z = X + Y     # X not assigned: global
    return Z

func(1)           # func in module: result=100



[Home page] Books Code Blog Python Author Train Find ©M.Lutz