8. Python Functions
Let's create a Python function that we can use to draw triangles in turtle graphics.
- Start a new Python trinket on trinket.io using the "New Trinket" button.
- Change the name of your trinket from "Untitled" to something like "Sierpinski".
- Click the "+" icon to the right of the "main.py" tab, to create a new file. Change the name to "striangle.py"
- In striangle.py, type in the code below.
- Then switch back to the "main.py" so we can use our "striangle" function.
- After you run the program, change the "parameters" in the call to striangle. What do the three parameters do?
Learning Targets
- I can create a Python function and call it recursively.