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


Groups > comp.lang.python > #55090

Re: VERY BASIC HELP

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 <rosuav@gmail.com>
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 <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.495.1380560866.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Tue, Oct 1, 2013 at 2:55 AM,  <vignesh.harikrishna@gmail.com> wrote:
>     print "Invalid input.";raw_input("Press <enter> 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

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


Thread

VERY BASIC HELP vignesh.harikrishna@gmail.com - 2013-09-30 09:55 -0700
  Re: VERY BASIC HELP Chris Angelico <rosuav@gmail.com> - 2013-10-01 03:07 +1000
  Re: VERY BASIC HELP John Gordon <gordon@panix.com> - 2013-09-30 17:25 +0000
  Re: VERY BASIC HELP vignesh.harikrishna@gmail.com - 2013-09-30 10:50 -0700
    Re: VERY BASIC HELP Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-30 15:02 -0400
    Re: VERY BASIC HELP rusi <rustompmody@gmail.com> - 2013-10-01 10:12 -0700
    Re: VERY BASIC HELP Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-01 18:25 +0100

csiph-web