jimMoonrock

Untitled

Apr 20th, 2021
516
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = 5
  2. list_chr = [[j for j in ["!"] * n ] for i in range(n)]
  3.  
  4.  
  5. for a in range(len(list_chr)):
  6.     below_the_diagonal, below_the_diagonal_count = 1, 1
  7.     above_the_diagonal_count, above_the_diagonal = 1, 1
  8.  
  9.     for b in range(len(list_chr)):
  10.         if a == b:
  11.             list_chr[a][b] = 0
  12.  
  13.  
  14.         elif a == b - above_the_diagonal_count:
  15.             list_chr[a][b] = above_the_diagonal
  16.             above_the_diagonal += 1
  17.             above_the_diagonal_count += 1
  18.  
  19.  
  20.  
  21.         elif a == b + below_the_diagonal_count:
  22.             list_chr[a][b] = "."
  23.             below_the_diagonal += 1
  24.             below_the_diagonal_count = 2
  25.  
  26.  
  27.  
  28.  
  29. for k in list_chr:
  30.     print(k)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×