-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path18-main.py
executable file
·41 lines (27 loc) · 944 Bytes
/
18-main.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
35
36
37
38
39
40
41
#!/usr/bin/python3
""" 18-main """
from models.rectangle import Rectangle
from models.square import Square
if __name__ == "__main__":
r1 = Rectangle(10, 7, 2, 8)
r2 = Rectangle(2, 4)
list_rectangles_input = [r1, r2]
Rectangle.save_to_file(list_rectangles_input)
list_rectangles_output = Rectangle.load_from_file()
for rect in list_rectangles_input:
print("[{}] {}".format(id(rect), rect))
print("---")
for rect in list_rectangles_output:
print("[{}] {}".format(id(rect), rect))
print("---")
print("---")
s1 = Square(5)
s2 = Square(7, 9, 1)
list_squares_input = [s1, s2]
Square.save_to_file(list_squares_input)
list_squares_output = Square.load_from_file()
for square in list_squares_input:
print("[{}] {}".format(id(square), square))
print("---")
for square in list_squares_output:
print("[{}] {}".format(id(square), square))