
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to bitwise XOR of hex numbers in Python?
You can get the XOR of any type of numbers using the ^ operator. Specifically for hex numbers, you can use:
a = 0x12ef b = 0xabcd print(hex(a ^ b))
This will give the output:
0xb922
The 0x at the beginning of the numbers implies that the number is in hex representation. You can use the ^ operator for other integer representations as well.
- Related Questions & Answers
- Bitwise XOR in Arduino
- Program to find XOR sum of all pairs bitwise AND in Python
- What is Bitwise XOR in C++?
- What is JavaScript Bitwise XOR (^) Operator?
- What is Bitwise XOR Operator (^) in JavaScript?
- What is Bitwise XOR Assignment Operator (^=) in JavaScript?
- Bitwise AND of Numbers Range in C++
- Program to find bitwise AND of range of numbers in given range in Python
- How to perform Bitwise XOR operation on two images using Java OpenCV?
- Working with hex numbers in MySQL?
- Python program to print decimal octal hex and binary of first n numbers
- Count pairs with Bitwise XOR as EVEN number in C++
- Count pairs with Bitwise XOR as ODD number in C++
- How to Convert Hex String to Hex Number in C#?
- How to convert hex string into int in Python?
Advertisements