-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcla.py
More file actions
36 lines (26 loc) · 741 Bytes
/
cla.py
File metadata and controls
36 lines (26 loc) · 741 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
class Rectangle:
def __init__(self):
self.length = 10
self.breadth = 5
def area(self):
return self.length * self.breadth
def perimeter(self):
return 2*(self.length+self.breadth)
r = Rectangle()
print("Length is:", r.length)
print("Breadth is:", r.breadth)
print("Area is:", r.area())
print("Perimeter is:", r.perimeter())
class Rectanglee:
def __init__(self, l=1, b=1):
self.lengthh = l
self.breadthh = b
def areaa(self):
return self.lengthh * self.breadthh
def perimetera(self):
return 2*(self.lengthh+self.breadthh)
re = Rectanglee(15,8)
ree = Rectanglee(7, 10)
reee = Rectanglee()
print(re.areaa())
print(reee.perimetera())