Skip to the content

Is it even?

Problem

Write a function that takes a whole number and returns true if it's even and false if it isn't. Watch out for negative numbers.

Examples

  • 4 → true

  • 7 → false

  • 0 → true

Besides these, the challenge has hidden tests that are revealed when you submit your solution.

You start with this

Python

def is_even(n):
    pass

JavaScript

function isEven(n) {
}
Solve this challenge

It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.

More O(1) challenges

See all challenges →