Question: def flood_map(map, rise): Given a map and a non-negative amount of water rise as an int, modify the given map (returning None), such that the
def flood_map(map, rise): Given a map and a non-negative amount of water rise as an int, modify the given map (returning None), such that the sea level is that much higher. Each land spot is effectively lowered by rise to keep zero representing the (new) sea level; any land that goes underwater ends up as a zero to represent water, regardless of whether it was adjacent to water or not. Assume: map is a map as defined above, and rise is a non-negative int. Restriction: You must modify the original map in this function. >>> m = [[10,10,4],[9,9,5],[8,8,6]] >>> flood_map(m,5) >>> print(show(m)) 5 5 0 4 4 0 3 3 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
