Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. def draw_figure(self, figure: str) -> str or None:
  2. """
  3. Draw a new figure.
  4.  
  5. If the drawing has already reached maximum amount of figures
  6. don't add this figure and throw a DrawingFullError with the
  7. message "The drawing is full".
  8.  
  9. There can be only unique figures on the drawing.
  10. This means that there is no way that, for example, two or more
  11. circles are on the drawing.
  12. In this case method does nothing and returns None.
  13.  
  14. :param figure: A figure to draw.
  15. :return: The newly drawn figure.
  16. """
  17. self.figures_count += 1
  18. if self.figures_count > self.max_figures:
  19. self.figures_count -= 1
  20. raise DrawingFullError("The drawing is full")
  21. return figure
  22. for i in self.figures:
  23. if i == figure:
  24. self.figures_count =- 1
  25. return None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement