Is there any way to compare the list elements and return the outcome value ? Below is the python snippet, where it recieves two values and returns the value.
def logical_or_decision(a,b):
return a or b
value = logical_or_decision(1,0)
print value
I need to make it generic & scalable to more than 2 elements.How can i do it for more than 2 elements ?
best solution ^^above^^:
any
is good because "short-circuits" (like "boolean fast evaluation" it doesn't iterate till the end).If you want things alike but manually and eager - see reduce: