The larger of two
- O(1) · Trivial
- Free
- Python
- JavaScript
- conditionals
Problem
Write a function that takes two numbers and returns the larger one. If they are equal, return either one of them.
Examples
3, 7 → 7
10, 2 → 10
-1, -5 → -1
Besides these, the challenge has hidden tests that are revealed when you submit your solution.
You start with this
Python
def larger(a, b):
passJavaScript
function larger(a, b) {
}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.