Description of the exercise
In this exercise, you will use the built in file handling functionality of Python to interpret and display a set of data. The data will be provided as a text file containing lines of integer pairs; your job is to properly interpret and display this data according to the required format while dealing with any exceptions.
The code should output a printed grid composed of 'H' and ' ' (single space) characters according to the dimensions and "selected" positions in a given input file. For this exercise, the default character must be 'H' and the selected character must be ' ' (single space).
Structure of the file
The first line of each text file contains the width and height of the resulting two-dimensional output, separated by a comma. The printed two-dimensional output is a grid of "H" characters. All further lines of each file will contain a pair of integers representing the coordinates of a "selected" position (starting from index 0 representing the first position). Selected positions are pieces of the grid where an empty space is printed instead of "H". For example:
3,3
1,1
In the text file let's say test1.txt , the grid size (given by the first line) is 3x3, and the only "selected" position is given by line 2 as 1,1. Because these position coordinates are indexed starting at zero, the coordinates 1,1 correspond to the second character in the second row. Therefore, this file would result in the following print-out:
HHH
H H
HHH
Here is the default code that needs to be edited in python to get the desired output mentioned above.