import random random_numbers = [random.randint(0, 3) for _ in range(50)] for number in random_numbers: if number == 1 or number == 0: print(number)