Smaller Number First

Python FundamentalsMedium+10 XP+10

Smaller Number First

A scoreboard always shows two numbers as a list, smaller one first.

Task: write smaller_first(a, b) that returns a list holding a and b, with the smaller number first.

  • If the two numbers are equal, return them both (for example [5, 5]).

Examples

a = 9
b = 4
returns [4, 9]
a = 2
b = 7
returns [2, 7]

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run