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


Groups > comp.lang.python > #43196

Re: While loop help

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <thomasancilleri@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'continuation': 0.07; 'lately': 0.07; 'subject:help': 0.08; 'integers': 0.09; 'matched': 0.09; 'restart': 0.09; 'statements': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '2.7.2': 0.16; 'brackets.': 0.16; 'indent': 0.16; 'instance:': 0.16; 'statement.': 0.16; 'true:': 0.16; 'code.': 0.18; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'java': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'this:': 0.26; 'header:In- Reply-To:1': 0.27; "doesn't": 0.30; 'matching': 0.30; 'statement': 0.30; 'skip:( 20': 0.30; "i'm": 0.30; 'code': 0.31; '4.0': 0.31; 'compatible': 0.32; 'run': 0.32; 'could': 0.34; 'message.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'c++': 0.36; 'false': 0.36; 'doing': 0.36; 'method': 0.36; 'apple': 0.38; 'how': 0.40; 'from:no real name:2**0': 0.61; 'matter': 0.61; 'statement,': 0.68; '4.2.1': 0.84; 'imagine': 0.93
X-Received by 10.182.104.228 with SMTP id gh4mr205785obb.27.1365524655230; Tue, 09 Apr 2013 09:24:15 -0700 (PDT)
Newsgroups comp.lang.python
Date Tue, 9 Apr 2013 09:24:15 -0700 (PDT)
In-Reply-To <mailman.359.1365523839.3114.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=68.194.186.13; posting-account=iVEBawoAAADC2zcRyETBjispujvlKyYR
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>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 68.194.186.13
MIME-Version 1.0
Subject Re: While loop help
From thomasancilleri@gmail.com
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc 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>
Message-ID <mailman.363.1365524664.3114.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365524664 news.xs4all.nl 2706 [2001:888:2000:d::a6]:53406
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43196

Show key headers only | View raw


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:

while (x<3) 
{
     if ()
    else ()
}

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