Generation

generate functionSun, 13 Nov 2022

A simple sorting algorithm

def sort(nums): for i in range(len(nums) - 1): for j in range(i + 1, len(nums)): if nums[i] > nums[j]: nums[i], nums[j] = nums[j], nums[i] return nums sort([1, 4, 2, 7])

Questions about programming?Chat with your personal AI assistant