How can you loop across multiple different ranges. for example say i want to run a for loop for specific set of ranges
1 to 2, 4 to 6 and 10 to 13,
I don't know the exact final number so maybe a function might be useful.
The standard method of
for i in range(1,2) + range (4,6) + range (10,13)
I should have this
[1,4,5,6,10,11,13]
My question is, this is not so efficient, if i don't know the total number of ranges am covering, and I can't even create this as a function without so many parameters.
so if i want to have something like this
for i in range(a,b) + range (c,d) + range (e,f), .....
but as a simple function Can someone help with an efficient way of doing this ?