Problem

Write a one-line function is_even() that returns True is the input value to the function is an even number, and False otherwise. For example,

is_even(3)
False

Solution

Python
def is_even(num): return num%2 == 0

Comments