is_even

iteration_utilities.is_even(value, /)

Returns True if value is even, otherwise False.

Parameters:

value : any type

The value to test if even.

Returns:

is_even : bool

True if value is even otherwise it returns False.

Examples

This function is equivalent to lambda x: not x % 2 but significantly faster:

>>> from iteration_utilities import is_even
>>> is_even(0)
True
>>> is_even(1)
False
>>> is_even(2)
True