Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 100_Numpy_exercises.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 36. Extract the integer part of a random array using 5 different methods (★★☆)"
"#### 36. Extract the integer part of a random array of positive numbers using 4 different methods (★★☆)"
]
},
{
Expand Down Expand Up @@ -1478,5 +1478,5 @@
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
2 changes: 1 addition & 1 deletion 100_Numpy_exercises.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ np.sqrt(-1) == np.emath.sqrt(-1)

#### 35. How to compute ((A+B)*(-A/2)) in place (without copy)? (★★☆)

#### 36. Extract the integer part of a random array using 5 different methods (★★☆)
#### 36. Extract the integer part of a random array of positive numbers using 4 different methods (★★☆)

#### 37. Create a 5x5 matrix with row values ranging from 0 to 4 (★★☆)

Expand Down
4 changes: 2 additions & 2 deletions 100_Numpy_exercises_with_hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ np.sqrt(-1) == np.emath.sqrt(-1)
`hint: np.arange(dtype=datetime64['D'])`
#### 35. How to compute ((A+B)*(-A/2)) in place (without copy)? (★★☆)
`hint: np.add(out=), np.negative(out=), np.multiply(out=), np.divide(out=)`
#### 36. Extract the integer part of a random array using 5 different methods (★★☆)
`hint: %, np.floor, np.ceil, astype, np.trunc`
#### 36. Extract the integer part of a random array of positive numbers using 4 different methods (★★☆)
`hint: %, np.floor, astype, np.trunc`
#### 37. Create a 5x5 matrix with row values ranging from 0 to 4 (★★☆)
`hint: np.arange`
#### 38. Consider a generator function that generates 10 integers and use it to build an array (★☆☆)
Expand Down
8 changes: 4 additions & 4 deletions 100_Numpy_exercises_with_hints_with_solutions.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,14 @@ np.divide(A,2,out=A)
np.negative(A,out=A)
np.multiply(A,B,out=A)
```
#### 36. Extract the integer part of a random array using 5 different methods (★★☆)
`hint: %, np.floor, np.ceil, astype, np.trunc`
#### 36. Extract the integer part of a random array of positive numbers using 4 different methods (★★☆)
`hint: %, np.floor, astype, np.trunc`

```python
Z = np.random.uniform(0,10,10)

print (Z - Z%1)
print (np.floor(Z))
print (np.ceil(Z)-1)
print (Z.astype(int))
print (np.trunc(Z))
```
Expand Down Expand Up @@ -463,7 +462,8 @@ for dtype in [np.float32, np.float64]:
`hint: np.set_printoptions`

```python
np.set_printoptions(threshold=np.nan)
import sys
np.set_printoptions(threshold=sys.maxsize)
Z = np.zeros((16,16))
print(Z)
```
Expand Down
8 changes: 4 additions & 4 deletions 100_Numpy_exercises_with_solutions.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ print(Z)
# Author: Evgeni Burovski

Z = np.arange(11)
Z[(3 < Z) & (Z < 8)] *= -1
Z[(3 < Z) & (Z <= 8)] *= -1
print(Z)
```
#### 26. What is the output of the following script? (★☆☆)
Expand Down Expand Up @@ -331,15 +331,14 @@ np.divide(A,2,out=A)
np.negative(A,out=A)
np.multiply(A,B,out=A)
```
#### 36. Extract the integer part of a random array using 5 different methods (★★☆)
#### 36. Extract the integer part of a random array of positive numbers using 4 different methods (★★☆)


```python
Z = np.random.uniform(0,10,10)

print (Z - Z%1)
print (np.floor(Z))
print (np.ceil(Z)-1)
print (Z.astype(int))
print (np.trunc(Z))
```
Expand Down Expand Up @@ -463,7 +462,8 @@ for dtype in [np.float32, np.float64]:


```python
np.set_printoptions(threshold=np.nan)
import sys
np.set_printoptions(threshold=sys.maxsize)
Z = np.zeros((16,16))
print(Z)
```
Expand Down
2 changes: 1 addition & 1 deletion 100_Numpy_random.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
3 changes: 2 additions & 1 deletion source/exercises100.ktx
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,8 @@ How to print all the values of an array? (★★☆)
hint: np.set_printoptions

< a49
np.set_printoptions(threshold=np.nan)
import sys
np.set_printoptions(threshold=sys.maxsize)
Z = np.zeros((16,16))
print(Z)

Expand Down