Question: display _ puzzle ( ) This function should accept a single parameter named puzzle. This parameter is expected to be a list of lists representing

display_puzzle() This function should accept a single parameter named puzzle. This parameter is expected to be a list of lists representing a puzzle state. The function should print the puzzle state using the format displayed above on the right. The function should complete the desired task by performing the following steps: 1. Loop over the elements puzzle. Fir each list in puzzle, perform the following steps: a. If considering the list at index 0,3, or 6, print the following string: '+-------+-------+-------+' b. Create a string named row that is initially set equal to '|'. We will concatenate values to this string to build up the desired output for the current row. c. Loop over the elements of the current list, which will be int. For each int value, do the following: i. If the current value is zero, concatenate the string '.' to row. ii. iii. Otherwise, coerce the value to a string, and concatenate that and a space to row. If considering the element at index 2,5, or 8, concatenate the string '|' to row. d. After the inner loop finishes, print row. 2. After the outer loop finishes, print the bottom border of the puzzle: '+-------+-------+-------+' This function does not need to return a value.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!