diff options
| author | Lubos Kolouch <lubos@kolouch.net> | 2020-11-22 21:51:13 +0100 |
|---|---|---|
| committer | Lubos Kolouch <lubos@kolouch.net> | 2020-11-22 21:51:13 +0100 |
| commit | 1e3be69d2bec8640e0a5522db25dabf693222485 (patch) | |
| tree | 3179f0b95353838c99c289b88a0329714188ef6b | |
| parent | 6e5a7940651d7f1e56a2413f7cbe41da9b9c7043 (diff) | |
| download | perlweeklychallenge-club-1e3be69d2bec8640e0a5522db25dabf693222485.tar.gz perlweeklychallenge-club-1e3be69d2bec8640e0a5522db25dabf693222485.tar.bz2 perlweeklychallenge-club-1e3be69d2bec8640e0a5522db25dabf693222485.zip | |
Use list slice in challenge 1 Python
| -rw-r--r-- | challenge-087/lubos-kolouch/python/ch-2.py | 8 |
1 files 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}") |
