Home>Article>Backend Development> What is the code to draw a red five-pointed star using python?
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())
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:
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!