Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!goblin3!goblin.stu.neva.ru!panix!gordon From: John Gordon Newsgroups: comp.lang.python Subject: Re: Loop Question Date: Mon, 24 Jun 2013 19:00:19 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 31 Message-ID: References: <2149a85e-e41b-46bf-a12d-7565789748a9@googlegroups.com> NNTP-Posting-Host: panix1.panix.com X-Trace: reader2.panix.com 1372100419 3273 166.84.1.1 (24 Jun 2013 19:00:19 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Mon, 24 Jun 2013 19:00:19 +0000 (UTC) User-Agent: nn/6.7.3 Xref: csiph.com comp.lang.python:49065 In =?UTF-8?B?Q2hyaXMg4oCcS3dwb2xza2HigJ0gV2Fycmljaw==?= writes: > > while True: > > username = raw_input("Please enter your username: ") > > password = raw_input("Please enter your password: ") > > > > if username == "john doe" and password == "fopwpo": > > print "Login Successful" > > break > > > > else: > > print "Please try again" > You didn't test the code, did you? Because the code you posted is > right. It's right, therefore I did not test it? I don't understand. If the code has a bug, please point it out. > And note that the getpass module is what you should use for that second > thing in real life, for the security of your users. I'm sure this is just an exercise for the OP to understand loops. Security would be counter-productive. -- John Gordon A is for Amy, who fell down the stairs gordon@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies"