Return-Path: 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>': 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: <596ca4b8-b5aa-4112-b086-6320108075f7@googlegroups.com> <1629a072-c512-439c-b751-c44f8e945c2e@googlegroups.com> Date: Tue, 9 Apr 2013 12:36:57 -0400 Subject: Re: While loop help From: Joel Goldstick To: thomasancilleri@gmail.com Content-Type: multipart/alternative; boundary=047d7b6729f0718e8104d9f02983 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 --047d7b6729f0718e8104d9f02983 Content-Type: text/plain; charset=UTF-8 On Tue, Apr 9, 2013 at 12:24 PM, 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 --047d7b6729f0718e8104d9f02983 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



On Tue, Apr 9, 2013 at 12:24 PM, <thomasancilleri@gmail.c= om> 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 statemen= t. 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 =3D true:

What makes a statement true? Is there a way to return a true or false messa= ge. My method was to ask the user to type "true" and if that prin= t statement matched restart =3D "true" then the loop would contin= ue but i imagine there is a better way then matching strings and integers l= ike i have been.

Also what confuses me is that python doesn't use brackets. How do I con= tain 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.=C2=A0 Most people set their = editor to indent 4 spaces for each level.=C2=A0 It seems odd to people comi= ng from braces languages, but you get used to it, and it makes code very re= adable.

As to True/False.=C2=A0 There is a boolean type and its valu= es are True and False (note the capital letter).=C2=A0 But other values can= be considered True/False.=C2=A0 For instance 0 is considered false, and em= pty string is considered false.=C2=A0 Any other number is considered true a= s is any string that isn't empty.=C2=A0 Empty sequences are considered = false (Tuples, lists)
while (x<3)
{
=C2=A0 =C2=A0 =C2=A0if ()
=C2=A0 =C2=A0 else ()
}
--
http://mail.python.org/mailman/listinfo/python-list



--
--047d7b6729f0718e8104d9f02983--