函数的嵌套与迭代

 函数的嵌套

# 函数嵌套
def index():
    print('from index')

def home():
    print('from home-1')
    index()
    print('from home-2')

home()
def compare(x, y):
    if x > y:
        return x
    else:
        return y


def get_max(*args):
    args = list(args)
    if len(args) > 2:
        result = compare(args[0], args[1])
        args[1] = result
        return get_max(*args[1:])
    elif len(args) == 1:
        return args[0]
    else:
        return compare(args[0], args[1])
迭代-找最大值
原文地址:https://www.cnblogs.com/Ghostant/p/11834814.html