[Tutor] skipping ahead within a loop

Rikard Bosnjakovic rikard.bosnjakovic at gmail.com
Thu Mar 15 15:35:27 CET 2007


On 3/15/07, Clay Wiedemann <clay.wiedemann at gmail.com> wrote:
> If  doing a loop, how can one skip forward a specific amount randomly
> determined within the loop?

y = 0
while y < HEIGHT:
  linewidth = random(3, 9)
  # drawlines etc
  y += linewidth

The reason why you cannot alter the for-variable beats me, though.


-- 
- Rikard.


More information about the Tutor mailing list