Lambdas can only contain a single expression, not a sequence of statements. They are intended for small functions that calculate a value. If your code goes beyonf that, it’s better to write a regular function, not a lambda.
Having said that, in your particular case you can do something like this:
printer = lambda: print("hello\nworld")
or:
printer = lambda: (
print("hello"),
print("world")
)
That would work, but it really doesn’t make much sense. The first lambda always returns None, the second returns a tuple of None (you would simply ignore these in your code when calling the lambda).
lambdacan only be one line. This is a feature that a lot of people have been asking for for a long time, but I doubt it would be added soon, since that would undermine the reasonlambdawas added in the first placelambdas are for...