Home > Article > Backend Development > How to draw a triangle using python
First download and install the python program.
#1 Find the python IDLE tool on our own computer.
Related recommendations: "python video tutorial"
2. Then open IDLE and create a new file named test1.py
#3. Then we start editing the code. First, we need to clarify the functions used include turtle.fd and turtle.seth functions. The code is as follows:
import turtle for i in range(3): turtle.seth(i*120) turtle.fd(100)
4. After entering the code, click Save. Select "run" -> "run module" in the toolbar to run and see the effect.
The above is the detailed content of How to draw a triangle using python. For more information, please follow other related articles on the PHP Chinese website!