In this article, we are going to learn how to draw the shape of a Diamond using turtle graphics in Python.
- forward(length): moves the pen in the forward direction by x unit.
- right(angle): rotate the pen in the clockwise direction by an angle x.
- left(angle): rotate the pen in the anticlockwise direction by an angle x.
- Import the turtle modules.
- Define an instance for the turtle.
- First, make the bigger triangle
- Then make three lines inside the bigger triangle
- Then make 4 small triangles
- Then make one line above these four triangles
Below is the Python implementation of the above approach:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.