Skip to content

add exercise with hint#47

Merged
rougier merged 4 commits into
rougier:masterfrom
matianjun1:master
Jun 19, 2017
Merged

add exercise with hint#47
rougier merged 4 commits into
rougier:masterfrom
matianjun1:master

Conversation

@matianjun1

Copy link
Copy Markdown
Contributor

For beginner like me, I want those suggestions to solve these problems more easily.

@rougier

rougier commented Jun 18, 2017

Copy link
Copy Markdown
Owner

Nice works, thanks.
Could put the hint as text (below subtitle) instead of including it in each subtitle ?

@matianjun1

Copy link
Copy Markdown
Contributor Author

Yes, of course.

Comment thread 100 Numpy exercises with hint.md Outdated

#### 1. Import the numpy package under the name `np` (★☆☆)

##### (hint: import … as ..)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can save the ####:

(**hint**: import … as …)

Comment thread 100 Numpy exercises with hint.md Outdated
#### 1. Import the numpy package under the name `np` (★☆☆)

##### (hint: import … as ..)
(**hint**: import … as ..)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+(hint: import … as …)

@matianjun1 matianjun1 changed the title add exercise with suggestion add exercise with hint Jun 19, 2017
Comment thread 100 Numpy exercises with hint.md Outdated
#### 1. Import the numpy package under the name `np` (★☆☆)

##### (hint: import … as ..)
(**hint**: import … as ..)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(hint: import … as …)

#### 2. Print the numpy version and the configuration (★☆☆)

##### (hint: np.\_\_verison\_\_, np.show\_config)
(**hint**: np.\_\_verison\_\_, np.show\_config)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(hint: np.__versoon__, np.show_config)

#### 6. Create a null vector of size 10 but the fifth value which is 1 (★☆☆)

##### (hint: array\[4\])
(**hint**: array\[4\])

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is a hint actually.

#### 8. Reverse a vector (first element becomes last) (★☆☆)

##### (hint: array\[::-1\])
(**hint**: array\[::-1\])

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+(hint: array[start:stop:step], step can be negative)

#### 12. Create a 3x3x3 array with random values (★☆☆)

##### (hint: np.random.random)
(**hint**: np.random.random)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+(hint: np.random)

#### 72. How to swap two rows of an array? (★★★)

##### (hint: array\[\[\]\] = array\[\[\]\])
(**hint**: array\[\[\]\] = array\[\[\]\])

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solution rather than hint, no ?

#### 73. Consider a set of 10 triplets describing 10 triangles (with shared vertices), find the set of unique line segments composing all the triangles (★★★)

##### (hint: repeat, np.roll, np.sort, view, np.unique)
(**hint**: repeat, np.roll, np.sort, view, np.unique)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(hint: np.repeat, np.roll, np.sort, view, np.unique)

#### 80. Consider an arbitrary array, write a function that extract a subpart with a fixed shape and centered on a given element (pad with a `fill` value when necessary) (★★★)

##### (hint: minimum, maximum)
(**hint**: minimum, maximum)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(hint: np.minimum, np.maximum)

#### 83. How to find the most frequent value in an array?

##### (hint: np.bincount, argmax)
(**hint**: np.bincount, argmax)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(hint: np.bincount, np.argmax)

#### 92. Consider a large vector Z, compute Z to the power of 3 using 3 different methods (★★★)

##### (hint: np.power, \*, np.einsum)
(**hint**: np.power, \*, np.einsum)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(hint: np.power, np.multiply, np.einsum)

@rougier

rougier commented Jun 19, 2017

Copy link
Copy Markdown
Owner

Just made some suggestions (but since you changed the file just after me, my comments appear as outdated)

@matianjun1

Copy link
Copy Markdown
Contributor Author

This is my first pull request. Whether you can just fix my code instead of a comment.

@rougier

rougier commented Jun 19, 2017

Copy link
Copy Markdown
Owner

Ok, I'll merge and modify later. Thanks again for your contribution.

@rougier rougier merged commit 334a526 into rougier:master Jun 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants