I am using the all function where I am evaluate if one item in the list would make the entire list false.
Where I am confused is the first print statement returns false
which is correct but the second returns True
which is incorrect to my understanding. If all in the list are 0's then they both report true. I don't understand why the second print outputs true
when the list does not equal 0, because the last element is 1.
list_1 = [0,0,0,1]
print(all(ele == 0 for ele in list_1))
print(all(list_1) == 0)