Skip to content Skip to sidebar Skip to footer

Creating A List Of Lists With Consecutive Numbers

I am looking for a convenient way to create a list of lists for which the lists within the list have consecutive numbers. So far I only came up with a very unsatisfying brute-typin

Solution 1:

It's not clear what consecutive numbers you're talking about, but your code translates into the following idiomatic Python:

[[] for _ in range(4)]          # use xrange in python-2.x

Solution 2:


Post a Comment for "Creating A List Of Lists With Consecutive Numbers"