Advertisement
Regional_Push

Untitled

Sep 23rd, 2021
823
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. def central():
  2.  
  3.     height_of_the_tower = get_height_of_the_tower()
  4.     printer(height_of_the_tower, height_of_the_tower)
  5.  
  6.  
  7. def printer(height_of_the_tower, height):
  8.     if height_of_the_tower == 0:
  9.         return
  10.     printer(height_of_the_tower - 1, height)
  11.     print(" " * (height - height_of_the_tower), end='')
  12.     print("#" * height_of_the_tower, end='')
  13.     print("  ", end='')
  14.     print("#" * height_of_the_tower)
  15.  
  16.  
  17. def get_height_of_the_tower():
  18.     while True:
  19.         try:
  20.             height_of_the_tower = int(input("height_of_the_tower: "))
  21.             if (height_of_the_tower > 0 and height_of_the_tower < 9):
  22.                 break
  23.         except ValueError:
  24.             None
  25.  
  26.     return height_of_the_tower
  27.  
  28.  
  29. central()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement