csev/py4e

quit() in try and except coding examples

upstate-NY-reviewer opened this issue · 0 comments

The video shows an example of using quit() at the end of an except block. There was no such example in the book, meaning the reader would need to replay the video to find the example. You talk about quit() earlier in the book, but not in this context. This code is my beginning of example 3.1 from the text. (NOTE: indentation is lost when I save this note - am I missing something?)

try:
score = float(input("Enter Grade: "))
except:
print ("Enter numerical score between 0.0 and 1.0")
quit()

if (score<0.0) or (score>1.0):
print ("Enter numerical score between 0.0 and 1.0")
quit()

print ("Score = ", score)