2023-07-19

Python Function - Drawing a Triangle with a python fucntion

I've create the following program to draw two triangles in Python 3, one half the size of the other with the robot driving away with pen down.

This is all good and have the solution in place

Working solution

However I'm obsessed in making my code shorter using a python function.

Guidance notes

I have added an optional variable in like the content advises: additional variable

This so I can draw add an argument against the function whenever I call the function to make different sizes of the triangle easily.

Can you see where I'm going wrong here?

Call the function but add an argument against another variable (SIDE_LENGTH) to make smaller or larger versions of the shape



No comments:

Post a Comment