QuestionQ15Verified/ExceptionsCopy linkReport a problemAsk AstroTutorSave questionWhich of the following code snippets execute without producing any unhandled exceptions?Choose twoABCDShow AnswerAnswerExplanationA bare except clause catches the ZeroDivisionError from 0 / 0 and the ValueError from math.sqrt(-1). The corresponding exception handlers in both snippets perform valid calculations, so execution completes normally. In contrast, successful try blocks cause their else blocks to run; converting an empty string with int() or the invalid string "1c1" with float() raises an unhandled ValueError.Show comments1Show commentsCommunity DiscussionNo comments yet. Be the first to start the discussion!
Community Discussion