How can I make a lambda expression to check for X?
lambda we need to write consists of three key parts:
- The keyword
lambdaat the beginning:
lambda … …
- The variable you want to operate on, followed by a colon:
lambda var_name: …
- The variable expression, where you can check for condition to be met by your variable:
lambda var_name: var_name == some_condition
If we want to check if our
lambda’s variable is equal to the character
”X”, we’d do that in the third part of our lambda.