File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7575- π [ Chapter 16 - Student Challenge] ( https://github.com/gitdagray/python-course/tree/main/lesson16 )
7676- π [ Chapter 17 - Lambda & Higher Order Functions] ( https://github.com/gitdagray/python-course/tree/main/lesson17 )
7777- π [ Chapter 18 - Classes, Objects, Inheritance & Polymorphism] ( https://github.com/gitdagray/python-course/tree/main/lesson18 )
78+ - π [ Chapter 19 - Errors & Exception Handling] ( https://github.com/gitdagray/python-course/tree/main/lesson19 )
Original file line number Diff line number Diff line change 1+ class JustNotCoolError (Exception ):
2+ pass
3+
4+
5+ x = 2
6+ try :
7+ raise JustNotCoolError ("This just isn't cool, man." )
8+ # raise Exception("I'm a custom exception!")
9+ # print(x / 0)
10+ # if not type(x) is str:
11+ # raise TypeError("Only strings are allowed.")
12+ except NameError :
13+ print ('NameError means something is probably undefined.' )
14+ except ZeroDivisionError :
15+ print ('Please do not divide by zero.' )
16+ except Exception as error :
17+ print (error )
18+ else :
19+ print ('No errors!' )
20+ finally :
21+ print ("I'm going to print with or without an error." )
You canβt perform that action at this time.
0 commit comments