Tutorial example to check whether values are even or odd. More...
Go to the source code of this file.
Functions | |
| def | parity (number) |
Variables | |
| values = sys.argv[1:] | |
| fmtlen = max([len(fmt) for fmt in pfmt(values,width=1).split('\n')]) | |
Tutorial example to check whether values are even or odd.
Definition in file even.py.
| def even.parity | ( | number | ) |
Prints if a value is even/odd/neither per each value in a example list
This example is made for newcomers and motivated by:
- modulus is unsupported for pyscipopt.scip.Variable and int
- variables are non-integer by default
Based on this: #172#issuecomment-394644046
Args:
number: value which parity is checked
Returns:
sval: 1 if number is odd, 0 if number is even, -1 if neither