Mastering Python: A Step-by-Step Guide to Drawing Stars

Mary Aug 04, 2026

Did you know you can easily draw a star in Python using its built-in turtle module? Whether you're a beginner looking to create simple shapes or a student working on a school project, here's a step-by-step guide to help you draw a star with Python.

Drawing star with python ๐ŸŒŸ
Drawing star with python ๐ŸŒŸ

Before we dive in, ensure you have Python installed on your computer, as we'll be using its graphical capabilities through the turtle module. If you're not sure, open your command prompt or terminal and type python --version or python3 --version. If Python is installed, you'll see a version number displayed.

Pattern Printing in Python โญ | Beginner Loop Practice Program
Pattern Printing in Python โญ | Beginner Loop Practice Program

The Classic 5-Point Star

The most common star shape is a five-pointed star. In Python, you can draw one using the turtle module with just a few lines of code.

How To Draw 3D Star
How To Draw 3D Star

Let's start by importing the turtle module and creating a new instance of the turtle class, which we'll use to draw our star.

Setting Up The Turtle

python draw star #python #programming  #turtle
python draw star #python #programming #turtle

Here's how to set up the turtle and give it a friendly name:

```python import turtle # Create a new turtle my_turtle = turtle.Turtle() ```

Now that we've set up our turtle, we can give it some instructions to draw the star.

Drawing The Star

How To Draw a 3D Star
How To Draw a 3D Star

The key to drawing the star is to understand the geometry behind it. A five-pointed star can be drawn using a combination of straight lines and 144-degree turns. Here's the code to draw a star using these principles:

```python for _ in range(5): my_turtle.forward(100) # Move forward by 100 units my_turtle.right(144) # Turn right by 144 degrees ```

In this example, we're using a for loop to repeat the process of moving forward and turning right five times. The result is a beautiful, five-pointed star.

Here's the complete code to draw the star, including a call to update the screen and close the window when you're done:

python turtle graphic
python turtle graphic

```python import turtle # Create a new turtle my_turtle = turtle.Turtle() for _ in range(5): my_turtle.forward(100) my_turtle.right(144) # Hide the turtle when we're done my_turtle.hideturtle() # Update the screen and close the window on click turtle.done() ```

Customizing Your Star

Now that you know how to draw a basic star, let's explore some ways to customize its appearance. We'll look at changing the size, color, and shape of your stars.

8 Steps How to Draw a Star Using Simple Geometry Lines
8 Steps How to Draw a Star Using Simple Geometry Lines
Most-liked video | 27K views ยท 21K reactions | How to draw star | condsty | Facebook
Most-liked video | 27K views ยท 21K reactions | How to draw star | condsty | Facebook
draw star
draw star
How to draw a Star in 3D ๐ŸŒŸ#shortsfeed #shortsvideo #drawing #tutorialtamil
How to draw a Star in 3D ๐ŸŒŸ#shortsfeed #shortsvideo #drawing #tutorialtamil
how to draw stars on paper with the words,'how to draw stars '
how to draw stars on paper with the words,'how to draw stars '
How to Draw a Shining Star | Simple Step by Step Art Tutorial
How to Draw a Shining Star | Simple Step by Step Art Tutorial
How to Draw a 5-point Star
How to Draw a 5-point Star
How to Draw a Star Step by Step (Multiple Points!) | Envato Tuts+
How to Draw a Star Step by Step (Multiple Points!) | Envato Tuts+
How to Draw a 64 Star Tetrahedron - Zak Korvin
How to Draw a 64 Star Tetrahedron - Zak Korvin

The turtle module provides several methods for customizing your star. You can use the forward() and right() methods to adjust its size, the color() method to change its color, and the pencolor() method to alter the color of the lines it draws.

Adjusting Size

To change the size of your star, simply adjust the size of the steps your turtle takes. In the previous example, we used 100 units as the step size. By changing this value, you can create larger or smaller stars.

```python for _ in range(5): my_turtle.forward(200) # Larger star ```

Or, for a smaller star:

```python for _ in range(5): my_turtle.forward(50) # Smaller star ```

Changing Color

The color() method allows you to set the fill color of your star. Here's how to create a red star:

```python my_turtle.color("red") ```

You can also change the outline color separately using the pencolor() method:

```python my_turtle.pencolor("blue") ```

Combining these methods allows you to create stars with different fill and outline colors:

```python # Yellow star with a blue outline my_turtle.color("yellow") my_turtle.pencolor("blue") ```

Creating Different Star Shapes

The secret to drawing different star shapes lies in adjusting the angle of each turn. While we used a 144-degree turn for a five-pointed star, other angles can create entirely new shapes. Here's how to draw a six-pointed star (a hexagram) by changing the angle to 120 degrees:

```python for _ in range(6): my_turtle.forward(100) my_turtle.right(120) ```

And here's a seven-pointed star using a 128.57-degree turn:

```python for _ in range(7): my_turtle.forward(100) my_turtle.right(128.57) ```

By experimenting with different angles, you can discover a wide range of star shapes and designs.

Drawing a star in Python is an excellent way to start learning about programming and graphical design. As you've seen, creating a simple yet engaging shape can be as easy as moving a turtle around the screen. With a little creativity and some trial and error, you can create a wide variety of stars and other shapes using Python's built-in tools.

Now that you've mastered the basics of drawing stars in Python, why not try creating your own designs or exploring other shapes and patterns? The turtle module opens up a world of possibilities, and you're well on your way to becoming a Python graphics maestro. Happy coding!