aboutsummaryrefslogtreecommitdiff
path: root/challenge-075/walt-mankowski/python
diff options
context:
space:
mode:
authorWalt Mankowski <waltman@pobox.com>2020-08-26 14:45:02 -0400
committerWalt Mankowski <waltman@pobox.com>2020-08-26 14:45:02 -0400
commit59f42083ee3c1c04bf9db831430d5b9d94c446a2 (patch)
tree2009f74107316b0ba0b5a63bf93aac65c5030913 /challenge-075/walt-mankowski/python
parent730915136413554ad43fbfc9d7e4f766291a4ec0 (diff)
downloadperlweeklychallenge-club-59f42083ee3c1c04bf9db831430d5b9d94c446a2.tar.gz
perlweeklychallenge-club-59f42083ee3c1c04bf9db831430d5b9d94c446a2.tar.bz2
perlweeklychallenge-club-59f42083ee3c1c04bf9db831430d5b9d94c446a2.zip
use dtype of bool for the histogram
Diffstat (limited to 'challenge-075/walt-mankowski/python')
-rw-r--r--challenge-075/walt-mankowski/python/ch-2.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/challenge-075/walt-mankowski/python/ch-2.py b/challenge-075/walt-mankowski/python/ch-2.py
index efd720f539..fb8d13b9c3 100644
--- a/challenge-075/walt-mankowski/python/ch-2.py
+++ b/challenge-075/walt-mankowski/python/ch-2.py
@@ -5,7 +5,7 @@ def print_hist(hist, a, rows, cols):
for row in range(rows-1, -1, -1):
print(row+1, end='')
for col in range(cols):
- print(f" {'#' if hist[row][col] == 1 else ' '}", end='')
+ print(f" {'#' if hist[row][col] else ' '}", end='')
print()
print('-', end='')
@@ -22,11 +22,11 @@ a = [int(x) for x in argv[1:]]
# build the histogram
rows = max(a)
cols = len(a)
-hist = np.zeros([rows, cols])
+hist = np.zeros([rows, cols], dtype=bool)
for row in range(rows):
for col in range(cols):
if row < a[col]:
- hist[row][col] = 1
+ hist[row][col] = True
print_hist(hist, a, rows, cols)
best_area = 0