def sort(nums):
for i in range(5):
minpos = i
for j in range(i,6):
if nums[j] < nums[minpos]:
minpos = j
temp = nums[i]
nums[i] = nums[minpos]
nums[minpos] = temp
nums = [5,3,8,6,7,2]
sort(nums)
print(nums)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter