Question: 2 problems, please write in Python. Accumulator Pattern 1 point Compose a program which tests whether each character in a string text is whitespace or

2 problems, please write in Python.
Accumulator Pattern 1 point Compose a program which tests whether each character in a string text is whitespace or not. If it is not, then the character should be appended to a accumulator string The text used is taken from T. S. Eliot's "Choruses from The Rock text = Brings knowledge of motion, but not of stillness; nonws-??? whitespacen" for ??: Conway's Game of Life 5 points Now that we have a working evolve function, we can carry out longer-term simulations of the Game of Life. (If you haven't gotten evolve to work yet, we provide it for this step.) Consider a wrapper loop that will simulate a glider traveling for nt time steps: import numpy as np import matplotlib.pyplot as plt glider np . zeros( ( 24,24 ) ) glidert 1e,1 1 glidert 11,10 ] -1 glider 12,1e1 glider 12,111 -1 glider 11,12]-1 for t in range( nt ): cells evolve cells) plt.imshow cells) plt.show() Write a program which implements a loop evolving pentadecathlon for thirty time steps. You should implement a list of ndarray s named pd_list.each containing a single generation of pentadecathlon 's evolution pentadecathlon np.zeros 24,24) pentadecathlon 12, 91-1 pentadecathlon[ 12,1 -8 pentadecathlon[ 12,11 ] = 1 pentadecathlon 17, 91 pentadecathlon 17,1ee pentadecathlont 17,1 1 Your submission for this part should include the list of ndarray s named pd list. If you wish to see the results at each time step, move plt.show) into the loop Starter code (click to view) import numpy as np import matplotlib.pyplot as plt pentadec athlon np. zeros( ( 24,24 ) pentadecathlon 18:28,1] 1 pentadee athlon[ 12, 9 ] 1 pentadecathlon 12,1e pentadecathlon 12,11- 1 pentadecathlon 17, 9 1 pentadecathlon 17,1 -e pentadecathlon[ 17,11 ] -1 pd 1ist?? nt3e for t in ??? ??? # evolve the simulation and append it to 'pd-list plt.imshow pd_list[ -1) plt.show()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
