Advertisement
furas

Python - banner

May 19th, 2018
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.99 KB | None | 0 0
  1. # buffer 30 rows, 40 columns
  2. screen = [ [" "]*40 for r in range(30) ]
  3.  
  4. #-----------------------------------------------------
  5.  
  6. # function to add H to buffer in position (x,y)
  7. def H(x, y):
  8.     global screen
  9.    
  10.     for row in range(7):
  11.         for col in range(5):
  12.             if col == 0 or col == 4 or row == 3:
  13.                 screen[row+y][col+x] = '*'
  14.             else:
  15.                 screen[row+y][col+x] = ' '
  16.  
  17. # function to add A to buffer in position (x,y)
  18. def A(x, y):
  19.     global screen
  20.    
  21.     for row in range(7):
  22.         for col in range(5):
  23.             if col == 0 or col == 4 or row == 0 or row == 3:
  24.                 screen[row+y][col+x] = '*'
  25.             else:
  26.                 screen[row+y][col+x] = ' '
  27.  
  28. # function to display buffer
  29. def display():
  30.     for row in screen:
  31.         print(''.join(row))
  32.  
  33. #-----------------------------------------------------
  34.  
  35. # add many H to buffer
  36. H(0, 0)
  37. A(7, 0)
  38. H(14, 8)
  39. A(21, 8)
  40. H(28, 16)
  41. A(35, 16)
  42.  
  43. # display current buffer
  44. display()
  45.    
  46. # result
  47.  
  48. '''
  49. *   *  *****                            
  50. *   *  *   *                            
  51. *   *  *   *                            
  52. *****  *****                            
  53. *   *  *   *                            
  54. *   *  *   *                            
  55. *   *  *   *                            
  56.                                        
  57.              *   *  *****              
  58.              *   *  *   *              
  59.              *   *  *   *              
  60.              *****  *****              
  61.              *   *  *   *              
  62.              *   *  *   *              
  63.              *   *  *   *              
  64.                                        
  65.                            *   *  *****
  66.                            *   *  *   *
  67.                            *   *  *   *
  68.                            *****  *****
  69.                            *   *  *   *
  70.                            *   *  *   *
  71.                            *   *  *   *        
  72. '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement