On Thu, 18 Dec 2014 20:27:03 -0500 Adam Jensen <han...@riseup.net> wrote:
> And to build the 'lines' list (although, this is getting rather ugly): > > >>> lines = [[random.randint(x,x+6) for x in range(1,50,7)] for i in range(7)] Oops, in the context of the original program this might make more sense if written as: data = [[random.randint(x,x+6) for x in range(1,50,7)] for i in range(lines)] Side note: if one were to only import specific functions from a module, would the load time and memory consumption be smaller? Example, is: from random import randint, seed smaller and faster than: import random Side side note: since 'i' isn't being used, is there a way to loop (within the list comprehension) without the 'i'? For example, to generate three random numbers: [randint(1,10) for i in range(3)] # This works. [randint(1,10) for range(3)] # This does not work. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor