Question: Write a Python program that tests the function main and the functions discussed in step1 through 7. 1. Declare two global variables: MAX_ROW = 30
Write a Python program that tests the function main and the functions discussed in step1 through 7.
1. Declare two global variables:
MAX_ROW = 30 - # total number of rows MAX_COL = 60 - #total number of columns
2. Declare 2 two-dimensional lists with zeros (integer) as initial values using the size specified in step 1. currentGen and tempGen
3. Write the definition of the function displayMenu that displays the following menu; this function doesn't collect the user's input; only display the following menu.
[P]lay Press 'P' to play. [Q]uit Press 'Q' to exit.
4. Write the definition of the function setZeroList that initializes any two-dimensional list to 0 (zero).
5. Write the definition of the function setInitialPatternList that creates the pattern of U using 1 in any two-dimensional list (use for loop). The following shows a portion of an 2-D list. Use the predefined randint() function to determine the row and column of the first 1 (bold). The size of the 'U' pattern must be the same as the below example (6 rows and 7 columns).
000000000 010000010 010000010 010000010 010000010 010000010 011111110 000000000
6. Write the definition of the function copyList that copy a two-dimensional list to another two-dimensional list.
7. Write the definition of the function displayList that prints any two-dimensional list.
8. When executing your program, the following should happen: a. Print the menu using the displayMenu function. b. Initialize the tempGen using the setZeroList function. c. Set the U pattern in the tempGen using the setInitialPatternList function. d. Copy the tempList to the currentList using the copyList function. e. Print the currentList using the displayList function. f. When the user presses P, you will repeat a through e only once. When the user presses Q, it will terminate the program.
***Use variable names instead of numbers (-30 points).
for example:
currentGen[MAX_ROW][MAX_COL];
instead of currentGen[30][60];
****When declaring variables, array names, use a meaningful name; don't just use x, y, a, b, etc. Don't just use a single character.
OUTPUT:
- The bold text is the user's input.



[P]lay-Press 'P' to play [Q]uit-Press 'Q' to exit 000000000000000000000100000100000000000000000000000000000000 000000000000000000000100000100000000000000000000000000000000 000000000000000000000100000100000000000000000000000000000000 000000000000000000000100000100000000000000000000000000000000 000000000000000000000100000100000000000000000000000000000000 000000000000000000000111111100000000000000000000000000000000
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
