1. Just a Little BIT - What is XOR?


#1

https://www.codecademy.com/courses/python-intermediate-en-KE1UJ/0/1?curriculum_id=4f89dab3d788890003000096

I get the whole concept of this. And I understand the shift, the and, the or, and the not, what I don't understand is what is XOR? I have never heard of this, what is it used for?

print 5 >> 4  # Right Shift
print 5 << 1  # Left Shift
print 8 & 5   # Bitwise AND
print 9 | 4   # Bitwise OR
print 12 ^ 42 # Bitwise XOR
print ~88     # Bitwise NOT

#2

the XOR operator is explained later in this lesson, you can wait or jump ahead if you want, whatever you see fit


#3

Ohhh ok, it's similar to anding. I was just curious considering I'm already quite proficient in binary and hex (hexadecimal), and never once have I heard someone refer to that specific operation as XOR.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.