So I am a bit confused about the scoping of variables with try and except blocks. How come my code allows me to use the variables outside of the try block and even the while loop for that matter even though I have not assigned them globally.
while True:
try:
width = int(input("Please enter the width of your floor plan:\n "))
height = int(input("Please enter the height of your floor plan:\n "))
except:
print("You have entered and invalid character. Please enter characters only. Press enter to continue\n")
else:
print("Success!")
break
print(width)
print(height)
Again I am able to print the variables even if they are defined within a try block which itself is within a while loop. How are they not local?