Compute XOR - aloalgo

Compute XOR

Very Easy

You are given two booleans p and q.

Your task is to compute the exclusive or (XOR) of p and q.

Note that:

  • XOR returns true when exactly one of the two inputs is true, and false otherwise.

Return the result of p XOR q.

Example 1

Inputs
p = True
q = False
Output
True
Explanation:

Exactly one input is true, so XOR returns true.

Example 2

Inputs
p = True
q = True
Output
False
Explanation:

Both inputs are true, so XOR returns false.

Example 3

Inputs
p = False
q = False
Output
False
Explanation:

Neither input is true, so XOR returns false.

Loading...
Inputs
p = True
q = False
Output
True

Hello! I am your ✨ AI assistant. I can provide you hints, explanations, give feedback on your code, and more. Just ask me anything related to the problem you're working on!