PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""*DAILY CHALLENGE* : write a code that gets as input a positive number n > 1 and prints n rows from "3-SUM-TRIANGLE".
This is the 3-SUM-TRIANGLE for n = 7:
1
1 1
1 3 1
1 5 9 1
1 7 21 31 1
1 9 37 89 121 1
1 1 1 1 1 1 1
EXAMPLE n = 4:
1
1 1
1 3 1
1 1 1 1
- line 1 & 2 are always fix.
- Each number equals the sum of its left,top & top-left neighbour (if all 3 exist!!!).
- the n'th row is allways filled with '1'
GOOD LUCK AND HAVE FUN CODERS !!!
I'LL UPLOAD MY RESULT IN 12h.
"""
try:
n = abs(int(input()))
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run