import random # list of n elements, going between a and b list = [random.randint(a,b) for _ in range(n)] print("list:", list)