VERY FEW Know About THIS Operator in Python 🧐

preview_player
Показать описание
Very few know about this operator in #Python. This one is known as the ior operator. #Shorts
Рекомендации по теме
Комментарии
Автор

in this context I'd call it the union operator

duccie
Автор

Its simple set theory
The | operator works as "Union" of the set I.E. returning all the unique elements of both sets combined, similarly the & operator must return the intersection of both sets. It is so because of how it works in probability and combinatorics if you've noticed.
Like if there are cases in combinatorics then you have to use the or operator and add the unique events, that leads to union and if you need two conditions to be true at once you use "and" in the sense of finding the intersection.

AryanSingh-vwry
Автор

This is such a great way to learn python! Thanks mate, keep it up!!!

gfher
Автор

i thought this is only for match case. thanks for the info again

sudo
Автор

Can u do that as matrix
A={1 2 3 4}
B={6 7 8 9}

Result:

1 2 5 6
3 4 7 8

Not_Yetz
Автор

Union, Intersection, Difference And Symmetric Difference Are The Set Operators I Know....

callme.reaper
Автор

Is | and |= any different from + and +=?

xEvD
Автор

That's not bitwize operation that's just set union.

lefteriseleftheriades
Автор

So whats the point?
A use case for stuff like this would be nice to understand.

felixbemme
Автор

This is what you get when you mix up bitwise operators with set operators...
This guy needs to first learn what operator overloading is...

ErikS-