If you need to serve two different exceptions called Ex1 and Ex2 in one except branch, you can write:
Suggested Answer: C, D
Get Premium PCAP-31-03 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
39 comments · newest first
BE
Belen
1 year ago
B looks interesting, but I’m not sure about the syntax.
CE
Cecilia
1 year ago
Wait, can you really combine exceptions like that?
SO
Sol
1 year ago
No way, D doesn't even make sense!
FE
Felix
1 year ago
I thought it was A at first.
EA
Earleen
1 year ago
Option C is correct!
LU
Lucy
1 year ago
I think "except (Ex1, Ex2):" is the way to go, but I might be mixing it up with another language's syntax.
PE
Pedro
1 year ago
I feel like "except Ex1 Ex2" looks wrong, but I can't recall if it's supposed to be a tuple or just a list.
CO
Coleen
1 year ago
I practiced a similar question, and I believe the correct syntax is to use a comma between the exception names.
DE
Deeanna
1 year ago
I think I remember that you can catch multiple exceptions in one line, but I'm not sure if it's with a comma or something else.
TA
Tawanna
1 year ago
This seems like a good opportunity to demonstrate my understanding of logging configurations and custom category debugging. I'll carefully analyze the options and select the one that best meets the requirements stated in the question.
MO
Moon
1 year ago
Hmm, I'm not sure about this one. The diagram doesn't look exactly like the state machine examples we've seen in class. I might need to review my notes to be more confident in my answer.
TU
Tula
2 years ago
I'm just glad I don't have to worry about exceptions in my job as a professional cat juggler. Oh wait...
KI
Kimberely
1 year ago
C) except Ex1, Ex2:
CH
Chandra
1 year ago
B) except (ex1, Ex2):
AL
Alease
1 year ago
A) except Ex1 Ex2:
TR
Tracey
2 years ago
Juggling exceptions is like juggling flaming chainsaws - you gotta be careful! But B looks like the safest bet here.
MA
Mariko
2 years ago
Option A? Really? Sounds like something a c++ programmer would do. Python's got a better way, folks.
TI
Tijuana
1 year ago
That doesn't look like valid syntax for handling multiple exceptions in Python.
KR
Kristeen
1 year ago
D) except Ex1+Ex2:
LO
Louann
1 year ago
Definitely not the right way to do it in Python.
CL
Claribel
1 year ago
A) except Ex1 Ex2:
EL
Elenore
1 year ago
I think that's not the right syntax for handling multiple exceptions in Python.
CL
Clorinda
1 year ago
C) except Ex1, Ex2:
LI
Linn
1 year ago
Yeah, that's the correct way to handle multiple exceptions in Python.
LI
Lisbeth
1 year ago
B) except (ex1, Ex2):
AL
Allene
2 years ago
Hmm, I was leaning towards Option D, but I think I'll go with B. Gotta love those Python parentheses, am I right?
GR
Gracie
2 years ago
I was going to pick Option C, but now I'm not so sure. This exception handling stuff can be tricky!
BR
Britt
1 year ago
I believe Option B is the right choice for handling both Ex1 and Ex2 in one except branch.
LU
Luis
1 year ago
Don't worry, exception handling can be confusing at first. Just remember to use parentheses when listing multiple exceptions.
JE
Jeniffer
1 year ago
Yeah, I agree. Option B is the way to go when dealing with multiple exceptions.
HI
Hillary
1 year ago
I think Option B is the correct syntax for handling multiple exceptions in one except branch.
DO
Dorian
2 years ago
I agree, option B) is the correct way to handle multiple exceptions in one except branch.
YO
Yolando
2 years ago
I think the correct answer is B) except (Ex1, Ex2):
BR
Brice
2 years ago
But doesn't using parentheses in option B make it clearer that we are catching both exceptions?
KR
Krystina
2 years ago
Option B looks good to me, it's the most straightforward way to handle multiple exceptions in one except branch.
JO
Jonelle
2 years ago
Yes, using parentheses and separating the exceptions with commas makes it clear and concise.
ST
Stephane
2 years ago
I agree, option B is the correct way to handle multiple exceptions in one except branch.
FA
Fairy
2 years ago
I disagree, I believe the answer is C) except Ex1, Ex2:
BR
Brice
2 years ago
I think the correct answer is B) except (Ex1, Ex2):