[Tutor] Loop blocks

Jignesh Sutar jignesh.sutar at gmail.com
Fri Jun 10 18:41:37 EDT 2016


Is there a better way to code the below than to specify blocks as I have.
Ideally I'd like to specify blocks simply as *blocks=(12,20,35)*

blocks=[(1,12), (13,20), (25,35)]
for i,j in enumerate(blocks):
    for x in xrange(blocks[i][0],blocks[i][1]+1):
        print i+1, x


Thanks in advance.
Jignesh


More information about the Tutor mailing list