Functions · Python exercise
Write and call a function that returns True for even numbers.
Define a function named is_even that takes one integer and returns True when it is even, otherwise False. Read an integer, call the function, and print its result.
Example 1
Input
4
Output
True
Example 2
Input
7
Output
False
How testing works
Your code runs once per test case with that case's standard input. Output is compared after normalising trailing spaces and blank lines at the end. Use input() without a prompt when the exercise expects clean output.
Loading editor…
Press Run tests to execute your code against every input case. Python runs in a Web Worker in your browser.