What's the problem with my try, except, finally?

#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

I don’t know, what is wrong with your try…except…finally?

Are you getting an error? Is it not doing what you expect?

Please tell us what you expect it to do, and what it is doing instead.
And if you are getting an error, please copy and paste the full
traceback so we can read it.

1 Like