Question: PLEASE DO def write_elevation_maps(maps_file: TextIO, maps_list: list[list[list[int]]] ) -> None: Heres get_elevation_maps for reference and the restrictions LAB RESTRICTIONS, PLEASE READ: Do not add any

PLEASE DO

def write_elevation_maps(maps_file: TextIO, maps_list: list[list[list[int]]] ) -> None:

PLEASE DO def write_elevation_maps(maps_file: TextIO, maps_list: list[list[list[int]]] ) -> None: Heres get_elevation_mapsfor reference and the restrictions LAB RESTRICTIONS, PLEASE READ: Do not addHeres get_elevation_maps for reference and the restrictions

LAB RESTRICTIONS, PLEASE READ: Do not add any imports, the ones that you need will be given to you. You may not use any dictionaries or dictionary methods. Do not use try-except statements, you should be able to anticipate or prevent any errors from happening at all! """ import csv from typing import TextIO def get_elevation_maps(maps_file: TextIO) -> list[list[list[int]]]: """ Given an open csv file , read the file according to the specification and return all the elevation maps stored within the file. IMPORTANT: the given argument to the function is an OPEN file , you will not need to open it again, and can begin performing standard file operations on it. The file will be structured as follows: - The first line will contain one number, which will denote the number of elevation maps stored within this file. - The next n lines will contain two numbers each, "r" and "c", which are the number of rows and columns of each elevation map. - The rest of the data will then be comprised of the elevation map data, which will follow one another in sequence, with no spaces in between. For an example, see "sample_data.csv". """ n = int(maps_file.readline()) RowCoulmnList = [] for i in range(n): string = maps_file.readline() stringList = string.split(' ') row = int(stringList[0]) column = int(stringList[1]) RowCoulmnList.append([row, column]) result = [] for i in range(n): row = RowCoulmnList[i][0] column = RowCoulmnList[i][1] elevation_data = [] for j in range(row): string = maps_file.readline() stringList = string.split(' ') for k in range(column): stringList[k] = int(stringList[k]) elevation_data.append(stringList) result.append(elevation_data)

def write_elevation_maps (maps_file: Textio, maps_list: list[list[list[int]]] ) -> None: II III ] Given an open csv file and a list of maps , write the maps back into the csv file according to the format specified in . That is, if the same file was then read from again by the function, it should return a list identical to . IMPORTANT: is an already open file, you can begin writing to it immediately. Furthermore, DO NOT close the file after you are finished writing the data in. II II II ] pass 2 4 5 6 7 77 99 99 48 31 96 63 10 36 7 11 66 5 72 32 74 99 14 5 35 1 37 55 33 45 98 36 90 1 57 95 88 56 81 35 11 75 11 35 38 85 3 51 49 73 17 90 46 27 99 93 58 18 30 65 59 14 15 82 72 3 91 Assuming this file ends on line 14 [[[77 your get_elevation_maps function should return the following list: 99 99 48 31] [96 63 10 36 7] [11 66 5 72 32] [74 99 14 5 35]] [[1 37 55 33 45 98 36] [90 57 95 88 56 81] [35 11 75 11 35 38 85] [46 3 51 49 73 17 90] [27 99 93 58 18 30 65] [91 59 14 15 82 72 31]

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