[Tutor] password loop

Steve Willoughby steve at alchemy.com
Sat Sep 24 01:17:31 CEST 2011


On 23-Sep-11 15:56, ADRIAN KELLY wrote:
> Can anyone help me with the programme below; i hope you can see what i
> am trying to do, if i enter the wrong password the loop goes on forever
> and if i enter the right one nothing is printed...
> i am a newbie............all comments welcome

Remember that raw_input() is what actually asks you a question and 
stores your answer somewhere.  You only ever ask the question one time 
in your code, then keep re-checking the same value over and over, 
without anything to ever change its value.

In a case like this, it's helpful (especially if you're new to 
programming) to step through the instructions you've written for the 
computer, one at a time, and repeat to yourself what each step is 
accomplishing.

-- 
Steve Willoughby / steve at alchemy.com
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C


More information about the Tutor mailing list