Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.049 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'else:': 0.03; 'subject:Question': 0.07; '(other': 0.16; 'clauses': 0.16; 'received:74.208.4.195': 0.16; 'two.': 0.16; 'wrote:': 0.18; 'print': 0.22; 'header:User-Agent:1': 0.23; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; '"please': 0.31; 'username': 0.31; 'skip:u 20': 0.35; 'test': 0.35; 'hi,': 0.36; 'two': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'how': 0.40; 'new': 0.61; 'more': 0.64; 'different': 0.65; 'taking': 0.65; 'received:74.208': 0.68 Date: Tue, 25 Jun 2013 09:40:41 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Loop Question References: <2149a85e-e41b-46bf-a12d-7565789748a9@googlegroups.com> <9e7940d2e7647db397ab662d33b06128@posteo.de> In-Reply-To: <9e7940d2e7647db397ab662d33b06128@posteo.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:FJFyK1WEd3ox4E/jqBxS6LDttUlmZ+FzcC3bRUaZwcn 75dthA0svNstuTgEiG2FW3TCm2WlceXXB7MZmmNzNwV7c4exSo Bde9qT1x1JjbhiwE52JiyngINnN+pfAEkRSVLipd2kh+VoNwtd A09QAcIYgNzSgO1FnBKWO4eo1Qkwfmgx9geGRVVIo4IWrVI9ua puo1xgT8R/Vb43YR1CBJLjUaiTXe9dAvWZ3+Wb0IFARbNBdvAF 6YdlS7oPcJw5NLWpNdHgIYHpxrSYejJnIlLjtmeN3LxWDXOIq6 RCm1nqFCtX+4OlrBTtR0AlcdldaoveKa+KVWQoy3a8RbdDHbiX w5NPTNMVNmOAjkdUB3GQ= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372167656 news.xs4all.nl 15908 [2001:888:2000:d::a6]:60244 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49158 On 06/24/2013 08:20 AM, Lutz Horn wrote: > Hi, > > Am 24.06.2013 14:12 schrieb christhecomic@gmail.com: >> username=raw_input("Please enter your username: ") >> password=raw_input("Please enter your password: ") >> if username == "john doe" and password == "fopwpo": >> print "Login Successful" >> else: >> print "Please try again" > > while not username or not password or username != "john doe" or password > != "fopwpo": > print "Please try again" > username=raw_input("Please enter your username: ") > password=raw_input("Please enter your password: ") > > print "Login Successful" > > That requires you to have four raw_input() calls instead of two. And what purpose does adding the two new clauses to the while test serve? How is: while not username or not password or username != "john doe" or password != "fopwpo": different from: while username != "john doe" or password != "fopwpo": (other than taking more time and space, and being harder to read) ? -- DaveA