hnc-eduard/HNS/Excercises/13082023 ДЗ по фигурам JSON/main.py

19 lines
396 B
Python
Executable File

import json
from shape import Shape
def json_to_python():
with open("shapes.json") as lines:
data = json.load(lines)
for shape in data["shapes"]:
print("Type:", shape["type"])
print("Color:", shape["color"])
print()
sh1 = shape.create_shape(shape)
print(sh1.perimetr())
print(sh1.area())
return True
print(json_to_python())