-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInheritance.py
More file actions
56 lines (42 loc) · 1015 Bytes
/
Copy pathInheritance.py
File metadata and controls
56 lines (42 loc) · 1015 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
'''
class Daffodil():
def __init__(self) -> None:
print("---------------------------")
def student(self):
print("I'm a STUDENT.")
def teacher(self):
print("I'm a TEACHER.")
class Hall(Daffodil):
def __init__(self) -> None:
super().__init__()
print("***************")
def hal(self):
print("I'm the AUTHORITY.")
s = Daffodil()
s.student()
p = Hall()
p.student()
p.teacher()
p.hal()
'''
n = int(input("Enter your choice: "))
class Shape():
a = ""
b = ""
def __init__(self) -> None:
print("Shape: ")
self.a, self.b = map(int, input().split( ))
if n == 1:
class Triangle(Shape):
def area(self):
A = 0.5 * self.a * self.b
print("Area of Triangle is: ", A)
t = Triangle()
t.area()
elif n == 2:
class Rectangle(Shape):
def area(self):
B = self.a * self.b
print("Area of Rectangle is: ", B)
r = Rectangle()
r.area()