Try block is used to handle the exception at run time. If there is no error occurred at run time so all lines of code in the try block will execute successfully. If there is an error occurring at any line then the program will jump to the except block and the remaining lines code in the try block will not be executed. We can use try block with different resources such as except block, and finally block and else Block.
Video Pre-understanding guide:
• Introduction • Problem statement • Types of resources • Code level example of try with except • Real-life example of try with except • Code level example of try with finally • Real-life example of try with finally • Code level example of try with else • Differentiation between else and finally • Conclusion