with open('data') as f:
    next(f)
lines = [[int(n) for n in x.strip().split()] for x in f if x.strip()]
count = 0
for row in lines:
    if all(row):
        count += 1
print('All present:', count)
count = 0
for row in lines:
    if not row[0] and all(row[1:]):
        count += 1
print('All except first column are 1:', count)
Computing the combinations for presence or absence of a factor in a table