I've been teaching myself list comprehension, and i've run across something i'm not able to convert.<div><br></div><div>here's the original code for matrix multiplcation</div><div><br></div><div>retmatrix = Matrix(self.__row,other.__col)</div>
<div><div>for m in range(0,retmatrix.__row):</div><div>    for n in range(0,retmatrix.__col):</div><div>        product = 0</div><div>        for p in range(1,self.__col+1):</div><div>            product += (self.__matrix[m][p] * other.__matrix[p][n])</div>
<div>        retmatrix.__matrix[m][n] = product</div><div><br></div><div>Here is what i have so far:</div><div><div>retmatrix.__matrix = [[ product = product + (self.__matrix[m][p]* other.__matrix[p][n])</div><div>                 if product else self.__matrix[m][p]* other.__matrix[p][n]) </div>
<div>                 for p in range(0,self.col) </div><div>                 for n in range(0,self.col)] </div><div>                 for m in range(0,self.__row)]</div></div><div><br></div><div>But i know that isn't correct, can someone nudge my in the right direction?</div>
<div><br></div><div><br></div>-- <br>Thanks<br>Kevin Anthony<br><a href="http://www.NoSideRacing.com" target="_blank">www.NoSideRacing.com</a><div><br><div>Do you use Banshee?</div></div><div>Download the Community Extensions:</div>
<div><a href="http://banshee.fm/download/extensions/" target="_blank">http://banshee.fm/download/extensions/</a></div><br>
</div>