The Python Papers

The Python Papers

Share this post

The Python Papers
The Python Papers
Python Quiz 1 – Exceptionally Crazy
Copy link
Facebook
Email
Notes
More

Python Quiz 1 – Exceptionally Crazy

Mike Driscoll's avatar
Mike Driscoll
Jan 12, 2023
∙ Paid
6

Share this post

The Python Papers
The Python Papers
Python Quiz 1 – Exceptionally Crazy
Copy link
Facebook
Email
Notes
More
Share

The Python programming language allows you to catch exceptions using the try / except construct. But what happens if you nest exception handlers and throw in a break statement too?

Your mission in this quiz is to find the answer to that question!

The Quiz

Are you ready to start solving quizzes? Of course, you are!

Here’s your first one:

What will be output if you run this code?

  • A) Outer ZeroDivisionError exception caught

  • B) Error: You divided by zero!

  • C) Error: You divided by zero! Finally executed

  • D) Finally executed

  • E) None of the above

When you are ready, flip to the answer section of this book and check your answer!

Hint

If you’re stuck, try reading about Python’s break statement. It’s not normally used in exception handling.

The Python Quiz Book

This quiz comes from my latest book, The Python Quiz Book. You should get the book if you’d like to see the answer to this quiz or one of the over one hundred other quizzes! The quiz book will be finished in March 2023. However, you can purchase early access to it on the following websites:

  • Gumroad

  • Leanpub

Or, if you’re a paid subscriber, keep reading to find out the answer to this quiz!

Keep reading with a 7-day free trial

Subscribe to The Python Papers to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Mike Driscoll
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Copy link
Facebook
Email
Notes
More