• API
• FAQ
• Tools
• Archive
daily pastebin goal
26%
SHARE
TWEET

# Untitled

a guest Feb 20th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
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 ""
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top