On 15/10/2017 12:20, Chris Angelico wrote:
On Sun, Oct 15, 2017 at 9:15 PM, bartc <b...@freeuk.com> wrote:
I assume you're talking about the while-loop (because on my machine, it
hangs just using 'from turtle...' or 'import turtle').
(Machine was screwed up I think, as I had to restart it shortly after
for other reasons. When the turtle graphics worked.)
That looks to be a repeat-N-times loop. There isn't a dedicated statement
for that, the closest Python feature would be 'for i in range(n)' with i a
dummy loop variable.
You can use that or "for _ in range(n)" as a pretty effective form of
that loop. I've never had a problem with it. Python doesn't need
another type of loop.
I could understand that sentiment if there were already dozens. But I
believe there's only, what, two loop types? To implement a number of
basic looping requirements which, if not that numerous, are somewhat
more than two.
Not exactly taxing the grey matter which already has those extra loop
types in mind, and has to find a way to express them in terms of only two.
--
bartc
--
https://mail.python.org/mailman/listinfo/python-list