python 3.x - converting for loop to while loop -


Here's my code, can someone tell me how to change an internal loop in a loop for a while?

  import turtle import time wn = turtle. Screen () Alex = Turtle. Turtle () alex.hideturtle () Alex Pancis (5) List = [[[Alex. Left (90) ',' Alex. Forward (200) ',' Time Slip (1) '], [' Alex. Right (90) ',' alex.forward (75) ',' time solid (1) '], [' Alex. Wright (90), 'Alex. Forward (55) ',' Time Sol (1) ', [' Alex Pump] ',' Alex Jito (65,136) ',' Alex Pendon (')', 'Alex Syracle (10)', 'Time Solid (1 ), 'Alex Pump ()', 'Alex (75,127)', 'Alex Pendown ()', 'Alex Jito (75,98)', 'Time Solid (1)'], ['Alex. Right (90) ',' Alex. Forward (30) ',' Time Slip (1) ',' Alex Geoto (10098) ',' Time Solid (1) '], [' Alex Pump ('' '),' Alex Geoto (75), 9 8) ', [' Alex Pendoff () ',' Alex. Left (90) ',' Alex. Forced (45) ',' Time Solid (1) '], [' Alex. Wright (120) ',' Alex.right (180) ',' alex.forward (50) ',' time.sleep (1) '], [' alex.penup () ',' alex.goto (74.00, 51) 'For items in the list,' Alex Pendon () ',' Alex. Wright (120) ',' Alex. FORDED (45) ',' Alex. Byte (120) ']]) Wn.exitonclick ()    

This is completely clear Not what you want, however, you might consider using it:

  when true:   

By then infinite form From the loop does not exist unless you exit or use the program:

  break   

is an example from Python Docs :

  while correct: n = raw_input ("please hello": ") if n.strip () = 'hello': break   

You What can be kept in loop only:

  while true: For items in the list: In objects for sublist: exec (sublist) wn.exitonclick ()   

However, without exhaust, or break, this loop will be continuously

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -