rsokl / Learning_Python

Source material for Python Like You Mean it
https://www.pythonlikeyoumeanit.com/
Other
165 stars 54 forks source link

Module 2 and 3 typos #146

Closed ArtichokeSap closed 4 years ago

ArtichokeSap commented 4 years ago

I've found a number of typos, mostly but not wholly in the Reading Comprehension questions/solutions.

First, one question:

Module 3 Introduction to Basic and Advanced Indexing: Reading Comprehension: Ellipsis QUESTION ABOUT: Given a N-dimensional array, x, index into x such that you axis entry-0 of axis-0 QUESTION: "such that you axis"? Should it be "such that you access"?

Proposed changes:

Module 2 Understanding the Modulo Operator, Reading Comprehension Solutions CHANGE FROM: If n is an integer, then 2 will divide into it evenly, and thus there is no remainder. CHANGE TO: If n is an even integer, then 2 will divide into it evenly, and thus there is no remainder.

Module 2 Data Structures (Part II): Dictionaries, Reading Comprehension Solutions CHANGE FROM:

>>> get_maxes(dict(a=1, b=2,c= 2, d=1))

CHANGE TO:

>>> get_maxes(dict(a=1, b=2, c=2, d=1))

Module 3 Fixed links from "docs.scipy.org/doc/numpy/" to "numpy.org/doc/stable/"

Module 3 "Vectorized" Operations, Reading Comprehension Solutions CHANGE FROM:

    # top-left  top-right    bottom-left  bottom-right
>>> x[:2, :2] + x[:2, -2:] + x[-2:, :2] + x[-2:, -2:]
array([[20, 24],
       [36, 40]])

CHANGE TO:

                    # top-left           top-right            bottom-left        bottom-right
>>> np.array([[np.sum(x[:2, :2]), np.sum(x[:2, 2:])], [np.sum(x[2:, :2]), np.sum(x[2:, 2:])]])
array([[10, 18],
       [42, 50]])

(The problem is "4 quadrants," and the current solution is the sum of quadrants of each quadrant)

Module 3 "Vectorized" Operations, Reading Comprehension: Basic Sequential Functions CHANGE FROM: Thus a (32,32,3) array would be a 32x32 RBG image. CHANGE TO: Thus a (32,32,3) array would be a 32x32 RGB image. (emphasis only in markdown comment, not in commit)

Module 3 Array Broadcasting, Reading Comprehension Solutions MOVE "Broadcast Compatibility: Solution" section to BEFORE "Basic Broadcasting: Solution" ADD <!-- #region --> and <!-- #endregion --> to moved section

Module 3 Array Broadcasting, Reading Comprehension: Basic Broadcasting III CHANGE FROM: Thus a (32,32,3) array would be a 32x32 RBG image. CHANGE TO: Thus a (32,32,3) array would be a 32x32 RGB image.

Module 3 Introduction to Basic and Advanced Indexing: Reading Comprehension Augmenting Array Data In-Place IN:

# 5.
>>> np.log(x[1:3], out=x[1:3])
>>> y += 3

REMOVE: (duplicate from #4, not relevant and not in solution)

>>> y += 3

Module 3 Introduction to Basic and Advanced Indexing: Reading Comprehension Augmenting Array Data In-Place IN #7: CHANGE FROM:

>>> y = y + 2

CHANGE TO (match answer key, and is already same question #3 asks):

>>> x = np.square(x)

Module 3 Introduction to Basic and Advanced Indexing: Reading Comprehension Augmenting Array Data In-Place AFTER #9, APPEND:

```python 
# 10.
>>> np.square(y, out=y)

(answer is in Solutions, problem is missing)

**Module 3 Introduction to Basic and Advanced Indexing: Reading Comprehension Solutions: Assignment via advanced indexing**
Problem does not match solution.
CHANGE FROM:
Replace the diagonal elements of `x` with `(-1, -2, -3, -4)`, and add `1` to all values in `x` that are greater than `0.8`.
CHANGE TO:
Replace the diagonal elements of `x` with `(0, 1, 2, 3)`, and add `1` to all values in `x` that are greater than `0.8`.
ArtichokeSap commented 4 years ago

I think I have the .md edits for all my proposed changes, committed to a typos branch on my fork. If I should just make the pull request, let me know.

rsokl commented 4 years ago

I think I have the .md edits for all my proposed changes, committed to a typos branch on my fork. If I should just make the pull request, let me know.

Yes, please do!

ArtichokeSap commented 4 years ago

Any comment about the question up top? Should "such that you axis" be instead "such that you access"?

rsokl commented 4 years ago

QUESTION ABOUT: Given a N-dimensional array, x, index into x such that you axis entry-0 of axis-0 QUESTION: "such that you axis"? Should it be "such that you access"?

Yep! It should be "such that you access".

davidmascharka commented 4 years ago

Closed by #147

In the future if you write "Fixes #blah" or "Closes #blah" where "blah" is the issue number this will be done automatically by GitHub