First of all, let me say that
if (a % 2 and b % 2) != 0:and
if a % 2 and b % 2:have same outcome, as you can see
for a, b in ((3, 5), (2, 5), (5, 2), (4, 2)): print((a%2 and b%2) != 0) print(a%2 and b%2)
Output:True
1
False
0
False
0
False
0
I didn't claim it will do what is required in the exercise, just it will do the same as the original code.def min_max(a, b): if a%2 or b%2: # at least one is odd return max(a,b) else: return min(a, b)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs