I'm starting to learn a bit more about Python. One function I often want but don't know how to program/do in Python is the x %in% y operator in R. It works like so:
1:3 %in% 2:4 ##[1] FALSE TRUE TRUE The first element in x (1) has no match in y so FALSE where as the last two elements of x (2 & 3) do have a match in y so they get TRUE.
Not that I expected this to work as it wouldn't have worked in R either but using == in Python I get:
[1, 2, 3] == [2, 3, 4] # False How could I get the same type of operator in Python? I'm not tied to base Python if such an operator already exists elsewhere.
[x in range(2,5) for x in range(1,4)]?for i in x: [].append(i in y)or[i in y for i in x]