Solve problem "Swap min and max" online - Learn Python 3 - Snakify

Swap min and max


Statement

Given a list of unique numbers, swap the minimal and maximal elements of this list. Print the resulting list.

In all the problems input the data using input() and print the result using print().

# Read an integer:
# a = int(input())
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Input:
3 4 5 2 1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Output:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Saved solutions

Tests

InputCorrect answer
3 4 5 2 1
3 4 1 2 5
1 5 4 3 2
5 1 4 3 2
-30000 30000
30000 -30000
1
1
2147483647 -2147483648
-2147483648 2147483647
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 17 16 15 14
18 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 17 16 15 14
1 2 3 4 5 6 7 8 9 10
10 2 3 4 5 6 7 8 9 1
10 9 8 7 6 5 4 3 2 1
1 9 8 7 6 5 4 3 2 10