Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. n = int(input())
  2.  
  3. def create_line(limit, depth):
  4.     val_concat = depth
  5.     if (limit > depth):
  6.         val_concat = limit
  7.     if (depth == 1):
  8.         return [val_concat]
  9.     else:
  10.         return [val_concat]+create_line(limit, depth-1)+[val_concat]
  11.  
  12. def create_cible(depth, n, cible):
  13.     if (depth == 1):
  14.         line = create_line(depth, n)
  15.         cible.append(line)
  16.     else:
  17.         line = create_line(depth, n)
  18.         cible.append(line)
  19.         create_cible(depth-1, n, cible)
  20.         cible.append(line)
  21.  
  22. cible = []
  23. create_cible(n,n,cible)
  24. for line in cible:
  25.     for number in line:
  26.         print number,
  27.     print ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement