Python Bitwise OR

Description

Python Program to illustrate bitwise OR operator
Sample Input:
1 
4
Sample Output:
5

Solution

num1=int(input("Enter your First Number:"))
num2=int(input("Enter your Second Number:"))
num=num1|num2
print("After Bit Wise Or: {}".format(num))

Explanation

1 | anything = 1
0 | 0 = 0



Interesting Pattern Programs: for more Patterns

Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution
Input:
5
Output:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *Solution
Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution
Input:
5
Output:
*********
 *******
  *****
   ***
    *
   ***
  *****
 *******
*********Solution