In this challenge lab, you will handle errors and exceptions in your code. First, you will find a logical error in a function, and then you will refactor the function so that it does not cause any errors. Next, you will write code that contains an error, and then you will add a try/except block to handle exceptions. Finally, you will add a try/except block that handles multiple exceptions, and then you will add an else clause to handle code that must run without any exceptions. Note: Once you begin the challenge lab, you will not be able to pause, save, or exit and then return to your challenge lab. Please ensure that you have set aside enough time to complete the challenge lab before you start.
Learning Objectives
In this challenge lab, you will handle errors and exceptions in your code. First, you will find a logical error in a function, and then you will refactor the function so that it does not cause any errors. Next, you will write code that contains an error, and then you will add a try/except block to handle exceptions. Finally, you will add a try/except block that handles multiple exceptions, and then you will add an else clause to handle code that must run without any exceptions. Note: Once you begin the challenge lab, you will not be able to pause, save, or exit and then return to your challenge lab. Please ensure that you have set aside enough time to complete the challenge lab before you start.