yeolyi.comSeongyeol's CS

Lab

Python

Run Python code one line at a time and see the variables at each step. Edit the code freely and it runs and records again. Loading Python takes a moment the first time.

1nums = [14, 3, 27, 8, 21]
2for start in range(len(nums) - 1):
3 smallest = start
4 for i in range(start + 1, len(nums)):
5 if nums[i] < nums[smallest]:
6 smallest = i
7 nums[start], nums[smallest] = nums[smallest], nums[start]
8print(nums)

No variables
No output