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
randomList = [10,3,'a', 0, 2]

for entry in randomList:
    try:
        print "The entry is", entry
        r = 1.0/int(entry)
        print "The reciprocal of",entry,"is",r        
    except ValueError:
        print "Cannot Convert String to Integer!"
    except ZeroDivisionError:
        print "Cannot Divide by Zero"
            
Result: Thus a python program is written to demonstrate Exception Handling.