Python Basics

How to draw stars in Python Turtle

When we were in kids school, we were taught of drawing stars. Here also, you will learn how to draw stars using Python programming language.

#Program to draw stars in Python Turtle
import turtle

t = turtle.Turtle()

for i in range(5):

Output of the above program

Stars in Python Turtle

Explanation of the above code-


Here, we will move the turtle forward by 150 units and then turn it towards the right by 144°. Remember, one thing you have to turn the turtle by 144°. IIf you turn it by some other angle then you will not be able to draw the star.

Recommended Posts