Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Last answered:

03 Jan 2023

Posted on:

23 Dec 2022

0

Question regarding raising Exception

When we try to raise exception using "raise TypeError("Only integers are allowed") "
Why the except block didn't run??
Did we already encounter the exception and we don't need except block we raise that in Try block???

1 answers ( 0 marked as helpful)
Instructor
Posted on:

03 Jan 2023

0

Hey Mayank,

Thank you for reaching out!

The purpose of the raise command is to raise an exception and then terminate the program immediately after. That is why we don't reach the except statement in the code.

Kind regards,
365 Hristina

Submit an answer