Standard exceptions you will see

18-minute lesson · module-exceptions-02

You are previewing this course as a guest

Read anything and run any exercise you like. It all runs in your own browser, so nothing here is saved: no XP, no progress, and the AI tutor needs an account. Sign in and your work starts counting.

Sign in

Standard exceptions you will see

18-minute lesson · module-exceptions-02

  • Name the most common built-in exception types and what triggers each.
  • Distinguish TypeError (wrong type) from ValueError (right type, wrong value).
  • Match a failing operation to the exception it raises.
  • Choose the right exception type to describe a given mistake.

Source attribution

Status: adapted

How to Think Like a Computer Scientist: Interactive Edition source · Exceptions / Standard exceptions

Adaptation notes. Reading rewritten in our voice. Examples are framed as small registrar / gradebook operations in an Iowa State CS theme. Hidden tests have the student classify each operation by the exception name it raises, without requiring try/except (covered in the next lesson).

License notes. Original chapter is GNU FDL 1.3 (Brad Miller and David Ranum). No verbatim text from the original is reproduced here.