Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'syntax': 0.04; 'elif': 0.05; 'subject:help': 0.08; 'forcing': 0.09; 'interpreted': 0.09; 'occasionally': 0.09; 'parsed': 0.09; 'statements': 0.09; 'ah!': 0.16; 'before.': 0.16; 'cause.': 0.16; 'expression,': 0.16; 'expression.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'pointed': 0.19; 'properly': 0.19; 'later': 0.20; 'work,': 0.20; 'now?': 0.24; 'header:In- Reply-To:1': 0.27; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'getting': 0.31; 'file': 0.32; 'probably': 0.32; 'quite': 0.32; 'open': 0.33; 'actual': 0.34; 'problem': 0.35; "can't": 0.35; 'received:209.85': 0.35; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'next': 0.36; 'received:209': 0.37; 'sometimes': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'pm,': 0.38; 'previous': 0.38; 'delete': 0.39; 'to:addr:python.org': 0.39; "you're": 0.61; 'guarantee': 0.63; 'close': 0.67; 'invalid': 0.68; 'line,': 0.68; 'moves': 0.84; 'relating': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=L68X6r3z4uR9i3xvlHl4q85X8/rqNcewDS3N4Db2oS4=; b=FC6mWPJpVreSsEPj4llXnvY2TXvglaIhdJrfRXxW7Yz/kGNE9m5fgIX6Xk+O/AAvz3 btXrq229ZSYxQziTuaiq9eBOMregxQqsr2XHLIKWpehyXG93SmxMd/BR61tvswnTsnRG nW+6+/mTV06kN3E04FbihOX+kA7RXQBfZU3yBbzg7mBWUxiwPg5sLvm2EWBeRkQDXVPI ChPwhdtnnzUH93KNjvlIZ8PRhMR68dcJgY7b8cHlta5KzachG2r7GiW9n1ciHc6y7T0m 1r6e/WFhfhIQRvdaOaCzfl6vjKQyNjx7QPY2UxsRvwNtiSQhgSm1n5Q6r7e1DENfmgnm /ceg== MIME-Version: 1.0 X-Received: by 10.52.91.71 with SMTP id cc7mr1625418vdb.58.1365516325487; Tue, 09 Apr 2013 07:05:25 -0700 (PDT) In-Reply-To: <596ca4b8-b5aa-4112-b086-6320108075f7@googlegroups.com> References: <596ca4b8-b5aa-4112-b086-6320108075f7@googlegroups.com> Date: Wed, 10 Apr 2013 00:05:25 +1000 Subject: Re: While loop help From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365516328 news.xs4all.nl 6978 [2001:888:2000:d::a6]:38648 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:43173 On Tue, Apr 9, 2013 at 11:58 PM, wrote: > Also I'm getting a invalid syntax next to my elif statements that i wasnt getting before. why is this happening now? Ah! That's relating to the close parenthesis problem I mentioned. That's the exact issue I saw. When you get told about a problem, sometimes the location pointed out isn't the actual cause. What you have is a (near) guarantee that the problem is no later in the file than that point; often it'll be on that line or the one previous line. In this case, the code is "raw_input(........ elif", which can't be properly parsed - the open parenthesis is forcing the code to be interpreted as an expression, and elif isn't an expression. If you're stuck figuring out a problem, one neat trick is to delete the line of code that's blamed for the problem and try again. If the problem disappears, it was on that line; if the problem moves down to the next line, it's probably on the preceding line. This trick doesn't always work, but it can occasionally be quite handy. ChrisA