18 lines
296 B
Python
18 lines
296 B
Python
|
import json
|
||
|
from classes import Shapes
|
||
|
|
||
|
|
||
|
def json_to_python():
|
||
|
with open('shapes.json') as shapes:
|
||
|
data = json.load(shapes)
|
||
|
return data
|
||
|
|
||
|
|
||
|
obj = json_to_python()
|
||
|
|
||
|
for shape in obj['shapes']:
|
||
|
sh1 = Shape.create_shape(shape)
|
||
|
|
||
|
print(sh1.perimeter())
|
||
|
print(sh1.area())
|