Python Tanks - Introducing Loops and Conditions

We can repeat commands also by enclosing them into "while" loop. We use condition to determine when the loop should stop. For such condition let's call "look_ahead()" function and test there is no wall.
The "while" loop repeats while condition is true. Symbol '!=' is "not equals" so the whole condition reads "while look_ahead not equals wall".

Take care of correct syntax, please! Computers do not like typos!

Prev
#the code below contains "while" loop #note colon after condition #and that command(s) inside are indented with 4 spaces #condition consists of call to "look_ahead()" function #it returns either 'wall' or 'star' or '' (empty string) #we move forward while there is no wall ahead while look_ahead() != 'wall': forward() #now make tank turn after reaching the wall #and run to star to pick it. #perhaps it is a place for second loop.