Help me write better Code

sssdevelop sssdevelop at gmail.com
Thu Jul 10 10:38:55 EDT 2014


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 at 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.




More information about the Python-list mailing list