Fill the matrix column - wise
for j in range ( b ) : NEW_LINE INDENT for i in range ( a ) : NEW_LINE INDENT if ( k < l ) : NEW_LINE INDENT arr [ j ] [ i ] = s [ k ] NEW_LINE DEDENT k += 1 NEW_LINE DEDENT DEDENT