Python - Programming Language
This course covers the basics of programming in Python. Work your way through the videos and we'll teach you everything you need to know to start your programming journey!

Try Except

Lesson 27
Author : Mike Dane
Last Updated : October, 2017


Code

Copy# code asks user for number and divides 10 by it
# enter '0' to trigger exception
try:
    answer = 10 / int(input("Enter Number: "))
except ZeroDivisionError as e:
    print(e)
except:
    print("Caught any exception")