Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #49063

Re: Loop Question

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <kwpolska@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.027
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'else:': 0.03; 'subject:Question': 0.07; 'thx': 0.09; 'cc:addr:python-list': 0.11; 'posted': 0.15; '23,': 0.16; '24,': 0.16; 'gpg': 0.16; 'true:': 0.16; 'wrote:': 0.18; 'users.': 0.18; 'module': 0.19; 'code,': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'mon,': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'right.': 0.26; 'second': 0.26; 'header:In-Reply-To:1': 0.27; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'you?': 0.31; '"please': 0.31; 'username': 0.31; 'writes:': 0.31; 'beginning': 0.33; "can't": 0.35; 'test': 0.35; 'received:google.com': 0.35; 'url:org': 0.36; 'should': 0.36; 'pm,': 0.38; 'does': 0.39; 'users': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'life,': 0.60; 'break': 0.61; 'john': 0.61; 'from:charset:utf-8': 0.61; 'back': 0.62; 'email addr:gmail.com': 0.63; 'real': 0.63; 'to:addr:gordon': 0.84; 'url:tk': 0.95; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=E8Iq4MFYiQT1t+haiRZzSz1ZBelEsyZVm9MUaTOir74=; b=cXs+nX74ZYdsGkr+HX0FjBSSQGS15tRmY74t7HCICUeaaBOX1/KOCOGZWEgPkMHDLV S8LqSQWUBOwkWxLr8+2jGW47jEGfScP+sdhkqG6Jwt1LMuXBw0bK09CXNrdssxBN7EHC e3TrwTAPM2ynmQNy0B8P1LWWszS718chMmYNq9ZLMKmHv+/xb2/CLyQO5bafGrWhZQn8 7uA7PgwT70DSOh7BGyYm0ghTiUr0hhfvg8o1EjGBfVXbTBQJq2Ag8S+utOizJ51Ix//x avyzrHS4RXFW8chMkZWbPplquQ1p77iYdEKV/oPgegn+QyRUjkDIjPleuv9pSAHylACd KpsQ==
X-Received by 10.42.50.16 with SMTP id y16mr3221226icf.114.1372100006577; Mon, 24 Jun 2013 11:53:26 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <kqa3v3$ddf$1@reader2.panix.com>
References <2149a85e-e41b-46bf-a12d-7565789748a9@googlegroups.com> <e41ce3a3-c8cb-4cfc-ba86-462f40f322fc@googlegroups.com> <kqa3v3$ddf$1@reader2.panix.com>
From Chris “Kwpolska” Warrick <kwpolska@gmail.com>
Date Mon, 24 Jun 2013 20:53:06 +0200
Subject Re: Loop Question
To John Gordon <gordon@panix.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3754.1372100014.3114.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1372100014 news.xs4all.nl 15966 [2001:888:2000:d::a6]:49315
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:49063

Show key headers only | View raw


On Mon, Jun 24, 2013 at 8:42 PM, John Gordon <gordon@panix.com> wrote:
> In <e41ce3a3-c8cb-4cfc-ba86-462f40f322fc@googlegroups.com> christhecomic@gmail.com writes:
>
>> On Sunday, June 23, 2013 6:18:35 PM UTC-5, christ...@gmail.com wrote:
>> > How do I bring users back to beginning of user/password question once they
>> >
>> > fail it? thx
>
>> Can't seem to get this to cooperate...where does the while statement belong?
>
> 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.  Remember to always test code before submitting.  And note that
the getpass module is what you should use for that second thing in
real life, for the security of your users.

--
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail                | always bottom-post
http://asciiribbon.org        | http://caliburn.nl/topposting.html

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Loop Question christhecomic@gmail.com - 2013-06-23 16:18 -0700
  Re: Loop Question rurpy@yahoo.com - 2013-06-23 16:49 -0700
    Re: Loop Question christhecomic@gmail.com - 2013-06-23 20:24 -0700
  Re: Loop Question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-24 00:23 +0000
  Re: Loop Question christhecomic@gmail.com - 2013-06-24 05:12 -0700
    Re: Loop Question rusi <rustompmody@gmail.com> - 2013-06-24 07:03 -0700
    Re: Loop Question Lutz Horn <lutz.horn@posteo.de> - 2013-06-24 14:20 +0200
    Re: Loop Question Dave Angel <davea@davea.name> - 2013-06-25 09:40 -0400
  Re: Loop Question christhecomic@gmail.com - 2013-06-24 11:23 -0700
    Re: Loop Question John Gordon <gordon@panix.com> - 2013-06-24 18:42 +0000
      Re: Loop Question Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-06-24 20:53 +0200
        Re: Loop Question John Gordon <gordon@panix.com> - 2013-06-24 19:00 +0000
          Re: Loop Question Dave Angel <davea@davea.name> - 2013-06-24 15:23 -0400

csiph-web