Is it even?
- O(1) · Trivial
- Free
- Python
- JavaScript
- operations
- booleans
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):
passJavaScript
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.