Home>Article>Backend Development> 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
PHPz Original
2020-09-25 16:02:36 28620browse

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

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!

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