Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74308
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-07-10 07:38 -0700 |
| References | <3a608dd2-d8bf-429e-af21-ce5ac8f18272@googlegroups.com> <mailman.11704.1404929844.18130.python-list@python.org> |
| Message-ID | <4313ba97-689c-4a69-acf2-6a9986d14baf@googlegroups.com> (permalink) |
| Subject | Re: Help me write better Code |
| From | sssdevelop <sssdevelop@gmail.com> |
thank you so much! On Wednesday, July 9, 2014 11:46:41 PM UTC+5:30, Ian wrote: > On Wed, Jul 9, 2014 at 8:27 AM, sssdevelop <sssdevelop@gmail.com> wrote: > > > prev = 0 > > > blocks = [] > > > tmp = [] > > > last = 0 > > > for element in a: > > > if prev == 0: > > > > Is 0 allowed to be in the input list? What would happen if it were? > > > > > next > > > > This line doesn't do anything. It looks up the builtin function named > > next and then does nothing with it. I suspect you meant to use the > > keyword 'continue' here. > > > > > if tmp: > > > pass > > > else: > > > tmp.append(prev) > > > > if not tmp: > > tmp.append(prev) > > > > Also, give tmp a more meaningful name. Call it "current_block" or > > something descriptive like that.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Help me write better Code sssdevelop <sssdevelop@gmail.com> - 2014-07-09 07:27 -0700
Re: Help me write better Code Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-09 16:44 +0100
Re: Help me write better Code sssdevelop <sssdevelop@gmail.com> - 2014-07-10 07:39 -0700
Re: Help me write better Code Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-10 15:51 +0100
Re: Help me write better Code Rustom Mody <rustompmody@gmail.com> - 2014-07-10 11:38 -0700
Re: Help me write better Code Ian Kelly <ian.g.kelly@gmail.com> - 2014-07-09 12:16 -0600
Re: Help me write better Code sssdevelop <sssdevelop@gmail.com> - 2014-07-10 07:38 -0700
Re: Help me write better Code Terry Reedy <tjreedy@udel.edu> - 2014-07-09 14:46 -0400
Re: Help me write better Code sssdevelop <sssdevelop@gmail.com> - 2014-07-10 07:38 -0700
csiph-web