2023-08-18 19:27:51 +02:00
|
|
|
import json
|
2023-08-27 14:12:28 +02:00
|
|
|
from shape import Shape
|
2023-08-18 19:27:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
def json_to_python():
|
2023-08-21 18:54:05 +02:00
|
|
|
with open("shapes.json") as lines:
|
|
|
|
data = json.load(lines)
|
|
|
|
for shape in data["shapes"]:
|
|
|
|
print("Type:", shape["type"])
|
|
|
|
print("Color:", shape["color"])
|
|
|
|
print()
|
2023-08-27 14:12:28 +02:00
|
|
|
sh1 = shape.create_shape(shape)
|
|
|
|
print(sh1.perimetr())
|
|
|
|
print(sh1.area())
|
2023-08-21 18:54:05 +02:00
|
|
|
return True
|
2023-08-18 19:27:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
print(json_to_python())
|