Question: Using python def is_map(map): Given a map (see definition on previous page), does it meet the following criteria? (1) it's a list of lists of
Using python
def is_map(map): Given a map (see definition on previous page), does it meet the following criteria?
(1) it's a list of lists of values of type int; (2) it has at least one row and one column; (3) it's rectangular (all sub-lists are same length); (4) only non-negative ints are present (zero and up accepted).
Assume: map is a list.
is_map([[1,2,3],[0,1,5]) True
is_map([[[1,2,3,4],[5],[6,7]]) False # not rectangular
is_map([[-2,False, [1,2,3]], [4,5,6]]) False # can't contain negatives or non-ints
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
