Home  >  Article  >  Backend Development  >  How to draw a triangle using python

How to draw a triangle using python

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-06-11 13:56:5330434browse

First download and install the python program.

How to draw a triangle using python

#1 Find the python IDLE tool on our own computer.

Related recommendations: "python video tutorial"

How to draw a triangle using python

2. Then open IDLE and create a new file named test1.py

How to draw a triangle using python

#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)

How to draw a triangle using python

4. After entering the code, click Save. Select "run" -> "run module" in the toolbar to run and see the effect.

How to draw a triangle using python

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn