Some help in my moment of stupidness
<p>so I have this project that's due and for one of the questions, after doing all the calculations, you compare two different booleans. So, if both booleans are true the answer will return false, and if both booleans are false it will return false, and it will only return true if one of the booleans are true and the other is false (doesn't matter which)</p>

<p>So lets say the two booleans are A and B</p>

<p>My code looks like this
return A != B</p>

<p>His code looks like this
return ((A and not B) or (B and not A))</p>

<p>Who is right? Are we both right?
Hes like a lot smarter than me so im just wondering if I did some stupid mistake</p>

<p>In my opinion, both of you are right.
But I think your answer is more simple. </p>

<pre><code>def fun(a,b):
    result = a ^ b
    #your code
    resultA= a!=b
    #your friend's code
    resultB= (a and not b) or (b and not a)

    print result
    print resultA
    print resultB
    print '-'*20

a = False
b = False
fun(a,b)

a = True
b = False
fun(a,b)

a = False
b = True
fun(a,b)

a = True
b = True
fun(a,b)
</code></pre>

<p>OUTPUT:</p>

<pre><code>False
False
False
--------------------
True
True
True
--------------------
True
True
True
--------------------
False
False
False
--------------------
</code></pre>

python boolean logic