Reference no: EM132357238
Question
Create a function called threeboxes that expects two 2-dimensional tables of integers as parameters. Both will be implemented as a list of lists. Both tables have the same rows and columns, so your threeboxes function does not have to worry about the tables being different sizes.
The function should create a new table with the same dimensions as the two tables passed as parameters. For explanation on the rest of the directions, we'll call the two tables passed as parameters tablea and tableb, and the new table will be tablec.
Once tablec has been created, your function should add the value of each element in tablea to the value of the corresponding element of tableb and store the sum at the same location in tablec. For example, the value stored at indexes 1,2 in tablec would be the sum of the values stored at indexes 1,2 in tablea and tableb.
In other words, if you think of the first twotables as matrices, this function performs matrix addition. When the individual values from tablea and tableb have been added and stored in tablec, your function should return the new table, tablec. Your function does not ask for keyboard input, it does not print anything, and it must not modify any of the values in tablea and tableb. Please use Python 3 and
Here are some examples of this function's behavior:
>>> threeboxes([[4,1,2],[6,20,31]],[[15,12,1],[12,5,31]])
[[19, 13, 3], [18, 25, 62]]
>>>threeboxes([[10,12],[5,6],[41,3],[1,8]],[[7,11],[5,21],[3,16],[1,4]])
[[17, 23], [10, 27], [43, 19], [2, 12]]