-
Notifications
You must be signed in to change notification settings - Fork 0
/
box.py
34 lines (33 loc) · 901 Bytes
/
box.py
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
# 8
class box:
def __init__(self, measure):
print('Creating a box!')
vol = measure[0] * measure[1] * measure[2]
print(f"Volume of the box is {vol} cubic units")
self.height = measure[0]
self.width = measure[1]
self.breadth = measure[2]
print("Box 1")
b1 = box([10,10,10])
print("=========================")
print("Height:", b1.height)
print("Width:", b1.width)
print("Breadth:", b1.breadth)
print("-------------------------")
print("Box 2")
b2 = box((30,10,10))
print("=========================")
print("Height:", b2.height)
print("Width:", b2.width)
print("Breadth:", b2.breadth)
b2.height = 300
print("Updating Box 2!")
print("Height:", b2.height)
print("Width:", b2.width)
print("Breadth:", b2.breadth)
print("-------------------------")
print("Box 3")
b3 = b2
print("Height:", b3.height)
print("Width:", b3.width)
print("Breadth:", b3.breadth)