Python Tanks - Repeat it with your own functions

Sometimes we want to group several commands into one block and reuse it again. One of the recipes for this is to put them into "function". Note the syntax in the example below:
- we start with "def" keyword
- we put parentheses after function name (which could be any) and a colon
- then we put commands into its "body", indenting them with 4 spaces from line start

To call this function we put it in our program just as any other command (they are functions also, by the way). Do not forget parentheses.

Prev
#we define function with 'def' keyword #and put colon after parentheses #all commands inside should be shifted right with 4 spaces def my_function(): forward() forward() left() left() print('my_function completed') #now we can call this function, perhaps several times my_function() my_function() #modify function so that it reach the star #pick it and and turn right #then call it three times to collect all the stars!