+ 2
Difference between bitwise & , boolean operator AND in python
2 odpowiedzi
+ 5
The & operator is equivalent to the intersection() operation, and creates a new set with elements common to a and b
a = set([1, 2, 3])
b = set([3, 4, 5])
print(a & b)
#->3
&& is used to compare two values
a=True && False
a is false e.t.c
0
Just to add to Brain's excellent answer...
I made this for demonstration for you (although it's a work in progress)
https://code.sololearn.com/W26dgSxWvWCQ/#htm
It demonstrates a binary AND operation, in an interactive way. This will also be how python acts with this operation.
I also created this demonstration in python:
https://code.sololearn.com/cGJ7gRt0ix2J/#py
Any questions, please let me know. I will do my best to answer further. Good luck :-)