python入门之函数的嵌套
函数的嵌套调用
在函数内调用函数
def index():
    print('from index')
 
 
def func():
    index()
    print('from func')
 
 
func()
def funcl(x, y):
    if x > y:
        return x
    else:
        return y
 
 
print(funcl(1, 2))
 
 
def func2(x, y, z, a):
    result = funcl(x, y)
    result = funcl(result, z)
    result = funcl(result, a)
    return result
 
 
print(func2(1, 200000, 3, 1000))
函数的嵌套定义
def index():
    def home():
        print('from home')
    home()
 
 
index()

 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号