Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FIGURE_TYPES = {
- "circle": Circle,
- "square": Square,
- "rectangle": Rectangle
- }
- def create_figures(input_data):
- result = []
- for f_info in input_data:
- figure_type = f_info['type']
- if figure_type in FIGURE_TYPES:
- figure_class = FIGURE_TYPES[figure_type]
- result.append(figure_class(**f_info))
- else:
- raise ValueError("Unsupported figure")
- return result
Advertisement
Add Comment
Please, Sign In to add comment