On Jan 21, 9:12 am, Terry Jones <[EMAIL PROTECTED]> wrote: [...] > Hi Arnaud.
Hi Terry [...] > WRT to the missing solution, note that my code only allowed multiplication > by 1 if it was the last thing done. That was because you can multiply by 1 > at any time, and I didn't want to see those trivially equivalent solutions > (same goes for adding 0). Seeing as you're allowed to omit numbers, I've > now gotten rid of those trivial operations altogether in my solution. Sorry I gave an incorrect example to illustrate my question last night (I blame this on baby-induced sleep deprivation ;), so I'll have another go: Say I have 2, 3, 4, 100 and I want to make 406. AFAICS there is only one way: (2*3)+(4*100), i.e. in postfix notation: 2 3 * 4 100 * + It seemed to me that your function wouldn't generate that sort of solution (as you always extend partialSolution by [num, op] making the subsequence [mul, add] impossible). Am I wrong? -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list