[Tutor] dont understand part of a code
Michael Selik
michael.selik at gmail.com
Tue Jul 5 21:44:56 EDT 2016
On Tue, Jul 5, 2016 at 5:36 PM Michael Selik <michael.selik at gmail.com>
wrote:
> On Sat, Jul 2, 2016 at 8:29 AM Alan Gauld via Tutor <tutor at python.org>
> wrote:
>
>> There are arguably easier ways of doing this
>>
>
> I think you'll find that for-loops are preferable to while-loops. Here's
> an alternative implementation.
>
> https://gist.github.com/selik/d8e0a7622ceff0fe8984a7d19d44bfca
>
On further reflection, unfortunately a for-loop doesn't seem best for this
particular problem. I updated the gist, linked above. I wish the author had
chosen a better problem to emphasize Pythonic iteration.
More information about the Tutor
mailing list