nick34992
11/19/2016 - 4:33 PM

Python All Function

Python All Function

#!/usr/bin/env python3

'''
returns 'True' if all iterable elements are True
otherwise, returns 'False'
'''
x = ((4 == 4),(5 < 6),(6 > 5))
y = ((1 == 2),(2 == 2),(3 == 3))

def all(z):
    for iterable in z:
        if not iterable:
            return False
    return True

all(x)
all(y)