Home > Backend Development > Python Tutorial > What is the code to draw a red five-pointed star using python?

What is the code to draw a red five-pointed star using python?

PHPz
Release: 2020-09-27 13:22:37
Original
28723 people have browsed it

The code for using python to draw a red five-pointed star is [fillcolor("red");begin_fill();while True:forward(200) right(144)if abs(pos())

What is the code to draw a red five-pointed star using python?

Related learning recommendations: python tutorial

The code to draw a red five-pointed star using python is:

Using Python code to draw a red five-pointed star

Code implementation:

from turtle import *
fillcolor("red")
begin_fill()
while True:
forward(200)
right(144)
if abs(pos()) < 1:
break
end_fill()
Copy after login

Output result:

What is the code to draw a red five-pointed star using python?

The above is the detailed content of What is the code to draw a red five-pointed star using python?. 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