From f0d910b5a95a37cde6749f0b8ed9a70254816cab Mon Sep 17 00:00:00 2001 From: Jan Wojciechowski <96974442+yanvoi@users.noreply.github.com> Date: Fri, 17 Feb 2023 19:18:16 +0100 Subject: [PATCH] Update bogo_sort.py The if statement I deleted is actually redundant: if len(collection) is smaller than 2 then the for loop will not execute (range() function starts from 0 by default) and the function will return True. --- sorts/bogo_sort.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/sorts/bogo_sort.py b/sorts/bogo_sort.py index b72f2089f3d2..9c133f0d8a55 100644 --- a/sorts/bogo_sort.py +++ b/sorts/bogo_sort.py @@ -31,8 +31,6 @@ def bogo_sort(collection): """ def is_sorted(collection): - if len(collection) < 2: - return True for i in range(len(collection) - 1): if collection[i] > collection[i + 1]: return False