- 1. Input, print and numbers
- 2. Integer and float numbers
- 3. Conditions: if, then, else
- 4. For loop with range
- 5. Strings
- 6. While loop
- 7. Lists
- 8. Functions and recursion
- 9. Two-dimensional lists (arrays)
- 10. Sets
- 11. Dictionaries
- 12. JavaScript
- 13. HTML5 and CSS
- 14. Responsive Design with Bootstrap
- 15. jQuery
Ad place
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()
.
12# Read an integer:# a = int(input())XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Input:
3 4 5 2 1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Output:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Saved solutions
Tests
Input | Correct 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 |