Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'python,': 0.02; 'argument': 0.05; 'elif': 0.05; 'exit': 0.09; 'input,': 0.09; 'seen,': 0.09; 'though...': 0.09; 'clear.': 0.16; 'comma': 0.16; 'exit()': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'help"': 0.16; 'semicolon': 0.16; "someone's": 0.16; 'terminate.': 0.16; 'wrote:': 0.18; 'entered': 0.20; 'code,': 0.22; 'print': 0.22; "i've": 0.25; 'second': 0.26; 'post': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; '"the': 0.34; 'problem': 0.35; 'basic': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'fun,': 0.36; 'that!': 0.36; 'doing': 0.36; 'next': 0.36; 'shows': 0.36; 'thank': 0.38; 'ends': 0.38; 'to:addr :python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'even': 0.60; 'simply': 0.61; 'first': 0.61; "you've": 0.63; 'making': 0.63; 'grab': 0.64; 'chance': 0.65; 'close': 0.67; 'statement,': 0.68; 'subject': 0.69; 'evaluate': 0.72; 'attention': 0.75; 'subject:VERY': 0.84; 'sum.': 0.84; 'write:': 0.91; '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:date:message-id:subject:from:to :content-type; bh=TIaL+YrVccOdRf7qpoeDnHVW/r65Sz/dx4fF4p2j56w=; b=hsXrS4cBWPKdyjGwft5Ch3MMAMNqukQ7kOO5Yy9SvdcpZxGZpVIzgxfe4bDO8BoZwd xbLH+mBx32r/im3wK8XApC9GA283Dn4DmyjivmnOzJsxVt8rKvzJAW/OrTz01hUeGggf sTRvZRB/NmXSmgGOBcCsANpXrZh9L24p0Nq/voaoJPSQflU8FXHZ/NdQXAUfMhp0Yh7B YA3mhKDb5CEVhyOYxNxbME6Dvpm5W98TfNRpf7cAiLsXrSsZ9u9Z/tGS43B8tRZWuSRC occfQI28OtNQBuK6Msi5MWr41pFStZgLEFGDK63Vwa8X3tyOD1BF55VcnJkskOhKE1RV +M7g== MIME-Version: 1.0 X-Received: by 10.52.227.6 with SMTP id rw6mr19588028vdc.19.1380560856797; Mon, 30 Sep 2013 10:07:36 -0700 (PDT) In-Reply-To: <380132bc-bc9c-4d57-95d8-dc01f26f47a5@googlegroups.com> References: <380132bc-bc9c-4d57-95d8-dc01f26f47a5@googlegroups.com> Date: Tue, 1 Oct 2013 03:07:36 +1000 Subject: Re: VERY BASIC 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1380560866 news.xs4all.nl 15867 [2001:888:2000:d::a6]:59558 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:55090 On Tue, Oct 1, 2013 at 2:55 AM, wrote: > print "Invalid input.";raw_input("Press to close this window");exit > 1. Even if c is not 2 or 3, the program continues, as if it received a valid input, it does not exit as I have tried to code it to. In Python, exit isn't a statement, it's a function. So you need to write: exit() to actually terminate. > elif p==3 and c==3: > print "The result is :";x+y+z > 2. If all values are entered correctly, the result does not display. It shows up as "The result is :" and just blank. The semicolon ends the print statement, and then you simply evaluate and do nothing with the sum. Try a comma instead - that'll make it a second argument to print, so it'll be printed out as you expect. Thank you for making your problem so clear. You've given your code, and you've said exactly what it's doing that you don't expect. I really appreciate that! But one thing I would ask: Next time, please consider your subject line. That's the first chance you have to grab someone's attention - "VERY BASIC HELP" doesn't say _what_ you need help with. :) Your post makes a nice change from some I've seen, though... Have fun, happy Pythoning! ChrisA