Python Xor

Python program to Illustrate xor operator (A xor A ==> 0)

Sample Input 1:

6

Sample Output 1:

0

Sample Input 2:

28

Sample Output 2:

0

Try your Solution

Strongly recommended to Solve it on your own, Don't directly go to the solution given below.

#write your code here

Program or Solution

				
			
					
num=int(input("enter the number:"))
num=num^num
print("num value is :{}".format(num));

			
				
			

Program Explanation

XOR any value with the same produces zero.

Comments