My function is below
def majority(x):
if x > 17:
return True
return False
Sample lambda pseudo-code
majority = lambda x: if x > 17 return True ? False
You need to provide an expression. You can do this with python's "conditional expressions"
majority = lambda x: True if x > 17 else False
however, this just simplifies to
majority = lambda x: x > 17
Conditional expressions are of the form
value_if_true if condition else value_if_false
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.