Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
python-math
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Thibaut.Lunet
python-math
Commits
2b8dbaf1
Commit
2b8dbaf1
authored
Mar 19, 2018
by
Aitor Perez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed numpy I exercise
parent
357f1352
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
exercises/4-Numpy/numpy1-chessboard-solution.py
exercises/4-Numpy/numpy1-chessboard-solution.py
+2
-2
exercises/4-Numpy/numpy1-chessboard.py
exercises/4-Numpy/numpy1-chessboard.py
+6
-2
No files found.
exercises/4-Numpy/numpy1-chessboard-solution.py
View file @
2b8dbaf1
...
...
@@ -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'
)
exercises/4-Numpy/numpy1-chessboard.py
View file @
2b8dbaf1
...
...
@@ -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'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment