Assertions in Python: How to Use the 'try' and 'except' Keywords

preview_player
Показать описание
You'll learn how assertions are made in Python and how you can handle exceptions using "try" and "except."

You'll see that assertions follow this general pattern:

assert (condition), "Optional message if condition not met"

When assertions fail, they raise an AssertionErrorException.

You'll also cover how to handle assertion exceptions when they come up by using the "try" and "except" keywords.

You'll know how to handle other types of exceptions and how to provide useful information to the user about the errors.

Рекомендации по теме
Комментарии
Автор

0:51 as far as i know that statement would now raise this warning:
SyntaxWarning: assertion is always true, perhaps remove parentheses?

IunahYT
Автор

Great video for beginners. Keep up the work.

thagreatone
Автор

realy good video i am so stupid but i didn't learn shit :(

oussematoussli
Автор

what's up with f? You're using it a lot and I can't see why?

algoan
Автор

Try:
Main()
Except:
pass

I know my program it will debug

rearaw
Автор

How many times did you have to say '1 divided by sausage is meaningless' without giggling?

LucasVieira-obfx