Is the reason that you are mutliplying vars rather than using `combinations_with_replacements` so you get the right numerical coefficient in front? Isn't there, maybe, a simple function that would calculate these coefficients so you don't have to keep growing the list? Or perhaps this is just the simplest way to calculate the coefficient and it won't ever take that much time or space to do so?

Would it be better to initialize v = [] above the loop and then replace v = vars*i with v.extend(vars)?