From: Skullheadx <704277@pdsb.net> Date: Wed, 25 Jan 2023 03:48:49 +0000 (-0500) Subject: func for check if increasing order in array X-Git-Url: http://git.skullheadx.com/nixos/projects/suckless.html?a=commitdiff_plain;h=6400eef413ca75fa580b5bba2f8bf5a84e4251e0;p=Sorting.git func for check if increasing order in array --- diff --git a/sorting_algorithms/utils.py b/sorting_algorithms/utils.py index d499f80..e186639 100644 --- a/sorting_algorithms/utils.py +++ b/sorting_algorithms/utils.py @@ -2,3 +2,10 @@ def swap(array, index1, index2): get = array[index1], array[index2] array[index2], array[index1] = get return array + + +def is_increasing(array): + for index in range(len(array)-1): + if array[index] > array[index + 1]: + return False + return True