diff --git a/novice/python/01-numpy.ipynb b/novice/python/01-numpy.ipynb index 4c912993e..e4c56a8ed 100644 --- a/novice/python/01-numpy.ipynb +++ b/novice/python/01-numpy.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:bdd5075bd4a75df8ed67c3124b0664471edfc1bfe6110ddcf01e68e156bcb9bb" + "signature": "sha256:67ffce7b022a7f2572764219cdd5dbe7d15f23c592c70db42b60d8e0aba56f40" }, "nbformat": 3, "nbformat_minor": 0, @@ -1247,7 +1247,38 @@ " i.e., a string that contains no characters.\n", " If `data` holds our array of patient data,\n", " what does `data[3:3, 4:4]` produce?\n", - " What about `data[3:3, :]`?" + " What about `data[3:3, :]`?\n", + " \n", + "1. For the NumPy array displayed by `print integer_data`\n", + "\n", + " `[[ 0 2 4 6 8 10 12 14 16 18]\n", + " [ 1 3 5 7 9 11 13 15 17 19]\n", + " [ 2 4 6 8 10 12 14 16 18 20]\n", + " [ 3 5 7 9 11 13 15 17 19 21]\n", + " [ 4 6 8 10 12 14 16 18 20 22]\n", + " [ 5 7 9 11 13 15 17 19 21 23]\n", + " [ 6 8 10 12 14 16 18 20 22 24]\n", + " [ 7 9 11 13 15 17 19 21 23 25]\n", + " [ 8 10 12 14 16 18 20 22 24 26]\n", + " [ 9 11 13 15 17 19 21 23 25 27]]`\n", + "\n", + " what does `print integer_data[2:4, 3:5]` produce?\n", + " \n", + " 1. `[[ 8 10 12]\n", + " [ 9 11 13]\n", + " [10 12 14]]`\n", + " \n", + " 1. `[[ 5 7]\n", + " [ 6 8]]`\n", + " \n", + " 1. `[[ 7 9]\n", + " [ 8 10]]`\n", + " \n", + " 1. `[[ 8 10]\n", + " [ 9 11]]`\n", + " \n", + " 1. `[[12 14]\n", + " [13 15]]`" ] }, { diff --git a/novice/python/01-numpy.md b/novice/python/01-numpy.md index 37c3bcc9a..7e0befc47 100644 --- a/novice/python/01-numpy.md +++ b/novice/python/01-numpy.md @@ -562,11 +562,36 @@ last three characters: gen Given those answers, explain what `element[1:-1]` does. -1. The expression `element[3:3]` produces an [empty string](../../gloss.html#empty-string), - i.e., a string that contains no characters. - If `data` holds our array of patient data, - what does `data[3:3, 4:4]` produce? - What about `data[3:3, :]`? +1. For the NumPy array displayed by `print integer_data` + + `[[ 0 2 4 6 8 10 12 14 16 18] + [ 1 3 5 7 9 11 13 15 17 19] + [ 2 4 6 8 10 12 14 16 18 20] + [ 3 5 7 9 11 13 15 17 19 21] + [ 4 6 8 10 12 14 16 18 20 22] + [ 5 7 9 11 13 15 17 19 21 23] + [ 6 8 10 12 14 16 18 20 22 24] + [ 7 9 11 13 15 17 19 21 23 25] + [ 8 10 12 14 16 18 20 22 24 26] + [ 9 11 13 15 17 19 21 23 25 27]]` + + what does `print integer_data[2:4, 3:5]` produce? + + 1. `[[ 8 10 12] + [ 9 11 13] + [10 12 14]]` + + 1. `[[ 5 7] + [ 6 8]]` + + 1. `[[ 7 9] + [ 8 10]]` + + 1. `[[ 8 10] + [ 9 11]]` + + 1. `[[12 14] + [13 15]]` ### Plotting