produce a matrix of strings on the basis of a list
<p>I want to produce a matrix on the basis of this data I have:</p>

<p>[[0, 1], [1, 0], [0, 2], [1, 1], [2, 0], [0, 3], [1, 2], [2, 1], [3, 0]]</p>

<p>What I want to do, is if the sum inside the square brackets is equal to 1, produce a string variable y_n where n is the counter of lists meeting that condition,
and yxn if the sum is greater than one, where n counts the number of strings produced.
So for my data it should produce:</p>

<pre><code>y_1 
y_2
yx1
yx2
</code></pre>

<p>up to</p>

<pre><code>yx7
</code></pre>

<p>So my best attempt is:</p>

<pre><code>if len(gcounter) != 0:
  hg = len(gcounter[0])
else:
  hg=1
  LHS=Matrix(hg,1,lambda i,j:(var('yx%d' %i)))
print(LHS)
</code></pre>

<p>The data is called gcounter.</p>

<p>It's not giving me an error, but its not filling LHS up with anything</p>
