Can someone explain this output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone explain this output

x= [0,0,0] y=[1,1,1] b=x and y print(not b) my question is what exactly is happening under the hood. I knwo that b is taking the output of y, but I am not sure why instead of x? My next question is how to print True instead of False. I explain to myself that when not b, they mean 1,1,1 is true value, should be false but please let me know what do you think about my observations

26th Nov 2019, 4:54 PM
THEGreatGatsby
THEGreatGatsby - avatar
1 Answer
+ 3
Every list that is not empty, evaluates as True. So both x and y are True. So b is True. So not b is False.
26th Nov 2019, 5:05 PM
HonFu
HonFu - avatar