← Back to challenges

Using Lambda Functions

PythonMediumdata_structureslanguage_fundamentals

Instructions

Create a function that returns its given argument, but by using a lambda function.

A lambda function is constructed like so:

lambda_func=lambda """parameters""":#code here

Examples

lambda_func(3) ➞ 3

lambda_func("3") ➞ "3"

lambda_func(True) ➞ True

Notes

Check the Resources tab for more information on lambda functions.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Pair Management