Python Programming: Lesson 17 - Identifying and Raising Exceptions

Published: 17 August 2021
on channel: youmils03
54
0

PLEASE SUBSCRIBE!!!

In the previous lesson (   • Python Programming: Lesson 16 - Modules  ), we studied modules in Python. Here, we look at some more modules but then turn our attention to exceptions. Handling exceptions is further explored in the next lesson.

Recall that a module is a package of code that someone has written, providing useful functions and constants that we can use inside our programs. All we have to do is import at the top of our program

To use a function F( ) from a module M
import M, then call M.F( )
from M import F, then call F( )
from M import F as G, then call G( )

[Not talked about in this video, but you can actually import a module and call it a different name in your program. import M as N, then call N.F( ). Can learn about it here    / pd5twn4vwmw  ]

An exception is a runtime error that occurs in our code. We can have:

organic exceptions - runtime errors caused by unintentional faults in our code
engineered exceptions - when we choose to manually throw a runtime error
handled exceptions - successful code that prevents a runtime error using a try/except block

We talk in this video about several types of errors in Python. Here are some of them

0:35 Review of Importing and Using Modules
2:34 Review of Importing Specific Functions from a Module
4:44 Review of Calling Imported Functions by Other Names
6:45 More Review of Modules (random Module)
8:42 NEW: Intro to Exceptions
9:59 NEW: Types of Exceptions
17:18 NEW: Raising Exceptions

An equivalent Java lesson is available here:    • Java Programming: Lesson 44 - Throwin...  

Ready to figure out how to handle exceptions? Check out lesson 18:    • Python Programming: Lesson 18 - Catch...  

Thanks for watching, and PLEASE SUBSCRIBE!!!


Watch video Python Programming: Lesson 17 - Identifying and Raising Exceptions online without registration, duration hours minute second in high quality. This video was added by user youmils03 17 August 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 54 once and liked it 0 people.