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

19 lines
396 B
Python
Raw Normal View History

2023-08-18 19:27:51 +02:00
import json
from shape import Shape
2023-08-18 19:27:51 +02:00
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
2023-08-18 19:27:51 +02:00
print(json_to_python())