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


Groups > comp.lang.python > #43198

Re: While loop help

Return-Path <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'languages,': 0.04; 'continuation': 0.07; 'lately': 0.07; 'odd': 0.07; 'subject:help': 0.08; 'string': 0.09; 'false,': 0.09; 'false.': 0.09; 'integers': 0.09; 'matched': 0.09; 'restart': 0.09; 'spaces': 0.09; 'statements': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '(note': 0.16; '2.7.2': 0.16; 'boolean': 0.16; 'braces': 0.16; 'brackets.': 0.16; 'empty.': 0.16; 'indent': 0.16; 'instance:': 0.16; 'statement.': 0.16; 'true:': 0.16; '\xc2\xa0if': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'seems': 0.21; 'email addr:gmail.com&gt;': 0.22; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'java': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'this:': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'matching': 0.30; 'statement': 0.30; 'message- id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'code': 0.31; '4.0': 0.31; 'compatible': 0.32; 'run': 0.32; 'url:python': 0.33; 'level.': 0.33; 'could': 0.34; 'message.': 0.35; 'received:209.85': 0.35; 'editor': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'c++': 0.36; 'false': 0.36; 'url:listinfo': 0.36; 'doing': 0.36; 'method': 0.36; 'url:org': 0.36; 'received:209': 0.37; 'skip:& 10': 0.38; 'apple': 0.38; 'pm,': 0.38; 'url:mail': 0.40; 'how': 0.40; 'most': 0.60; 'matter': 0.61; 'to:addr:gmail.com': 0.65; 'statement,': 0.68; 'capital': 0.73; '4.2.1': 0.84; 'joel': 0.91; 'imagine': 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:cc:content-type; bh=j02Ri4uKU3n2QSb8AkOfTOnm6DLvNvY27Kn/+knxxIk=; b=kCQfeiomWtPlhio0uSu3TOebHqSfIhBy7l2p3owFF1cwu/g71beXQFpqddnpoefILK BHomDjcUASWHJDhdvtmOyBf+PBHKdfuyTimgleiW6mAwZDm2SeTbHM+Uzf4zQeueyTMr aqTtkajImtQjBrf3L9ReD3sqzVdmPw3mauJ+bc61XO6jqwq87nMJNTCXCLkCySCelZGX x6rD/uZy/sK7BFQLhGjCPbsHIbVgFEZVwsOe8YKOilnBAbnXZIu9iqeqYb3CpI5o+TCD ZL4u2V6OrqZZY62t8Up4iNApSgwnmULpauQ8yvGSE2nZ9qxS8pR52KKYn3quJ8+vGJCP Vdrg==
MIME-Version 1.0
X-Received by 10.58.155.133 with SMTP id vw5mr4110168veb.43.1365525417526; Tue, 09 Apr 2013 09:36:57 -0700 (PDT)
In-Reply-To <1629a072-c512-439c-b751-c44f8e945c2e@googlegroups.com>
References <b93147e7-9d17-4232-99a3-767b88f9e9ba@googlegroups.com> <596ca4b8-b5aa-4112-b086-6320108075f7@googlegroups.com> <mailman.348.1365516328.3114.python-list@python.org> <a530b25f-f9d9-45e9-925c-0ecd8a660cf6@googlegroups.com> <mailman.359.1365523839.3114.python-list@python.org> <1629a072-c512-439c-b751-c44f8e945c2e@googlegroups.com>
Date Tue, 9 Apr 2013 12:36:57 -0400
Subject Re: While loop help
From Joel Goldstick <joel.goldstick@gmail.com>
To thomasancilleri@gmail.com
Content-Type multipart/alternative; boundary=047d7b6729f0718e8104d9f02983
Cc "python-list@python.org" <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.365.1365525420.3114.python-list@python.org> (permalink)
Lines 115
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365525420 news.xs4all.nl 2638 [2001:888:2000:d::a6]:37266
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.astraweb.com!border5.a.newsrouter.astraweb.com!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:43198

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, Apr 9, 2013 at 12:24 PM, <thomasancilleri@gmail.com> wrote:

