Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def draw_figure(self, figure: str) -> str or None:
- """
- Draw a new figure.
- If the drawing has already reached maximum amount of figures
- don't add this figure and throw a DrawingFullError with the
- message "The drawing is full".
- There can be only unique figures on the drawing.
- This means that there is no way that, for example, two or more
- circles are on the drawing.
- In this case method does nothing and returns None.
- :param figure: A figure to draw.
- :return: The newly drawn figure.
- """
- self.figures_count += 1
- if self.figures_count > self.max_figures:
- self.figures_count -= 1
- raise DrawingFullError("The drawing is full")
- return figure
- for i in self.figures:
- if i == figure:
- self.figures_count =- 1
- return None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement