Re: [Tutor] trouble with list.remove() loop

2010-09-28 Thread Peter Otten
D Ryan (2) wrote: > Hello all, > I am currently trying to write a program which can find the solution to a > game of hangman. > In a part of the program, a user inputs a letter, a tester tells him if > the word contains that letter, and then if the answer is no, all words > containing that letter

Re: [Tutor] trouble with list.remove() loop

2010-09-28 Thread Steven D'Aprano
On Tue, 28 Sep 2010 06:55:15 pm Christian Witts wrote: > You are mutating the list that you are iterating over so in essence > you are looking at the word in list index 0, testing it, and removing > it, then moving onto list index 1 but now your list has 'amazing' in > index 0 so that does not get

Re: [Tutor] trouble with list.remove() loop

2010-09-28 Thread Christian Witts
On 25/09/2010 20:44, D Ryan (2) wrote: Hello all, I am currently trying to write a program which can find the solution to a game of hangman. In a part of the program, a user inputs a letter, a tester tells him if the word contains that letter, and then if the answer is no, all words containing th