Skip to the content

The larger of two

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):
    pass

JavaScript

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.

More O(1) challenges

See all challenges →