19 out of 19 users completed this Bite ...
Will you be Pythonista #20 to crack this Bite?
Average Bite difficulty 1-10 rating: 5.0
» Up for a challenge? 💪
Danny does not like rote learning (nor do we!). He is asked to remember multiplication tables of considerable size 😭
Can you give him a hand so he can focus on more interesting things again? (OK maybe HE is the one who should learn Python 😂)
MultiplicationTable classbelow implementing the following methods:
__init__(constructor) to store the (x,y) coordinates and their multiplication result in a data structure (say in
__len__should return the area of the table (len x* len y)
__str__should give a visual representation of the table, for example a 3x3 length table should return this str:1 | 2 | 3 2 | 4 | 6 3 | 6 | 9
calc_cellmethod should take a x and y coordinate and return the result multiplying them. If x/y are out of range, raise an
Good luck and have fun!