If you’re already normalizing the inputs to booleans, then != is xor.
bool(a) != bool(b)
More Related Contents:
- Many logical ‘AND’ operators in a row in Python
- How do “and” and “or” act with non-boolean values?
- and / or operators return value [duplicate]
- Element-wise logical OR in Pandas
- Parsing text file (Python)
- Why does the division get rounded to an integer?
- How to “log in” to a website using Python’s Requests module?
- Iterating on a file doesn’t work the second time
- Convert Python sequence to NumPy array, filling missing values
- Working with an Access database in Python on non-Windows platform (Linux or Mac)
- Weighted random selection with and without replacement
- Split by comma and strip whitespace in Python
- Selenium: FirefoxProfile exception Can’t load the profile
- Matplotlib: How to plot images instead of points?
- How to remove parentheses and all data within using Pandas/Python?
- Shuffle an array with python, randomize array item order with python
- TypeError: list indices must be integers or slices, not str
- Replace part of a string in Python?
- How to make a python, command-line program autocomplete arbitrary things NOT interpreter
- pip installs packages successfully, but executables not found from command line
- Delete Characters in Python Printed Line
- Module ‘tkinter’ has no attribute ‘Tk’
- How to restore a builtin that I overwrote by accident?
- Plotting a stacked Bar Chart
- PyQt4 to PyQt5 -> mainFrame() deprecated, need fix to load web pages
- Check collision between a image and a line
- Python TypeError: unsupported operand type(s) for ^: ‘float’ and ‘int’
- convert selected datetime to date in sqlalchemy
- Multiprocessing useless with urllib2?
- What is the naming convention in Python for variables and functions?