

Thanks for posting the question, we are glad to help you. Given the limited time, i could able to complete Function 4 and 5. Refer the screenshots for code indentation and output
Function 4
-------------------------------------------------------------------------------------------------------------------------------------
def is_map(map):
############################################
#1) it is a list of lists
if type(map) is list:
for row in map:
if type(row) is list:
continue
else:
return False
else:
return False
############################################
#2) it has at least one row and one column;
row_length=len(map)
col_length=len(map[0])
if row_length<1 or col_length<1:
return False
############################################
# it is a list of lists of values of type in
column_width=len(map[0])
for row in map:
# validates the width of each row is the same
if column_width==len(row):
pass
for col in row:
#4) only non-negative ints are present (zero and up is
accepted)
col=str(col)
if col.isdigit():
continue
else:
return False
else:
return False
############################################
# if it passes all the test
return True
print(is_map([[1,2,3],[0,1,5]]))
print(is_map([[[1,2,3,4],[5],[6,7]]]))
print(is_map([[-2,False, [1,2,3]], [4,5,6]]))
-------------------------------------------------------------------------------------------------------------------------------------
![far rma in rap row length len rap) enl.nn utdtm]Pn(#Plaj f cnl.tsdicit: Awiable are valabi etoryor s 0ick to review, 2ndintal updates](http://img.homeworklib.com/questions/d0cbcc80-060e-11ec-affe-f7d148d822d8.png?x-oss-process=image/resize,w_560)
Function 5
------------------------------------------------------------------------------------------------------------------------------------
def neighbors(map, r, c):
rows=len(map)-1
cols=len(map[0])-1
if(r>rows or c>cols):
return []
start_row=0
end_row=0
start_col=0
end_col=0
if(r==0):
start_row=r
else:
start_row=r-1
if(r==rows):
end_row=r
else:
end_row=r+1
if(c==0):
start_col=0
else:
start_col=c-1
if(c==cols):
end_col=c
else:
end_col=c+1
index_list=[]
for row in range(start_row,end_row+1):
for col in range(start_col,end_col+1):
if row==r and col==c:
continue
index_list.append((row,col))
return index_list
print(neighbors([[1,1,1,1,1],[1,1,1,1,1],[1,1,1,1,1]], 1, 1))
print(neighbors([[1,1,1,1,1],[1,1,1,1,1],[1,1,1,1,1]], 0, 3))
print(neighbors([[1,1,1,1,1],[1,1,1,1,1],[1,1,1,1,1]], 2, 0))
--------------------------------------------------------------------------------------------------------------------------------------
Image screenshot

Due to time constraint, i was not able to write code for 6 and 7. You, can follow the code for 4 and 5 and comeup with a solution for 6 and 7
thank you so much...........
PYHTON CODING FUNCTIONS HELP Part 2. Also need help with these last functions. Requirements/restraints and the...
1)def toggle_cell(row, column, cells): • Return value: Flip the cell in the column of row from alive to dead or vice versa. Return True if the toggle was successful, False otherwise. • Assumptions: o cells will be a two-dimensional list with at least one row and one element in that row. o row and column are index values of cells • Notes: o Cells is being edited in place. Note that the return value is a Boolean and not a...
I need help as quick as possible, thanks beforehand. Please
provide the test output
The Lo Shu Magic Square is a grid with 3 rows and 3 columns shown below. 35 The Lo Shu Magic Square has the following properties: The grid contains the numbers 1 - 9 exactly The sum of each row, each column and each diagonal all add up to the same number. This is shown below: 15 4 92 15 - 81 + 15 15 15...
Encoding and Decoding PPM image
3 & 4 are parts of question 2
Code for a09q1:
We were unable to transcribe this image3 Encoding an Image in a09q2.py In the next four sections, you will no longer write class methods but rather functions. In each of the next four parts, you should be importing the PPM class from a09q1.py to use with the command from a09q1 import PPM Note that this is similar to how the check module was imported...
PYTHON: MUST NOT USE PYTHONS BUILT IN FUNCTIONS SUCH AS result.append MUST BE SOLVED OUT WITHOUT SUCH FUNCTIONS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 1. Write a function interleave(vals1, vals2) that takes as inputs two lists vals1 and vals2 and uses recursion to construct and return a new string that is formed by interleaving the elements in the lists vals1 and vals2 to create a single list. In other words, the new list should alternate elements from the two input lists: the first element from vals1,...
I need a python 3 help. Please help me with this question Part 2. Linked Lists You start working with the class LinkNode that represents a single node of a linked list. It has two instance attributes: value and next. class LinkNode: def __init__(self,value,nxt=None): assert isinstance(nxt, LinkNode) or nxt is None self.value = value self.next = nxt Before you start with the coding questions, answer the following questions about the constructor Valid Constructor or Not? LinkNode(1, 3) LinkNode(1, None) LinkNode(1,...
I only need the "functions" NOT the header file nor the main
implementation file JUST the implementations for the
functions
Please help, if its difficult to do the complete program I would
appreciate if you could do as much functions as you can especially
for the derived class.
I am a beginer so I am only using classes and pointers while
implementing everything using simple c++ commands
thank you in advanced
Design and implement two C++ classes to provide matrix...
ON PYTHON: ''' Design the functions described below. RECALL: With functions that do not return a value and print a result to the console, to test you must call the function, run it and visually inspect the result for correctness. With functions that return a value, use the print_test function to provide feedback of the test results at the command line. The print_test function is implemented for you at the bottom of this file. RECALL: floating point arithmetic can lose...
Write a C++ program to simulate a stream path. In this problem you can make the following assumptions 1. The elevation grid will be a n row, m column grid of integers, where n and m are constant. 2. Once the stream origin location is specified, then the stream flows to whichever of the four adjacent locations in the grid represents the largest descent. 3. If more than one of the adjacent locations have the largest descent, then the water...
PLEASE HELP!!! C PROGRAMMING CODE!!!
Please solve these functions using the prototypes provided. At
the end please include a main function that tests the functions
that will go into a separate driver file.
Prototypes int R_get_int (void); int R_pow void R Jarvis int start); void R_fill_array(int arrayll, int len); void R_prt_array (int arrayl, int len) void R-copy-back (int from[], int to [], int len); int R_count_num (int num, int arrayll, int len) (int base, int ex) 3. Build and run...
I need help with keeping it within the range of the board at the edges. Also, after the missile launch, I would like to scan the entire board for any boats that have sunk. Meaning, I would like to check if any boats in an array of boats exist on the board. If it cannot find a boat of a specific name from the Boat array within the 2D board, I would want it to return false. This seems simple...