| Ex No: 20 | Exception Handling |
|---|---|
| Aim: | To write a python program to demonstrate Exception Handling. |
| Algorithm | |
| Step1: Create a random list with numbeic and string values. | |
| Step2: Using for loop get each element from the list. | |
| A) try to divide 1 by the element (1/element). | |
| B) except ValueError and display 'Cannot Convert string to integer'. | |
| C) except ZeroDivisionError and display 'cannot divide by zero'. | |
| Source Code | |
|
|
| Result: | Thus a python program is written to demonstrate Exception Handling. |