Google News
logo
Python Program to A lambda function that adds 10 to the number passed in as an argument
In the following example of Python program that defines a lambda function that adds 10 to the number passed in as an argument :
add_ten = lambda x: x + 10​

This lambda function takes a single argument `x` and returns the result of adding 10 to it. Here's an example of how to use it :
Program :
add_ten = lambda x: x + 10
result = add_ten(5)
print(result)
Output :
15
In the above example, we pass the value `5` to the `add_ten` lambda function and assign the resulting value to the variable `result`.

The `print()` statement then outputs the value of `result`, which is `15`.