Skip to content

Commit 2a0ceb3

Browse files
committedMar 29, 2022
added polygon
1 parent b991603 commit 2a0ceb3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
 

‎Turtleprojects/polygon.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# draw any polygon in turtle
2+
3+
import turtle
4+
5+
# creating turtle pen
6+
t = turtle.Turtle()
7+
8+
# taking input for the no of the sides of the polygon
9+
n = int(input("Enter the no of the sides of the polygon : "))
10+
11+
# taking input for the length of the sides of the polygon
12+
l = int(input("Enter the length of the sides of the polygon : "))
13+
14+
15+
for _ in range(n):
16+
turtle.forward(l)
17+
turtle.right(360 / n)

0 commit comments

Comments
 (0)
Please sign in to comment.