Michael NockAndroid Development Techdegree Graduate 16,017 Points
Reason for putting "guesses.append(guess)" at the end.
In the video Kenneth mentions that we have to put it at the end of the While loop, after we check if a player has guessed correctly or not. However, the while loop condition is only checked once it's reached the end of the loop, so it really shouldn't matter where you put the append. Even if you put it first it'll run through the rest of the code. Having to interrupt the code to evaluate "len(guesses) < 5" after every single instruction would be much more processor intensive ;)
Chris FreemanTreehouse Moderator 59,739 Points
You are correct in that there is some leeway in where the
append can be placed. Anywhere within the
else block of the
try statement works. This makes sure the guess was valid before appending it.
Not sure about your "evaluate... after every single instruction" comment. The
while condition is only evaluated once before the start of each loop.