From 2b8dbaf1767332e232a8df0ef1f728e50cb17133 Mon Sep 17 00:00:00 2001
From: Aitor Perez
Date: Mon, 19 Mar 2018 13:57:34 +0100
Subject: [PATCH] Fixed numpy I exercise
---
exercises/4-Numpy/numpy1-chessboard-solution.py | 4 ++--
exercises/4-Numpy/numpy1-chessboard.py | 8 ++++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/exercises/4-Numpy/numpy1-chessboard-solution.py b/exercises/4-Numpy/numpy1-chessboard-solution.py
index 651c838..671df41 100644
--- a/exercises/4-Numpy/numpy1-chessboard-solution.py
+++ b/exercises/4-Numpy/numpy1-chessboard-solution.py
@@ -3,7 +3,8 @@
# Exercise 4.1: Numpy chessboard - Solution
#
-# Create a 8x8 matrix with a chessboard pattern with numbers 1 and 0.
+# Create a 8x8 matrix with a chessboard pattern with numbers 1 and 0,
+# then visualize it with the function imshow from matplotlib.
import numpy as np
import matplotlib.pyplot as plt
@@ -19,5 +20,4 @@ def chessboard():
M = chessboard()
-print(M)
plt.imshow(M, cmap='binary')
diff --git a/exercises/4-Numpy/numpy1-chessboard.py b/exercises/4-Numpy/numpy1-chessboard.py
index 9c114d4..c165490 100644
--- a/exercises/4-Numpy/numpy1-chessboard.py
+++ b/exercises/4-Numpy/numpy1-chessboard.py
@@ -3,12 +3,16 @@
# Exercise 4.1: Numpy chessboard
#
-# Create a 8x8 matrix with a chessboard pattern with numbers 1 and 0.
+# Create a 8x8 matrix with a chessboard pattern with numbers 1 and 0,
+# then visualize it with the function imshow from matplotlib.
import numpy as np
+import matplotlib.pyplot as plt
+
def chessboard():
pass # Your code here
-print(chessboard())
+M = chessboard()
+plt.imshow(M, cmap='binary')
--
GitLab