Question: Write in Python, please! Thank you! Below is the test case and the result should be printed out. 4 Shape Function Turn in a file

Write in Python, please! Thank you!

Write in Python, please! Thank you! Below is the test case and

Below is the test case and the result should be printed out.

the result should be printed out. 4 Shape Function Turn in afile named proj06_shape.py. Inside it, declare a function proj06_shape(), which takes no

4 Shape Function Turn in a file named proj06_shape.py. Inside it, declare a function proj06_shape(), which takes no parameters. (Helper functions are encouraged!) Your function must return the following shape (remember, the objects in this diagram are arrays, not linked lists): return this None (0,0) (1,0) (2,0) (3,0) (0,1) (1,1) (2,1) (3,1) (0,2) (1,2) (2,2) (3,2) None None None None Am I trying to use arrays to hint about how you could build a 2D grid with linked lists? I'll let you decide... import proj 06_shape def main(): print("Checking that proj06_shape() returns the proper structure") L = projo6_shape.proj06_shape() if len(L) != 2: print(f"ERROR: incorrect list length on the root node (expected: 2; got: {len(L)})") if len (L[0) != 2 or len (L[0][0]) != 2 or len(L[0][0][0])!= 2: print("ERROR: incorrect list length on one of the top-row nodes (other than the root node)") if Lolo [0][0] is not None: print("ERROR: The length of the top row is incorrect.") if type (L) != list or type (L[0]) != list or type (L[0][0])!= list or type (L[0][0][0]) != list: print("ERROR: One of the four top-row nodes is not an array object.") def check_col(col_root, col_num): if col_root [1] is None or len(col_root[1] ) != 2 or col_root [1][1] is None or len(col_root[1][1] ) != 2 or col_root [1][1][1] is None or len(col_root[1][1][1]) != 2 or col_root[1][1][1][1] is not None: print(f"ERROR: One of the elements in column [col_num} has the wrong length, or has the wrong value in [1]") if col_root[1] [0] != (col_num,) or col_root[1][1] [0] != (col_num, 1) or I col_root[1][1][1][0] != (col_num, 2): print(f"ERROR: One of the elements in column {col_num} has the wrong value in [0]") check_col(L, check_col(L[0], 1) check_col(L[O] [O], 2) check_col(L[0][0][0], 3) print) print("TESTCASE COMPLETED") Checking that proj06_shape () returns the proper structures TESTCASE COMPLETED 4 Shape Function Turn in a file named proj06_shape.py. Inside it, declare a function proj06_shape(), which takes no parameters. (Helper functions are encouraged!) Your function must return the following shape (remember, the objects in this diagram are arrays, not linked lists): return this None (0,0) (1,0) (2,0) (3,0) (0,1) (1,1) (2,1) (3,1) (0,2) (1,2) (2,2) (3,2) None None None None Am I trying to use arrays to hint about how you could build a 2D grid with linked lists? I'll let you decide... import proj 06_shape def main(): print("Checking that proj06_shape() returns the proper structure") L = projo6_shape.proj06_shape() if len(L) != 2: print(f"ERROR: incorrect list length on the root node (expected: 2; got: {len(L)})") if len (L[0) != 2 or len (L[0][0]) != 2 or len(L[0][0][0])!= 2: print("ERROR: incorrect list length on one of the top-row nodes (other than the root node)") if Lolo [0][0] is not None: print("ERROR: The length of the top row is incorrect.") if type (L) != list or type (L[0]) != list or type (L[0][0])!= list or type (L[0][0][0]) != list: print("ERROR: One of the four top-row nodes is not an array object.") def check_col(col_root, col_num): if col_root [1] is None or len(col_root[1] ) != 2 or col_root [1][1] is None or len(col_root[1][1] ) != 2 or col_root [1][1][1] is None or len(col_root[1][1][1]) != 2 or col_root[1][1][1][1] is not None: print(f"ERROR: One of the elements in column [col_num} has the wrong length, or has the wrong value in [1]") if col_root[1] [0] != (col_num,) or col_root[1][1] [0] != (col_num, 1) or I col_root[1][1][1][0] != (col_num, 2): print(f"ERROR: One of the elements in column {col_num} has the wrong value in [0]") check_col(L, check_col(L[0], 1) check_col(L[O] [O], 2) check_col(L[0][0][0], 3) print) print("TESTCASE COMPLETED") Checking that proj06_shape () returns the proper structures TESTCASE COMPLETED

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 Databases Questions!