Volume 71 | Issue 8 | Year 2025 | Article Id. IJMTT-V71I8P108 | DOI : https://doi.org/10.14445/22315373/IJMTT-V71I8P108
Received | Revised | Accepted | Published |
---|---|---|---|
21 Jun 2025 | 29 Jul 2025 | 16 Aug 2025 | 31 Aug 2025 |
Sanjay M Chinchole, "An Algorithm for the XOR Operation in Python Programming," International Journal of Mathematics Trends and Technology (IJMTT), vol. 71, no. 8, pp. 49-53, 2025. Crossref, https://doi.org/10.14445/22315373/IJMTT-V71I8P108
Bitwise operators are fundamental tools used in computer science programming. The Exclusive OR operator is one of the bitwise operators. It is a binary operator, also known as the XOR operator, which plays a vital role in computer programming. When the XOR operator operates on two different input bits, it results in a value ‘true’ (or ‘1’). Otherwise, it results in a value ‘false’ (or ‘0’). It has been helpful in many applications such as error detection, cryptography, digital circuit design, etc. In Python, the logical operation XOR compares two Boolean values. It results in ‘1’ if exactly one of the two binary inputs is ‘1’ and results in ‘0’ otherwise. The caret symbol (^) is used to denote this operation in Python. The XOR bitwise operation can be performed on two integers. This article explains the mechanism of the XOR operator and presents a simple algorithm to manually compute the logical XOR of two variables in Python.
Decimal to binary conversion, Bitwise operator, Cryptography, Python programming, Algorithm.
[1] M.F. Sanner, “Python: A Programming Language for Software Integration and Development,” Journal of Molecular Graphics and
Modelling, vol. 17, no. 1, pp. 57-61, 1999.
[Google Scholar] [Publisher Link]
[2] A. Bogdanchikov, M. Zhaparov, and R. Suliyev, “Python to Learn Programming,” Journal of Physics: Conference Series, vol. 423, no.
1, 2013.
[CrossRef] [Google Scholar] [Publisher Link]
[3] Anil K. Maini, Digital Electronics: Principles, Devices and Applications, John Wiley & Sons, 2007.
[Google Scholar] [Publisher Link]
[4] Allen Downey, Think Python: How to Think Like a Computer Scientist (Version 2.4. 0), Green Tea Press, 2015.
[Google Scholar] [Publisher Link]
[5] Rydhm Beri, Python Made Simple: Learn Python Programming in Easy Steps with Examples, 2019.
[Google Scholar] [Publisher Link]