Advertisement
DoggianoMaster51

Terminal graphics hourglass

Feb 22nd, 2021
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. def hg(h, top=0, bot=0):
  2.    
  3.     print('#'*(2*(h+1)-1))
  4.    
  5.     for i in range(h):
  6.         if h-i <= top:
  7.             print(' '*i+'#'+'.'*(h-i)+'.'*(h-i-1)+'#'*(h-i>0))
  8.         else:
  9.             print(' '*i+'#'+' '*(h-i)+' '*(h-i-1)+'#'*(h-i>0))
  10.    
  11.     for i in range(h):
  12.         if h-i <= bot:
  13.             print(' '*(h-i)+'#'+'.'*(i)+'.'*(i-1)+'#'*(i>0))
  14.         else:
  15.             print(' '*(h-i)+'#'+' '*(i)+' '*(i-1)+'#'*(i>0))
  16.        
  17.     print('#'*(2*(h+1)-1))
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement