I've been trying to work my way through some 'beginner projects' I found
around the web, one of them involves generating some random numbers.  I
decided to use a list of lists, and I'm wondering if this is a valid
comprehension...IDLE doesn't seem to mind, but maybe I lack the experience
to know better:

numbers = [[random.randint(1, 10) for x in range(5)] for y in range(5)]

I'm using Python 3.1.  If this is valid, is there a shorter version or
better way?

Thanks!

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to