multiply a matrix by an integer in python
<p>I know how to multiply two matrices(under a class).below i show my code.however I can not seem to figure out how to multiply a matrice and an integer in pyhton. Any help will be appreciated.  </p>

<p><strong>Update</strong>:
Example of a matrix.</p>

<pre><code>L=[[1,2],[3,4],[5,6]]
3*L
# [[1,6],[9,12],[15,18]]

def __mul__(self,other):
    '''this will multiply two predefined matrices where the number of
    columns in the first is equal to the number of rows in the second.'''
    L=self.L
    L2=other.L
    result=[]
    if len(L[0])==len(L2):
        for i in range(len(L)):
            row=[]
            for j in range(len(L2[0])):
                var=0 
                for k in range(len(L2)):
                    var=var+L[i][k]*L2[k][j]
                row=row+[var]
            result = result+[row]
        return matrix(result)
    else:
        raise ValueError('You may not only multiply m*n * n*q matrices.')
</code></pre>

<p><strong>Update 2</strong>:
Sorry if i do not respond to your comments guys. My Mac is acting up and won't let me click on the comment link.</p>
