def funky_sum(a, b, mix): """ Returns a mixture between a and b. If mix is 0, returns a. If mix is 1, returns b. Otherwise returns a linear interpolation between them. If mix is outside the range of 0 and 1, it is capped at those numbers. """ if mix < 0: return a elif mix > 1: return b else: return (1 - mix) * a + mix * b