← back to unit
Easy
# sorting easy
Smallest to the Front
The tiniest duckling leads the parade — find it and swap it to the front! 🦆
You get a list of nums (at least one). Find the position of the smallest value, swap it with position 0, and print the list, comma-separated.
Example:
Input: nums = [5, 3, 8, 1, 9]
Output: 1,3,8,5,9
The smallest value is 1, sitting at index 3 — swap it with index 0, and everything else stays put: [1, 3, 8, 5, 9].
💡 need a hint?
sort-smallest-front.py🔒 given lines are locked — write your code in between
loading...