Commit 7559b0d6 authored by Alistair Walsh's avatar Alistair Walsh Committed by Trevor Bekolay
Browse files


In the challenge 'Sorting out references' multiple assignment is used without any previous mention. I have added the use of assigning multiple values to multiple variables in the numpy methods section. I understand that this is introducing two new concepts at the same time (methods and multiple assignment).

It does allow the student to chunk the three descriptive statistics though so is might lower the load on working memory
The other options are to introduce simultaneous assignment in it's own section, either in this lesson or move it elsewhere and move the challenge. There is also the option of removing the multiple assignment from the challenge and assigning each variable separately.
parent 8734c9a7
......@@ -406,12 +406,16 @@ to tell Python to go and do something for us. `data.shape` doesn't
need `()` because it is just a description but `data.mean()` requires the `()`
because it is an action.
NumPy arrays have lots of useful methods:
NumPy arrays have lots of useful methods, lets use three of those methods to get some descriptive values about the dataset.
~~~ {.python}
print('maximum inflammation:', data.max())
print('minimum inflammation:', data.min())
print('standard deviation:', data.std())
# we can assign multiple values to multiple variables at once
maxval, minval, stdval = data.max(), data.min(), data.std()
print('maximum inflammation:', maxval)
print('minimum inflammation:', minval)
print('standard deviation:', stdval)
~~~ {.output}
maximum inflammation: 20.0
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