I have a range of values โโ( L,R,U,D
) and two variables, d
and newd
, containing one of them. I need to check if d
and newd
in the same subset ( L,R
or U,D
) or not.
I know I can do this:
d in {'L','R'} and newd in {'U','D'} or d in {'U','D'} and newd in {'L','R'}
it really returns False
if they both have values โโin L,R
or U,D
and True
otherwise. However, I find it multiple. Some suggestions for more DRY suitable?
source share