Code Explanation:
Function Definition:
is_positive is a lambda function that takes one argument, x.
It evaluates the condition x > 0 and returns True if x is greater than 0, and False otherwise.
Calling the Function:
The function is_positive is called with the argument -10.
Inside the lambda function, the condition -10 > 0 is evaluated.
Condition Evaluation:
The condition -10 > 0 is False because -10 is less than 0.
Assigning the Result:
The result of the condition (False) is stored in the variable result.
Printing the Result:
The print(result) statement outputs the value stored in result, which is False.
Output
False
0 Comments:
Post a Comment