- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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.
Advertisements