Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.

Well done!

You have completed (UPI) Chapter 16: Working with Files in Python!

Instruction

Raising Exceptions

The raise statement A program can raise an exception when an error is detected. Raising an exception forces a program to deal with the error. If the exception is not handled using try and except, the program displays an error message and terminates. Example: Invalid pizza size The following class represents a pizza for sale. The SIZES dictionary maps an abbreviation to a size's name and pr...