+ 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"

29th Sep 2020, 2:29 AM
Ifthekher
Ifthekher - avatar
2 Réponses
+ 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
29th Sep 2020, 3:03 AM
Hojiakbar
Hojiakbar - avatar
+ 1
and is used for logic you cant assign values with and.
29th Sep 2020, 3:04 AM
Roderick Davis
Roderick Davis - avatar