wow_89
1
Hi!

I would love if someone would explain what this code exactly does.

def xor(x, y):

if x:

if y:

return False

return True

return True

I believe that it returns true if x is true, and false if y is false…But it’s strange and doesn’t make any sense to me :S

Thanks!

mtf
2
If x is True and y is True it returns False as given.

If x is False there is no action, only the return, which is True

If x is True and y is False then the return is True, as given.

mtf
3
```
def xor(x, y):
if x:
if y:
return False
return True
return True
```