Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
in python 3|4 =7. how its will come? kindly explain

What I have tried:

in python 3|4 =7. how its will come? kindly explain
Posted
Updated 7-Apr-23 11:41am

I'm afraid you've landed in a Quick Answers forum not a tutorial site. I suggest starting here .. Bitwise Operators in Python – Real Python[^] to get an understanding of the bitwise OR operator
 
Share this answer
 
| is the python bitwise OR operator[^]
So if you take 3 (binary 011) and OR it with 4 (binary 100) the result is binary 111 which in decimal numbering is 7.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900