The question is a bit misleading, because a tuple is immutable. What I want is:
Having a tuple a = (1, 2, 3, 4)
get a tuple b
that is exactly like a
except for the last argument which is, say, twice the last element of a
.
=> b == (1, 2, 3, 8)