> For system version I get this:
> 2.7.2 (default, Oct 11 2012, 20:14:37)
> [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
>
> Also, I understand what your saying about the continuation code. There's
> no need for me to include it in each if/else statement, I could just use it
> at the end of the program outside of the statements and it would run no
> matter what. But, what I don't understand exactly is the while statement.
> I've been looking around a lot lately and notice that people say to use for
> instance:
>
> while restart: or while true: or while restart = true:
>
> What makes a statement true? Is there a way to return a true or false
> message. My method was to ask the user to type "true" and if that print
> statement matched restart = "true" then the loop would continue but i
> imagine there is a better way then matching strings and integers like i
> have been.
>
> Also what confuses me is that python doesn't use brackets. How do I
> contain all of my if/else statements into one while loop? Do I have to
> indent each line of code and extra indentation? I'm used to highschool
> doing c++ and java when I would just say:
>
> Python uses indentation.  Most people set their editor to indent 4 spaces
for each level.  It seems odd to people coming from braces languages, but
you get used to it, and it makes code very readable.

As to True/False.  There is a boolean type and its values are True and
False (note the capital letter).  But other values can be considered
True/False.  For instance 0 is considered false, and empty string is
considered false.  Any other number is considered true as is any string
that isn't empty.  Empty sequences are considered false (Tuples, lists)

> while (x<3)
> {
>      if ()
>     else ()
> }
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Goldstick
http://joelgoldstick.com

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


Thread

While loop help thomasancilleri@gmail.com - 2013-04-09 06:32 -0700
  Re: While loop help thomasancilleri@gmail.com - 2013-04-09 06:57 -0700
    Re: While loop help Dave Angel <davea@davea.name> - 2013-04-09 13:12 -0400
      Re: While loop help thomasancilleri@gmail.com - 2013-04-09 10:18 -0700
        Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 03:23 +1000
        Re: While loop help Dave Angel <davea@davea.name> - 2013-04-09 13:30 -0400
  Re: While loop help thomasancilleri@gmail.com - 2013-04-09 06:58 -0700
    Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 00:05 +1000
      Re: While loop help thomasancilleri@gmail.com - 2013-04-09 08:47 -0700
        Re: While loop help Joel Goldstick <joel.goldstick@gmail.com> - 2013-04-09 12:02 -0400
        Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 02:10 +1000
          Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:24 -0700
            Re: While loop help Joel Goldstick <joel.goldstick@gmail.com> - 2013-04-09 12:36 -0400
            Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 02:47 +1000
              Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:57 -0700
                Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 03:08 +1000
                Re: While loop help Dave Angel <davea@davea.name> - 2013-04-09 13:27 -0400
              Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:57 -0700
          Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:24 -0700
          Re: While loop help Walter Hurry <walterhurry@lavabit.com> - 2013-04-09 19:35 +0000
            Re: While loop help Dave Angel <davea@davea.name> - 2013-04-09 16:12 -0400
              Re: While loop help Walter Hurry <walterhurry@lavabit.com> - 2013-04-09 20:59 +0000
                Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 08:36 +1000
        Re: While loop help rusi <rustompmody@gmail.com> - 2013-04-10 08:59 -0700
      Re: While loop help thomasancilleri@gmail.com - 2013-04-09 08:47 -0700
  Re: While loop help Chris Angelico <rosuav@gmail.com> - 2013-04-10 00:00 +1000
  Re: While loop help thomasancilleri@gmail.com - 2013-04-09 09:49 -0700
    Re: While loop help Larry Hudson <orgnut@yahoo.com> - 2013-04-09 23:44 -0700
      Re: While loop help Larry Hudson <orgnut@yahoo.com> - 2013-04-10 20:00 -0700
  Re: While loop help jmfauth <wxjmfauth@gmail.com> - 2013-04-09 12:19 -0700

csiph-web