Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'python,': 0.02; 'read.': 0.03; 'elif': 0.05; 'tries': 0.07; 'meaningful': 0.09; '--------': 0.10; '>the': 0.16; 'guess.': 0.16; 'loop.': 0.16; 'looping': 0.16; 'received:exchangelabs.com': 0.16; 'received:prod.exchangelabs.com': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '<': 0.19; 'example': 0.22; 'aug': 0.22; 'putting': 0.22; 'to:name:python-list@python.org': 0.22; 'question': 0.24; '>': 0.26; 'asking': 0.27; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; "doesn't": 0.30; 'statement': 0.30; 'url:mailman': 0.30; 'work.': 0.31; 'getting': 0.31; 'url:wiki': 0.31; 'indentation': 0.31; 'received:169.254': 0.32; 'supposed': 0.32; 'another': 0.32; 'url:python': 0.33; 'guess': 0.33; 'but': 0.35; 'skip:> 10': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'should': 0.36; 'received:169': 0.37; 'email addr:python.org': 0.37; 'received:10': 0.37; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; 'subject:': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'space': 0.40; 'url:mail': 0.40; 'back': 0.62; 're:': 0.63; 'skip:n 10': 0.64; 'places': 0.64; 'email name:python-list': 0.65; 'charset:windows-1252': 0.65; 'effectively': 0.66; 'number:': 0.66; 'here': 0.66; 'exercise.': 0.84; 'guessed': 0.84; 'working,': 0.84 From: Andrew Christianson To: Seymore4Head , "python-list@python.org" Subject: RE: Wikibooks example doesn't work8 Thread-Topic: Wikibooks example doesn't work8 Thread-Index: AQHPsfGv0AE8WyzGq0K0nV1gS+qxWQ== Date: Thu, 7 Aug 2014 03:43:00 +0000 References: , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [12.0.87.57] x-microsoft-antispam: BCL:0;PCL:0;RULEID: x-forefront-prvs: 029651C7A1 x-forefront-antispam-report: SFV:NSPM; SFS:(24454002)(479174003)(189002)(199002)(51704005)(85306004)(77096002)(63666004)(85852003)(106356001)(107046002)(4396001)(83072002)(74502001)(101416001)(95666004)(106116001)(105586002)(99396002)(74662001)(92726001)(19625215002)(2656002)(87936001)(15975445006)(107886001)(33646002)(19580395003)(76176999)(19580405001)(83322001)(19617315012)(92566001)(81542001)(79102001)(31966008)(64706001)(86362001)(54356999)(81342001)(46102001)(20776003)(50986999)(21056001)(16236675004)(15202345003)(77982001)(66066001)(76482001)(80022001); DIR:OUT; SFP:; SCL:1; SRVR:DB3PR01MB219; H:DB3PR01MB220.eurprd01.prod.exchangelabs.com; FPR:; MLV:sfv; PTR:InfoNoRecords; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-OriginatorOrg: ipsos.com X-MC-Unique: ZRovpmhWSrObVhJkpYtsfw-1 Content-Type: multipart/alternative; boundary="_000_3l7tclbc0tp1hsu4r661t8tp1407382818739emailandroidcom_" X-Mailman-Approved-At: Thu, 07 Aug 2014 07:04:36 +0200 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: 156 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407387878 news.xs4all.nl 2867 [2001:888:2000:d::a6]:60007 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:75833 --_000_3l7tclbc0tp1hsu4r661t8tp1407382818739emailandroidcom_ Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable The if statement in question isn't inside the while loop. White space and indentation is meaningful in python, so putting the if coun= t > 3 block at same indentation as the while statement effectively places i= t outside the loop. Regards, Drew -------- Original message -------- From: Seymore4Head Date:08/06/2014 20:32 (GMT-08:00) To: python-list@python.org Subject: Re: Wikibooks example doesn't work On Wed, 06 Aug 2014 22:58:51 -0400, Seymore4Head wrote: >number =3D 7 >guess =3D -1 >count =3D 0 > >print("Guess the number!") >while guess !=3D number: > guess =3D int(input("Is it... ")) > count =3D count + 1 > if guess =3D=3D number: > print("Hooray! You guessed it right!") > elif guess < number: > print("It's bigger...") > elif guess > number: > print("It's not so big.") The part to here is supposed to be an example to allow the user to guess at a number (7) with an infinite amount of tries. This part was added as an exercise. A counter is added to give 3 tries to guess the number. It is supposed to stop after count gets to 3. It doesn't. It just keeps looping back and asking for another guess. >if count > 3: > print("That must have been complicated.") >else: > print("Good job!") > >http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_3/Deci= sions > >Why not? >I think I know why it isn't working, but I don't know enough yet on >how it should work. >The If statement isn't getting read. -- https://mail.python.org/mailman/listinfo/python-list --_000_3l7tclbc0tp1hsu4r661t8tp1407382818739emailandroidcom_ Content-Type: text/html; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable
The if statement in question isn't inside the while loop.  

White space and indentation is meaningful in python, so putting the if= count > 3 block at same indentation as the while statement effectively = places it outside the loop.  

Regards,

Drew
-------- Original message --------
From: Seymore4Head
Date:08/06/2014 20:32 (GMT-08:00)
To: python-list@python.org
Subject: Re: Wikibooks example doesn't work

On Wed, 06 Aug 2014 22:58:51 -0400, Seymore4Head <Seymore4Head@Hotmail.invalid> wrote:

>number =3D 7
>guess =3D -1
>count =3D 0
>
>print("Guess the number!")
>while guess !=3D number:
>    guess =3D int(input("Is it... "))
>    count =3D count + 1
>    if guess =3D=3D number:
>        print("Hooray! You gues= sed it right!")
>    elif guess < number:
>        print("It's bigger...&q= uot;)
>    elif guess > number:
>        print("It's not so big.= ")

The part to here is supposed to be an example to allow the user to
guess at a number (7) with an infinite amount of tries.


This part was added as an exercise.
A counter is added to give 3 tries to guess the number.
It is supposed to stop after count gets to 3.  It doesn't.  It ju= st
keeps looping back and asking for another guess.

>if count > 3:
>    print("That must have been complicated.")<= br> >else:
>    print("Good job!")
>
>http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutori= al_for_Python_3/Decisions
>
>Why not?
>I think I know why it isn't working, but I don't know enough yet on
>how it should work.
>The If statement isn't getting read.
--
https://ma= il.python.org/mailman/listinfo/python-list

--_000_3l7tclbc0tp1hsu4r661t8tp1407382818739emailandroidcom_--