Commit 2b8dbaf1 authored by Aitor Perez's avatar Aitor Perez

Fixed numpy I exercise

parent 357f1352
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
# Exercise 4.1: Numpy chessboard - Solution # 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 numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
...@@ -19,5 +20,4 @@ def chessboard(): ...@@ -19,5 +20,4 @@ def chessboard():
M = chessboard() M = chessboard()
print(M)
plt.imshow(M, cmap='binary') plt.imshow(M, cmap='binary')
...@@ -3,12 +3,16 @@ ...@@ -3,12 +3,16 @@
# Exercise 4.1: Numpy chessboard # 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 numpy as np
import matplotlib.pyplot as plt
def chessboard(): def chessboard():
pass # Your code here pass # Your code here
print(chessboard()) M = chessboard()
plt.imshow(M, cmap='binary')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment