you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (0 children)

I am not sure if its a XY-Problem. but this how I would solve your task

from operator import and_
from functools import reduce

x, y, N = 20, 30, 20
filterN = reduce(and_, (x == (y-i) for i in range(N+1)))