r/pythonhelp • • May 09 '22

How is "B, C, D" printed?

class B(Exception):

____pass

class C(B):

____pass

class D(C):

____pass

for cls in [B, C, D]:

____try:

________raise cls()

____except D: print("D")

____except C: print("C")

____except B: print("B")

The underscores are spaces.

2 Upvotes

9 comments sorted by

View all comments

1

u/COLEMMANDO May 09 '22

Print.raise.cls() If that’s not correct try this. Print(raise.cls())