Question: Write a module of utility functions called util. py for manipulating 2 - dimensional arrays of size 4 4 . ( These functions will be
Write a module of utility functions called util. py for manipulating dimensional arrays of size
These functions will be used in Question
The functions you need to write are as follows:
def creategridgrid:
create a times array of zeroes within grid"""
def printgrid grid:
print out a x grid in width columns within a box"""
def checklost grid:
return True if there are no values and there are no
adjacent values that are equal; otherwise False"""
def checkwon grid:
return True if a value is found in the grid; otherwise
False"""
def copygrid grid:
return a copy of the given grid"""
def gridequal grid grid:
check if grids are equal return boolean value"""
Version :
Note: these functions are described using docstrings.
Use the
testutil.py test program to test your functions. This program takes a single integer
input value and runs the corresponding test on your module. This is a variant of unit testing, where
test cases are written in the form of a program that tests your program. You will learn more about
unit testing in future CS courses.
Sample IO The input from the user is shown in bold font do not program this:
Sample IO The input from the user is shown in bold font do not program this:
True
Sample IO The input from the user is shown in bold font do not program this:
Sample IO The input from the user is shown in bold font do not program this:
True
Sample IO The input from the user is shown in bold font do not program this:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
