I do not know if you copied your code incorrectly or that's that way it is, but indent on line 66 is wrong. Then, you have 2 opening braces on line 67.
Besides - writhing veeeeery long calculations in one string without spaces makes an unreadable and unsupportable code. In Python, it is customary to surround operation symbols with spaces, for readability.
Couple of more points:
Besides - writhing veeeeery long calculations in one string without spaces makes an unreadable and unsupportable code. In Python, it is customary to surround operation symbols with spaces, for readability.
Couple of more points:
- One-letter variable name add to code unreadability. Variable names should be meaningful and recognizable, and yes - if you ask help in an international forum, in English
- In Python, you don't iterate over indices - you can, but you should not. Below - instant readability improvement, much clearer than
L[k][i] **hand**
for l_row in L: .... for l_cell in in l_row: ......
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.