Can lambda expression has multiple lines in Python? Like common functions.
Can I do something like that?
res = lambda x y:
z = x**2 + 5
z + x + y
(I know that this function can be written on one line, It's an example)
They can be split across multiple lines by the same rule that any expression can be split across multiple lines. You can use backslash \ to prevent a linebreak ending the current statement, or use the fact that linebreaks are permitted within the various forms of brackets: (), [], {}.
However, a lambda expression is just that, an expression. It cannot contain assignment statements (or any other statements).
The precise details are defined by the Python grammar.
def.lambdafunction is that it can be define in-line. If you want to use a multi line function you can simply use regular functions withdef.