+ 1
How "and" operator is working here?
x = [0,0,0] y = [1,1,1] b = x and y print(not b) output:False Now my question is, why b = [1,1,1] and output is "False"
2 Answers
+ 6
x=[0,0,0]
# x=True as x contains 3 elements and x is not an empty list.
# y=True the same as x.
#x and y =True * True = 1*1=True.
print(not b=not True)
#False
+ 1
and is used for logic you cant assign values with and.