Home > Backend Development > Python Tutorial > Python draws a five-pointed star

Python draws a five-pointed star

藏色散人
Release: 2020-01-13 11:33:23
Original
27247 people have browsed it

Python draws a five-pointed star

drawing a five-pointed star with Python

Share a small case of a five-pointed star drawn using Python. Welcome to leave a message to discuss and make corrections. Boss, don’t spray, hold your fists

The following is a small code

Code:

import turtle #导入turtle库包
turtle.fillcolor("red") #填充颜色
turtle.begin_fill()              #开始画,类似起笔
count = 1                        #计时器,用于计录次数
while count <= 5:                #控制绘制次数
    turtle.forward(100) #画笔绘制的方向,向前移动指定的距离
    turtle.right(144) #向右转144度
    count += 1                   #循环绘制
    
turtle.end_fill()                #完成填充图片的绘制。
Copy after login

Effect:

Python draws a five-pointed star

##Many

python training video, all on the python learning website, welcome to learn online!

The above is the detailed content of Python draws a five-pointed star. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template