On 9/19/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > bhaaluu wrote: > > > def popNum(num): > > if num == stackA[-1]: > > stackA.pop() > > What happens here if stackA is empty? > > Kent
This was how I was looking for the number. It seems to me that if the list was EMPTY or didn't have the sought after number, it would look in the next list... after all, that's what it did 16 times in the first round... but now that I look back at it, stackA wasn't empty until after the 5 had been moved out of it. But the search worked even when stackB and stackC were empty. Interesting. As far as I could see, all three conditionals in popNum(num) were the same, just checking different lists. I tried Michael's suggestion and added: if len(stackA) > 0 and num == stackA[-1]: etc. to popNum(num) and that worked to continue through the second and third rounds of test values. Thank you very much! -- bhaaluu at gmail dot com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor