Python for Absolute Beginners Transcripts
Chapter: Error handling
Lecture: Practice time

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Of course it's time for you to practice adding air handling, creating exceptions and catching them in your program.
0:08 So that's what we're going to do in this practice exercise. Here we are over in CH11, Error Handling and we have a couple core concepts.
0:16 The basic try/except, which we talk about details here and then also the more advanced what do you do if you want to catch multiple errors
0:24 in one try block? Like the JSON itself is malformed or the file isn't there or the conversion didn't work or who knows what.
0:32 So it talks a little about that and then for your exercises go back to tic tac toe that we created or if you made it
0:37 as far as Connect 4 in our practice exercise, you want to use this one and the idea is to add error handling
0:44 around first the user input into the program using try and except, and then think of other ways that your program
0:50 could crash like for example Control C from the terminal that doesn't work in PyCharm but it does if you run it
0:56 from the terminal or maybe files are missing or other types of things that could go wrong, so you can check
1:00 the trace back, that's the big dump of what went wrong for the error type and you can add appropriate error handling for those as well.
1:07 So just practice making your program much more polished taking that input and handling those errors gracefully.
1:13 This is the sign of a professional, properly written program not one that just takes only the happy path
1:19 and then anything at all deviates it crashes, you don't want an app like that. So take this time to make your apps more solid.


Talk Python's Mastodon Michael Kennedy's Mastodon