Halls (2.5 points)

A hall for cultural events (theatre hall, conference room, etc) represents its seating area with a nested list in which each sublist represents a row with the corresponding seats. A seat is represented by a string (str) with values that can be 'FREE', 'OCCU' and 'NAVA', which stand for, respectively, free seat, occupied seat and seat not available (due to the applied covid limited capacity). Rows may have different lenghts.

For different cultural events or new capacity limitations, the seat values may change and also some rows can be extended with one seat. This changes are represented by a dictionary (dict) in which the key is a seat position and the value is one of the three strings described in the previous paragraph. A seat position is represented by a tuple with 2 values (int), \((r, s)\), corresponding to the row and the seat, respectively, and such that \(0 \leq r<ln\), \(ln\) being the length of the nested list, and \(0 \leq s \leq lr\), \(lr\) being the length of the corresponding row; \(s=lr\) means that we must add a seat with the given value at the end of the row.

Save the following function to file halls.py.

Write a modifier function halls() that takes a nested list and a dictionary (dict) as those described, and modifies the nested list taking into account all the changes given in the dictionary. Examples:

>>> nl1 = [['FREE', 'FREE', 'FREE', 'FREE'],
...        ['FREE', 'FREE', 'FREE', 'FREE'],
...        ['FREE', 'FREE', 'FREE', 'FREE']]
>>> dc1 = {(0, 0): 'OCCU', (0, 2): 'NAVA', (0, 4): 'OCCU',
...        (1, 2): 'NAVA', (2, 2): 'NAVA'}

>>> r1 = halls(nl1, dc1)
>>> print(r1)
None
>>> nl1
[['OCCU', 'FREE', 'NAVA', 'FREE', 'OCCU'], ['FREE', 'FREE', 'NAVA', 'FREE'], ['FREE', 'FREE', 'NAVA', 'FREE']]

Note

You have more tests in file test-halls.txt