From 1e3be69d2bec8640e0a5522db25dabf693222485 Mon Sep 17 00:00:00 2001 From: Lubos Kolouch Date: Sun, 22 Nov 2020 21:51:13 +0100 Subject: Use list slice in challenge 1 Python --- challenge-087/lubos-kolouch/python/ch-2.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/challenge-087/lubos-kolouch/python/ch-2.py b/challenge-087/lubos-kolouch/python/ch-2.py index 9e09226c34..f0237ec5fb 100644 --- a/challenge-087/lubos-kolouch/python/ch-2.py +++ b/challenge-087/lubos-kolouch/python/ch-2.py @@ -24,12 +24,8 @@ def get_rectangle(input_arr): # if so, check how far can go in the row and columns # if the rectangle is largest, save the dimensions - for r, row in enumerate(input_arr): - if r == len(input_arr) - 1: - break - for c, item in enumerate(row): - if c == len(row) - 1: - break + for r, row in enumerate(input_arr[:-1]): + for c, item in enumerate(row[:-1]): if item: # print(f"* 1 at {r} {c}") -- cgit