Skip to content

Instantly share code, notes, and snippets.

View gj84's full-sized avatar

German Jimenez gj84

  • Córdoba, Argentina
View GitHub Profile
@gj84
gj84 / one.py
Created February 28, 2014 04:27
def nessitas_one(iterable): #fixed
"""Return the object in the given iterable that evaluates to True.
If the given iterable has more than one object that evaluates to True,
or if there is no object that fulfills such condition, return None.
>>> nessitas_one((True, False, False))
True
>>> nessitas_one((True, False, True))
False