QuestionQ4

VerifiedExceptions

What behavior is expected from the following code?

Question Image

Explanation

A three-element list has indices 0 through 2. Assigning a value to index 3 raises IndexError; the except BaseException handler catches it and prints list assignment index out of range.

Community Discussion

No comments yet. Be the first to start the discussion!