Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7295
| Date | 2011-06-09 05:54 -0700 |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Subject | Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE |
| References | <mailman.30.1307563778.11593.python-list@python.org> <rqednZoL2ezK8m3QnZ2dnUVZ5hKdnZ2d@giganews.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.52.1307624146.11593.python-list@python.org> (permalink) |
Larry Hudson wrote:
> On 06/08/2011 01:09 PM, Cathy James wrote:
>> Dog Breed: "))
>> while not dogs:
>> print("Goodbye!!")
>> sys.exit()
>> else:
>
> else does not belong with while.
else works just fine with while; it is the path taken when the while is
exhausted, but not broken out of:
--> i = 5
--> while i:
... print(i)
... i -= 1
... else:
... print("blast off!")
...
5
4
3
2
1
blast off!
--> i = 5
--> while i:
... print(i)
... i -= 1
... if i == 3:
... print('aborting')
... break
... else:
... print("blast off!")
...
5
4
aborting
~Ethan~
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Of Functions, Objects, and Methods-I NEED HELP PLEASE Cathy James <nambo4jb@gmail.com> - 2011-06-08 15:09 -0500
Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE John Gordon <gordon@panix.com> - 2011-06-08 20:42 +0000
Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Larry Hudson <orgnut@yahoo.com> - 2011-06-08 23:59 -0700
Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Ethan Furman <ethan@stoneleaf.us> - 2011-06-09 05:54 -0700
Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Ethan Furman <ethan@stoneleaf.us> - 2011-06-09 06:10 -0700
Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-06-09 10:25 -0700
Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Larry Hudson <orgnut@yahoo.com> - 2011-06-09 23:07 -0700
csiph-web