πŸ”₯ Welcome to my blog! Latest updates available now. Visit daily! πŸ”₯ πŸ”₯ Click Here for Latest Updates – Visit My Blog πŸ”₯
πŸ”₯ Latest Updates πŸ“Š GP Grade Finder πŸ“’ Government Services Info πŸ†• New Schemes Updates

What is Exception in Python?



πŸ‘‰An unwanted and unexpected event 

     that disturbs normal flow of program

     is called exception.

Ex:

ZeroDivisionError

TypeError

ValueError

FileNotFoundError

EOFError

SleepingError

TyrePuncturedError


πŸ‘‰It is highly recommended to handle 

     exceptions.The main objective of 

     exception handling is Graceful 

     Termination of the program.


πŸ‘‰Exception handling does not mean  

     repairing exception. We have to define

    alternative way to continue rest of the

    program normally.

Ex:

πŸ‘‰For example our programming 

     requirement is reading data from remote

     file locating at London. At runtime if 

     London file is not available then the

     program should not be terminated 

     abnormally.

    We have to provide local file to continue

    rest of the program normally.

    This way of defining alternative is nothing

     but exception handling.


try:

Copy code


read data from remote file locating at london

exception FileNotFoundError:

    use local file and continue rest of the

    program normally

Questions

What is an Exception?

What is the purpose of Exception Handling?

What is the meaning of Exception Handling?

No comments:

Post a Comment

Thank you Very Much.For Given Comment

Quatation of the Day 22-03-2026