Header Ads

Header ADS

Drawing Shape using Turtle Graphics



Source Code:


import turtle
turtle.color('dodgerblue')
#fix the position not necessary
turtle.pensize(3)
turtle.speed(1)
turtle.penup()
turtle.backward(50)
turtle.right(90)
turtle.forward(100)
turtle.left(90)
turtle.pendown()
#fix the position not necessary

#main code
edges = int(input('Please enter the number of edges:'))
for i in range(edges):
    turtle.forward(140)
    turtle.left(360/edges)
turtle.exitonclick()

Output:







No comments

Theme images by centauria. Powered by Blogger.