Start free

Beginner · Conditions · 57 of 264

In order

Read two whole numbers and print them from the smaller to the larger, on one line.

Input: two whole numbers, one per line. Output: the two numbers in ascending order, separated by a space.

Examples

Input
9
3
Output
3 9
Input
1
2
Output
1 2
Input
-5
-8
Output
-8 -5

One more test checks other inputs when you press Check.

Stuck? The idea behind conditions

An if statement runs its indented lines only when the condition is true; elif tries another condition; else catches everything left.

Compare with == (equal), != (not equal), <, <=, >, >=, and join conditions with and, or, not.

n = int(input())
if n > 0:
    print("positive")
elif n < 0:
    print("negative")
else:
    print("zero")

Watch for: = gives a value, == compares. And the order of elif matters: the first true one wins, so test the narrow case first.

All the conditions exercises
Your code
Opening the code editor…
Python 3.14 in your browser
Output
Run shows what your program prints. Check tests it on every example and the hidden tests.

More conditions exercises