[Tutor] New to programming-Help

brian illingworth blugerz at yahoo.com
Fri May 21 21:35:07 EDT 2004

Hi I am new to this group and new to programming.  I have 
 had this interest in learning to program because.......well 
just because.  It's just a curiosity that I have.  The reason 
 I am starting with Python, well some of the websites I went 
 to recommended Python, so here I am. 
 Ok on to the question.
 I am currently using the book "Python programming for 
 absolute beginners" by Michael Dawson.  The program I am 
 working on is a password program....dont laugh I know it's 
 really simple to some, but I am kinda stuck.  The book shows 
 how to code a password program like
 password = raw input("Enter your password:")
 if password == "secret":
      print "Access Granted"
      print "Access Denied"
 raw input("Press the enter key to exit")
 Ok that is easy enough I understand what is going on here.  
 As the book goes on it also talks about elif, and while 
 loops.  At the end of the chapter it gives various challenges 
 that the reader is asked to complete.  One of the challenges 
 is to take the password program from above and change it so 
 that the user gets only three attempts to enter the correct 
 password.  Well I ain't got it to work yet, I thought I came 
 close, but no cigar.  This is what I have so far: #Limiting 
 password atempts to three
 password = raw input("Enter your Password: ")
 count = 0
 while password != "secret":
      print password = raw-input("Enter your Password: ")
      count += 1

 if password == "secret":
      print "Welcome in."
 elif count > 3:
      print "Please come back when you remember your Password."
      raw input("Press enter to exit.")

  Ok, I know I may be way off course here but any help would be 
 greatly appreciated.  I dont want to get frustrated and say 
 the heck with it, especially if it is something minor.  
 Thanks in advance.

Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040521/15631749/attachment.html

More information about the Tutor mailing list