I\'ve run into confusion in generating X amount of random integers from different sets of (a,b). For example, I would like to generate 5 random integers coming from (1,5), (
Not ideal
from random import randint, choice for _ in range(5): print(choice([randint(1,5),randint(9,15),randint(21,27)]))
As Blender said - clearer version
from random import randint, choice for _ in range(5): r = choice([(1,5),(9,15),(21,27)]) print(randint(*r))