Ticker

6/recent/ticker-posts

Unique Pattern With Turtle In Python - pattern 8

  





In this program we are going to make a very unique pattern in python using turtle library.

    Its super easy to code and so much fun. Try out this program and the code is following :



# importing turtle module
import turtle

# number of sides
= 10

# creating instance of turtle
pen = turtle.Turtle()

# loop to draw a side
for i in range(n):
    # drawing side of
    # length i*10
    pen.forward(i * 10)

    # changing direction of pen
    # by 144 degree in clockwise
    pen.right(144)

# closing the instance
# importing turtle module
import turtle

# number of sides
= 100

# creating instance of turtle
pen = turtle.Turtle()

# loop to draw a side
for i in range(n):
    # drawing side of
    # length i*10
    pen.forward(i * 10)

    # changing direction of pen
    # by 144 degree in clockwise
    pen.right(144)

# closing the instance
turtle.done()



 

Post a Comment

0 Comments