#simple program to draw shapes within shapes
import turtle
from turtle import *
#set speed
speed(3)
#set the drawing board
screen = turtle.Screen()
screen.bgcolor(‘lightblue’)
#choose shape that will draw the line
shape(‘turtle’)
#Collect the parameters to draw shapes
try:
numShape = int(input("Enter Number of Shapes: "))
rotateShape = 360/numShape
numSides = int(input("Enter Number of Sides: "))
rotateSide = 360/numSides
sideLen = int(input("Enter Lenght of Side: "))
color("red")
#Perform the drawing based from the values provided
pensize(1)
for counter in range (numShape):
for counter in range (numSides):
forward(sideLen)
right(rotateSide)
right(rotateShape)
except ValueError:
print(“Value Error: Invalid input”)
print(‘Try again’)
finally:
turtle.done()
What’s wrong with my try, except, finally? what is the best way to apply it in this code?
thanks