Ad

You will be given numbers and the task is to return even numbers as they are, but subtract 1 from odd numbers.

So if you get 4 you return 4. If you get 23 you return 22.

Your solution should be 22 or less characters long.

def e(n): return n-n%2

You will be given numbers and the task is to return odd numbers as they are, but subtract 1 from even numbers.

So if you get 3 you return 3. If you get 24 you return 23.

Your solution should be 27 or less characters long.

def o(n): return n-(n%2==0)