Python Programming: Lesson 17 - Identifying and Raising Exceptions

Veröffentlicht am: 17 August 2021
auf dem Kanal: youmils03
63
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 - Throwing Exc...  

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

Thanks for watching, and PLEASE SUBSCRIBE!!!


Auf dieser Seite können Sie das Online-Video Python Programming: Lesson 17 - Identifying and Raising Exceptions mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer youmils03 17 August 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 63 Mal angesehen und es wurde von 0 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!