[Python] lambda functions as higher-order functions

Discussão em 'Python' iniciado por Stack, Agosto 18, 2025.

  1. Stack

    Stack Membro Participativo

    I'm learning about higher-order functions, specifically lambda functions in Python. I understand lambda functions to an extent, but a little confused about this lambda higher-order function example.

    Why am I getting 6 as the output, I'm just trying to understand this mathematically

    >>> high_ord_func = lambda x, func: x + func(x)
    >>> high_ord_func(2, lambda x: x * x)
    6


    I got this problem from Real Python article. Please, I just want to make sense of this, thank you

    Continue reading...

Compartilhe esta Página