summaryrefslogtreecommitdiff
path: root/doc/data/messages/c/consider-using-any-or-all/bad.py
blob: 7fd48f6f5243a55bfeb6dca242ca5d37fe894a0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
def any_even(items):
    """Return True if the list contains any even numbers"""
    for item in items:  # [consider-using-any-or-all]
        if item % 2 == 0:
            return True
    return False


def all_even(items):
    """Return True if the list contains all even numbers"""
    for item in items:  # [consider-using-any-or-all]
        if not item % 2 == 0:
            return False
    return True