solutions update from 5c34811
This commit is contained in:
		
							parent
							
								
									5c3481111f
								
							
						
					
					
						commit
						19dcbdd422
					
				
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1090,11 +1090,8 @@ k = 4 | ||||
| windows = np.lib.stride_tricks.sliding_window_view(Z, (k, k)) | ||||
| S = windows[::k, ::k, ...].sum(axis=(-2, -1)) | ||||
| 
 | ||||
| # Author: Jeff Luo (@Jeff1999) | ||||
| 
 | ||||
| Z = np.ones((16, 16)) | ||||
| k = 4 | ||||
| print(sliding_window_view(Z, window_shape=(k, k))[::k, ::k].sum(axis=(-2, -1))) | ||||
| # alternative solution (by @Gattocrucco) | ||||
| S = Z.reshape(4, 4, 4, 4).sum((1, 3)) | ||||
| ``` | ||||
| #### 88. How to implement the Game of Life using numpy arrays? (★★★) | ||||
| `No hints provided...` | ||||
|  | ||||
| @ -1090,11 +1090,8 @@ k = 4 | ||||
| windows = np.lib.stride_tricks.sliding_window_view(Z, (k, k)) | ||||
| S = windows[::k, ::k, ...].sum(axis=(-2, -1)) | ||||
| 
 | ||||
| # Author: Jeff Luo (@Jeff1999) | ||||
| 
 | ||||
| Z = np.ones((16, 16)) | ||||
| k = 4 | ||||
| print(sliding_window_view(Z, window_shape=(k, k))[::k, ::k].sum(axis=(-2, -1))) | ||||
| # alternative solution (by @Gattocrucco) | ||||
| S = Z.reshape(4, 4, 4, 4).sum((1, 3)) | ||||
| ``` | ||||
| #### 88. How to implement the Game of Life using numpy arrays? (★★★) | ||||
| 
 | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
|  "cells": [ | ||||
|   { | ||||
|    "cell_type": "markdown", | ||||
|    "id": "6f6a89e6", | ||||
|    "id": "7e8b1da3", | ||||
|    "metadata": {}, | ||||
|    "source": [ | ||||
|     "# 100 numpy exercises\n", | ||||
| @ -18,7 +18,7 @@ | ||||
|   }, | ||||
|   { | ||||
|    "cell_type": "markdown", | ||||
|    "id": "4281e2bd", | ||||
|    "id": "fe47c268", | ||||
|    "metadata": {}, | ||||
|    "source": [ | ||||
|     "File automatically generated. See the documentation to update questions/answers/hints programmatically." | ||||
| @ -26,7 +26,7 @@ | ||||
|   }, | ||||
|   { | ||||
|    "cell_type": "markdown", | ||||
|    "id": "46502bff", | ||||
|    "id": "d6be3eba", | ||||
|    "metadata": {}, | ||||
|    "source": [ | ||||
|     "Run the `initialise.py` module, then call a random question with `pick()` an hint towards its solution with\n", | ||||
| @ -36,7 +36,7 @@ | ||||
|   { | ||||
|    "cell_type": "code", | ||||
|    "execution_count": null, | ||||
|    "id": "4d7dd9e9", | ||||
|    "id": "178fcfcd", | ||||
|    "metadata": {}, | ||||
|    "outputs": [], | ||||
|    "source": [ | ||||
| @ -46,7 +46,7 @@ | ||||
|   { | ||||
|    "cell_type": "code", | ||||
|    "execution_count": null, | ||||
|    "id": "4bd2b4f7", | ||||
|    "id": "747d40f8", | ||||
|    "metadata": {}, | ||||
|    "outputs": [], | ||||
|    "source": [ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user