[Tutor] IndexError: list index out of range

Alan Gauld alan.gauld at btinternet.com
Thu Sep 20 09:23:11 CEST 2007


"bhaaluu" <bhaaluu at gmail.com> wrote 

> of it. But the search worked even when stackB
> and stackC were empty. Interesting. 

You never checked stackB or stackC when they were 
empty because it always found something in a prior
stack first.

> I could see, all three conditionals in popNum(num)
> were the same, just checking different lists.

They were, and all had the same problem, 
you only hit it on stackA.

If you had started your sequence with 1c instead 
of 1b and then tried 1b you would have hit the problem 
on the second move.

Alan G.



More information about the Tutor mailing list