Is it even?
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
This one builds on a lesson you haven't finished yet. Do that lesson first:
Python Basics · Functions →
Is it even?
A whole number is even when dividing it by 2 leaves no remainder. The % (modulo) operator gives that remainder, so 8 % 2 is 0 but 7 % 2 is 1.
Difficulty 1/5 · 100 coins + a small bonus on first completion today
Write is_even(n) that returns True when n is even and False otherwise. Hint: use n % 2.
Click Run to see the output here.