This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def one(iterable): | |
""" | |
Return X if X is the only one value where bool(i) is True for | |
each every i in the iterable. In any other case return None. | |
>>> one((True, False, False)) | |
True | |
>>> one((True, False, True)) | |
False | |
>>> one((0, 0, 'a')) |