Advertisement
go6odn28
Jul 3rd, 2024
35
0
Never
This is comment for paste 01_rhombus_of_stars_1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class InputData:
  2.     def __init__(self) -> None:
  3.         self.n: int = int(input())
  4.  
  5.  
  6. class PrintRow:
  7.     def print_row(self, size: int, row: int) -> None:
  8.         empty: str = " "
  9.         star: str = "* "
  10.         print(f"{empty * (size - row)}{star * row}")
  11.  
  12.  
  13. class RhombusPrinter:
  14.     def __init__(self, size: int) -> None:
  15.         self.size: int = size
  16.         self.print_row_obj: PrintRow = PrintRow()
  17.  
  18.     def print_rhombus(self) -> None:
  19.         self._print_upper_part()
  20.         self._print_center_part()
  21.         self._print_bottom_part()
  22.  
  23.     def _print_upper_part(self) -> None:
  24.         for row in range(1, self.size):
  25.             self.print_row_obj.print_row(self.size, row)
  26.  
  27.     def _print_center_part(self) -> None:
  28.         self.print_row_obj.print_row(self.size, self.size)
  29.  
  30.     def _print_bottom_part(self) -> None:
  31.         for row in range(self.size - 1, 0, -1):
  32.             self.print_row_obj.print_row(self.size, row)
  33.  
  34.  
  35. input_data: InputData = InputData()
  36. rhombus_printer: RhombusPrinter = RhombusPrinter(input_data.n)
  37. rhombus_printer.print_rhombus()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement