python loop x + 1 times in a list of list until number y
<p>What I want is the list in <code>num</code> loops <code>x + 1</code> everytime until <code>y</code> is generated(and loops is stoped), which is a large number.</p>

<pre><code>def loop_num(y):
    num = []
    num.append([1])
    num.append([2,3])
    num.append([4,5,6]) 
    num.append([7,8,9,10]) 
    ... #stop append when y in the appended list
    #if y = 9, then `append [7,8]` and `return num`
    return num


# something like[[1 item], [2items], [3items], ...]
# the number append to the list can be a random number or ascending integers. 
</code></pre>

<p>sorry for not clear</p>

<p>I am not sure what is your question. But I am assuming that you have done something similar to this.</p>

<pre><code>x=[[1], [2,3], [4,5,6]]
b=[str(a)+' items' for a in [j for i in x for j in i]]
</code></pre>

<p>And what you are looking for is this.</p>

<pre><code>c=max([j for i in x for j in i])
</code></pre>

<p>to do this.</p>

<pre><code>z=[]
z.append(str(c)+' items')
</code></pre>

python list loops random iteratee