From 5b6a20dedfcd1952d1c39a702b7feafb0b8ac9a0 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Fri, 5 Jan 2024 12:37:49 +0000 Subject: [PATCH] rename var --- chapter2/selection.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chapter2/selection.py b/chapter2/selection.py index eb20d60..b62f8ac 100644 --- a/chapter2/selection.py +++ b/chapter2/selection.py @@ -16,15 +16,15 @@ artists = [ def selectionSort(array, size): - for ind in range(size): - min_index = ind + for index in range(size): + min_index = index - for j in range(ind + 1, size): + for j in range(index + 1, size): # select the minimum element in every iteration if array[j].count < array[min_index].count: min_index = j # swapping the elements to sort the array - (array[ind], array[min_index]) = (array[min_index], array[ind]) + (array[index], array[min_index]) = (array[min_index], array[index]) selectionSort(artists, len(artists))