Is it possible to assign a maths operator to a variable?
this is what I have, just a sample (typed it now, so don't worry about simple mistakes)
if image == "lighten":
red_channel = red_channel + 50
else:
red_channel = red_channel - 50
Notice how I repeat the same code with a different statement. Is it possible to achieve something like this:
if (image == "lighten"):
operator = +
else:
operator = -
red_channel = red_channel operator 50
source
share