Pentagon |
Code:
# Draw pentagon in turtle
from turtle import *
length = int(input('Please enter length: '))
# length=100
for i in range(5):
forward(length) # Forward turtle by length units
left(72) # Turn left turtle by 72 degree
# end for
# It will keep output to wait for the click,
# Otherwise output will be disappear.
exitonclick()
Input:
Please enter length: 100
Output:
No comments:
Post a Comment