-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexception.py
More file actions
42 lines (30 loc) · 788 Bytes
/
exception.py
File metadata and controls
42 lines (30 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# sys use to get exceptions
import sys
rendomList = ['a',0,2]
for num in rendomList:
try:
print('Value print is: ',num)
r = 1/int(num)
break
except:
print('Oppss sys problem: ',sys.exc_info()[0],'occured')
print('Next entry')
print('The receprocal of',num,'is',r)
# create class
# parent class
class Birds:
def __init__(self):
print('Bird is ready')
def whoisThis(self):
print('Bird')
def swim(self):
print('Swim faster')
# child class inherit parent calss Birds
class Piggen(Birds):
def __init__(self):
# call super class
super.__init__()
print('Pegun is ready')
def whoisThis(self):
print('Pegun is ready')
print(Birds().whoisThis())