how to sum boolean python code example
Example 1: number of true in a list
booleans = [False, True, True, False, False]
sum(booleans)
Example 2: python how to count number of true
true_count = sum(a_boolean_list)
booleans = [False, True, True, False, False]
sum(booleans)
true_count = sum(a_boolean_list)