Python: how to use lambda functions?
Example:
numbers = [1, 2, 3, 4, 5]
Lambda functions are small, anonymous functions defined with the lambda keyword.
Solution:
doubled = list(map(lambda x: x * 2, numbers))
Example: Solution:Python: how to use lambda functions?
Lambda functions are small, anonymous functions defined with the lambda keyword.
numbers = [1, 2, 3, 4, 5]
doubled = list(map(lambda x: x * 2, numbers))