DML School of Technology
Menu

First steps, Numbers

Odd or even

The task

Return true if the number is even and false if it is odd. Zero is even; negative numbers can be either.

Hint: the remainder operator %.

Write a function called is_even.

Tests

CallExpectedYours
is_even(4) True not run
is_even(7) False not run
is_even(0) True not run
is_even(-3) False not run
is_even(-10) True not run

Next challenge · All challenges

solution.py

Tab indents. To leave the editor, press Escape, then Tab.

Output

Run prints what your code prints. Run the tests to check your function.