result = [x if x > 2 else 0 for x in range(1, 5)] print(result)
[1, 2, 3, 4]
[0, 0, 3, 4]
[0, 2, 3, 4]
[1, 0, 3, 4]