Advertisement
DeaD_EyE

c_tree

Dec 24th, 2016
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.11 KB | None | 0 0
  1. def c_tree(x, y, message, fill_sign='#', space_sign=' '):
  2.     print('{}{}'.format(' ' * ((2 * x - len(message)) // 2), message + '\n'))
  3.     for i in range(x):
  4.         space = space_sign * (x - i)
  5.         fill = fill_sign * (i * 2)
  6.         print(f'{space}{fill}{space}')
  7.     for _ in range(y):
  8.         space = space_sign * (x-1)
  9.         print('{}{}{}'.format(space, fill_sign*2, space))
  10.  
  11. c_tree(10, 3, 'Frohe Weihnachten', fill_sign='=', space_sign='#')
  12.  Frohe Weihnachten
  13.  
  14. ####################
  15. #########==#########
  16. ########====########
  17. #######======#######
  18. ######========######
  19. #####==========#####
  20. ####============####
  21. ###==============###
  22. ##================##
  23. #==================#
  24. #########==#########
  25. #########==#########
  26. #########==#########
  27.  
  28. c_tree(10, 3, 'Frohe Weihnachten', fill_sign='=', space_sign=' ')
  29.  Frohe Weihnachten
  30.  
  31.                    
  32.          ==        
  33.         ====        
  34.        ======      
  35.       ========      
  36.      ==========    
  37.     ============    
  38.    ==============  
  39.   ================  
  40.  ==================
  41.          ==        
  42.          ==        
  43.          ==
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement